Re: [GIT PULL] MM updates for 6.14-rc1
From: Uros Bizjak
Date: Mon Jan 27 2025 - 02:31:50 EST
On Mon, Jan 27, 2025 at 1:08 AM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> 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.
Got it, I'll do it this way.
Thanks,
Uros.