]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
compiler-gcc.h: Introduce __diag_GCC_all
authorNathan Chancellor <nathan@kernel.org>
Fri, 4 Apr 2025 22:10:02 +0000 (15:10 -0700)
committerPetr Mladek <pmladek@suse.com>
Thu, 10 Apr 2025 14:08:28 +0000 (16:08 +0200)
It is not possible disabling a diagnostic for all versions of GCC
without hard coding the minimum supported version at the site, as the
GCC specific macros require a minimum version to disable the warning
for:

    __diag_ignore(GCC, 5, ...);

__diag_ignore_all() does not solve this issue because it disables a
diagnostic for all versions of both GCC and clang, not just one or the
other.

Introduce __diag_GCC_all so that developers can write

    __diag_ignore(GCC, all, ...);

to disable a particular diagnostic for all versions of GCC, while not
affecting clang.

Closes: https://lore.kernel.org/r/CAHk-=wgfX9nBGE0Ap9GjhOy7Mn=RSy=rx0MvqfYFFDx31KJXqQ@mail.gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://patch.msgid.link/20250404-vsprintf-convert-pragmas-to-__diag-v1-1-5d6c5c55b2bd@kernel.org
Signed-off-by: Petr Mladek <pmladek@suse.com>
include/linux/compiler-gcc.h

index c9b58188ec61e777e2001072380f9ce9e466ecd2..c75a222880f976728e3664e47ba0a4cef5532392 100644 (file)
 #define __diag_GCC_8(s)
 #endif
 
+#define __diag_GCC_all(s)      __diag(s)
+
 #define __diag_ignore_all(option, comment) \
        __diag(__diag_GCC_ignore option)