aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2014-10-20 05:23:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-11-15 17:29:55 -0500
commit51b97e354ba9fce1890cf38ecc754aa49677fc89 (patch)
tree27720bcaf036b70f4bd70cd7c75645ba08860d57 /Makefile
parent1afcb6ed0d34c5794a51fe325076f006c8babaf4 (diff)
kernel: use the gnu89 standard explicitly
Sasha Levin reports: "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" There are multiple small issues with the new default, but the biggest issue seems to be that the old - and very useful - GNU extension to allow a cast in front of an initializer has gone away. Patch updated by Kirill: "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" Note by Andrew Pinski: "Yes it was reported and both problems relating to this extension has been added to gnu99 and gnu11. Though there are other issues with the kernel dealing with extern inline have different semantics between gnu89 and gnu99/11" End result: we may be able to move up to a newer stdc model eventually, but right now the newer models have some annoying deficiencies, so the traditional "gnu89" model ends up being the preferred one. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Singed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index bc7eb6ada966..6e1b8e76dfb5 100644
--- a/Makefile
+++ b/Makefile
@@ -297,7 +297,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
297 297
298HOSTCC = gcc 298HOSTCC = gcc
299HOSTCXX = g++ 299HOSTCXX = g++
300HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer 300HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
301HOSTCXXFLAGS = -O2 301HOSTCXXFLAGS = -O2
302 302
303ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) 303ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
@@ -401,7 +401,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__
401KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 401KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
402 -fno-strict-aliasing -fno-common \ 402 -fno-strict-aliasing -fno-common \
403 -Werror-implicit-function-declaration \ 403 -Werror-implicit-function-declaration \
404 -Wno-format-security 404 -Wno-format-security \
405 -std=gnu89
405 406
406KBUILD_AFLAGS_KERNEL := 407KBUILD_AFLAGS_KERNEL :=
407KBUILD_CFLAGS_KERNEL := 408KBUILD_CFLAGS_KERNEL :=