On Sun, Jan 26, 2025 at 11:00 PM Linus Torvalds wrote: > > On Sun, 26 Jan 2025 at 11:47, Uros Bizjak wrote: > > > > > #if __clang_major__ >= 19 > > > # define CC_HAS_TYPEOF_UNQUAL 1 > > > #endif > > > > It is available in gcc-14. > > Ok, let's take that approach, instead of messing with CONFIG_CC_HAS_xyz. Please find attached an incremental patch that implements the proposed approach. The detection is put in include/linux/compiler.h where we can consolidate checks for both compilers: --cut here-- /* * Declare compiler support for __typeof_unqual__() operator. * * bindgen uses LLVM even if our C compiler is gcc, so we cannot * rely on the auto-detected CONFIG_CC_HAS_TYPEOF_UNQUAL. * * XXX: Remove test for __CHECKER__ once * sparse learns about __typeof_unqual__. */ #if ((defined(__GNUC__) && __GNUC__ >= 14) || \ (defined(__clang__) && __clang_major__ >= 19)) && \ !defined(__CHECKER__) # define CC_HAS_TYPEOF_UNQUAL 1 #endif /* * Define TYPEOF_UNQUAL() to use __typeof_unqual__() as typeof * operator when available, to return an unqualified type of the exp. */ #if defined(CC_HAS_TYPEOF_UNQUAL) # define TYPEOF_UNQUAL(exp) __typeof_unqual__(exp) #else # define TYPEOF_UNQUAL(exp) __typeof__(exp) #endif --cut here-- The above also consolidates checks for __CHECKER__, resulting in a much simpler compile check in arch/x86/include/percpu.h. I have tested the new patch series with a bunch of compilers, works as expected, but it is getting a bit late here. I'll resend the series tomorrow, after some more testing. Uros.