Re: [GIT PULL] MM updates for 6.14-rc1

From: Uros Bizjak
Date: Sun Jan 26 2025 - 14:47:14 EST


On Sun, Jan 26, 2025 at 7:30 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> That does seem to work, but I'd admittedly be happier if we could just
> find some way to dynamically disable/enable __typeof_unqual__ based on
> which compiler is used, rather than make it a config option. So that
> bindgen would not see it, but a recent enough C compiler would.
>
> We already use '__has_attribute()' for some of these things. There's a
> '__has_extension()' thing that comes from clang but that gcc also
> supports.
>
> But I can't find the list of extensions that that model supports, and
> I guess typeof_unqual isn't on that list if I find it.
>
> In the absence of something _clean_ like that, can we just do it in
> <linux/compiler-xyz.h> instead? IOW, not use the CONFIG_xyz tests for
> this at all, but do something like
>
> /*
> * bindgen uses LLVM even if our C compiler is gcc, so we cannot
> * rely on CONFIG_CC_HAS_TYPEOF_UNQUAL
> */
> #if __clang_major__ >= 19
> # define CC_HAS_TYPEOF_UNQUAL 1
> #endif
>
> in <linux/compiler-clang.h> and the gcc version check for gcc (I don't
> know when __typeof_unqual__ made it)?

It is available in gcc-14.

Uros.