On Mon, Oct 27, 2025, at 03:31, Kees Cook wrote:
On October 26, 2025 4:56:30 PM PDT, Andrew Morton akpm@linux-foundation.org wrote:
From: Hanne-Lotta M��enp���� hannelotta@gmail.com Subject: headers: add check for C standard version Date: Sun, 26 Oct 2025 21:58:46 +0200
Compiling the kernel with GCC 15 results in errors, as with GCC 15 the default language version for C compilation has been changed from -std=gnu17 to -std=gnu23 - unless the language version has been changed using
KBUILD_CFLAGS += -std=gnu17
or earlier.
C23 includes new keywords 'bool', 'true' and 'false', which cause compilation errors in Linux headers:
./include/linux/types.h:30:33: error: `bool' cannot be defined via `typedef'
./include/linux/stddef.h:11:9: error: cannot use keyword `false' as enumeration constant
Add check for C Standard's version in the header files to be able to compile the kernel with C23.
What? These are internal headers, not UAPI. We build Linux with -std=gnu11. Let's not add meaningless version checks.
I have a similar patch in my own testing tree but in the end decided not to send it because supporting std=gnu23 doesn't actually add any features we want.
The next time we raise the compiler version from gcc-8 to anything newer, we can change the version selection to use --std=gnu2x unconditionally.
Arnd