aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-04-14 05:27:10 -0400
committerMichal Marek <mmarek@suse.cz>2014-04-16 17:28:41 -0400
commita86fe3537350613c0181ce936884036a9695ceea (patch)
tree7572e2131dc2c9e014c4c22302336c5812912393 /scripts/Makefile.build
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
kbuild: move extra gcc checks to scripts/Makefile.extrawarn
W=... provides extra gcc checks. Having such code in scripts/Makefile.build results in the same flags being added to KBUILD_CFLAGS multiple times becuase scripts/Makefile.build is invoked every time Kbuild descends into the subdirectories. Since the top Makefile is already too cluttered, this commit moves all of extra gcc check stuff to a new file scripts/Makefile.extrawarn, which is included from the top Makefile. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> CC: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build61
1 files changed, 0 insertions, 61 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 003bc263105a..b5e02b669469 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -50,67 +50,6 @@ ifeq ($(KBUILD_NOPEDANTIC),)
50 endif 50 endif
51endif 51endif
52 52
53#
54# make W=... settings
55#
56# W=1 - warnings that may be relevant and does not occur too often
57# W=2 - warnings that occur quite often but may still be relevant
58# W=3 - the more obscure warnings, can most likely be ignored
59#
60# $(call cc-option, -W...) handles gcc -W.. options which
61# are not supported by all versions of the compiler
62ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
63warning- := $(empty)
64
65warning-1 := -Wextra -Wunused -Wno-unused-parameter
66warning-1 += -Wmissing-declarations
67warning-1 += -Wmissing-format-attribute
68warning-1 += $(call cc-option, -Wmissing-prototypes)
69warning-1 += -Wold-style-definition
70warning-1 += $(call cc-option, -Wmissing-include-dirs)
71warning-1 += $(call cc-option, -Wunused-but-set-variable)
72warning-1 += $(call cc-disable-warning, missing-field-initializers)
73
74# Clang
75warning-1 += $(call cc-disable-warning, initializer-overrides)
76warning-1 += $(call cc-disable-warning, unused-value)
77warning-1 += $(call cc-disable-warning, format)
78warning-1 += $(call cc-disable-warning, unknown-warning-option)
79warning-1 += $(call cc-disable-warning, sign-compare)
80warning-1 += $(call cc-disable-warning, format-zero-length)
81warning-1 += $(call cc-disable-warning, uninitialized)
82warning-1 += $(call cc-option, -fcatch-undefined-behavior)
83
84warning-2 := -Waggregate-return
85warning-2 += -Wcast-align
86warning-2 += -Wdisabled-optimization
87warning-2 += -Wnested-externs
88warning-2 += -Wshadow
89warning-2 += $(call cc-option, -Wlogical-op)
90warning-2 += $(call cc-option, -Wmissing-field-initializers)
91
92warning-3 := -Wbad-function-cast
93warning-3 += -Wcast-qual
94warning-3 += -Wconversion
95warning-3 += -Wpacked
96warning-3 += -Wpadded
97warning-3 += -Wpointer-arith
98warning-3 += -Wredundant-decls
99warning-3 += -Wswitch-default
100warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
101warning-3 += $(call cc-option, -Wvla)
102
103warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
104warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
105warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
106
107ifeq ("$(strip $(warning))","")
108 $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
109endif
110
111KBUILD_CFLAGS += $(warning)
112endif
113
114include scripts/Makefile.lib 53include scripts/Makefile.lib
115 54
116ifdef host-progs 55ifdef host-progs