Re: [GIT PULL] more printk for 6.15

From: Linus Torvalds
Date: Wed Apr 02 2025 - 15:06:29 EST


On Wed, 2 Apr 2025 at 11:39, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
>
> Yes. Clang complains on unknown pragma.

What a crock.

It says GCC, for chrissake!

And clang clearly doesn't complain about

> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic pop

which are *not* protected by that #ifndef __clang__ thing.

So this smells like a clang bug to me.

Can we please use wrapper defines instead so that we don't have that
#ifndef in the middle of code? And since those don't work with
'#pragma', they need to use the _Pragma() operator instead.

Something like

#define GCC_PRAGMA(x) _Pragma(#x)

in compiler-gcc.h, and then add a

#ifndef GCC_PRAGMA
#define GCC_PRAGMA(x) /* Nothing */
#endif

and then you can just do

GCC_PRAGMA(Wsuggest-attribute=format)

in places like this?

(Entirely untested: I *despise* pragma in general).

Or hey, how about we just add "-Wno-suggest-attribute=format" to the
compiler command line? Like we do for all the other garbage warnings
that we don't want to see.

Linus