Re: [GIT PULL] MM updates for 6.14-rc1
From: Linus Torvalds
Date: Sun Jan 26 2025 - 19:08:58 EST
On Sun, 26 Jan 2025 at 15:27, Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> The detection is put in include/linux/compiler.h where we can
> consolidate checks for both compilers:
No. Please. We have compiler-specific header files for a reason.
Exactly so that we do *not* need to have disgusting tests like
#if ((defined(__GNUC__) && __GNUC__ >= 14) || \
(defined(__clang__) && __clang_major__ >= 19)) && \
!defined(__CHECKER__)
and instead it should just be
#define CC_HAS_TYPEOF_UNQUAL (__clang_major__ >= 19)
in compiler-clang.h, and
#define CC_HAS_TYPEOF_UNQUAL (__GNUC__ >= 14)
in compiler-gcc.h.
And then in the actual compiler.h, we could do
#define USE_TYPEOF_UNQUAL (CC_HAS_TYPEOF_UNQUAL && !defined(__CHECKER__))
and now the places that then want to use __typeof_unqual__ have a very
straightforward way to check if they should do so.
Linus