kernel: use the gnu89 standard explicitly
PATCH v2 1/1 kernel: use the gnu89 standard explicitly
gcc5 changes the default standard to c11, which makes kernel build unhappy.
Explicitly define the kernel standard to be gnu89 which should keep everything working exactly like it was before gcc5.
---
Changes from v1:
- I've accidently placed the statement in a CONFIG_READABLE_ASM.
It shouldn't be there.
Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -625,6 +625,7 @@ all: vmlinux include $(srctree)/arch/$(SRCARCH)/Makefile KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) +KBUILD_CFLAGS += $(call cc-option,-std=gnu89,) ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
Signature · 1 line
1.7.10.4
Quoted 21 lines · Sasha Levin
gcc5 changes the default standard to c11, which makes kernel build unhappy.
Explicitly define the kernel standard to be gnu89 which should keep everything working exactly like it was before gcc5.
Signed-off-by Sasha Levin <[email protected]>---
Changes from v1:
- I've accidently placed the statement in aCONFIG_READABLE_ASM.
It shouldn't be there.Makefile | 1 + 1 file changed, 1 insertion(+)Makefile +0
-0
Makefile all: vmlinux · line 628
Quoted 4 lines
Makefile +1
-0@@ -625,6 +625,7 @@ all: vmlinux include $(srctree)/arch/$(SRCARCH)/Makefile KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) +KBUILD_CFLAGS += $(call cc-option,-std=gnu89,)
I'm pretty sure all gcc versions you can build kernel with supports -std=gnu89. cc-option is redunrant.
We also need to adjust HOSTCFLAGS otherwise allmodconfig fails for me.
Makefile +3 -2
@@ -297,7 +297,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 HOSTCXXFLAGS = -O2 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
@@ -401,7 +401,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ - -Wno-format-security + -Wno-format-security \ + -std=gnu89 KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL :=
Signature · 1 line
Kirill A. Shutemov
2014-10-20 5:40 GMT+03:00 Sasha Levin <[email protected]>:
Quoted 6 lines
gcc5 changes the default standard to c11, which makes kernel build unhappy.
Explicitly define the kernel standard to be gnu89 which should keep everything working exactly like it was before gcc5.
Ping.
Quoted 10 lines · Andrey Ryabinin
2014-10-20 5:40 GMT+03:00 Sasha Levin <[email protected]>:
Quoted 6 lines
gcc5 changes the default standard to c11, which makes kernel build unhappy.
Explicitly define the kernel standard to be gnu89 which should keep everything working exactly like it was before gcc5.
Ping.
fwiw, I'm happy with using Kirill's patch from this thread, it even has his SoB! :)
Thanks,
Sasha