aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kbuild/kbuild.txt5
-rw-r--r--Makefile5
-rw-r--r--scripts/Makefile.build35
3 files changed, 44 insertions, 1 deletions
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 4a990317b84a..376538c984ce 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -196,3 +196,8 @@ to be included in the databases, separated by blank space. E.g.:
196To get all available archs you can also specify all. E.g.: 196To get all available archs you can also specify all. E.g.:
197 197
198 $ make ALLSOURCE_ARCHS=all tags 198 $ make ALLSOURCE_ARCHS=all tags
199
200KBUILD_ENABLE_EXTRA_GCC_CHECKS
201--------------------------------------------------
202If enabled over the make command line with "W=1", it turns on additional
203gcc -W... options for more extensive build-time checking.
diff --git a/Makefile b/Makefile
index abb49bf8596e..2b1e37da2bb5 100644
--- a/Makefile
+++ b/Makefile
@@ -102,6 +102,10 @@ ifeq ("$(origin O)", "command line")
102 KBUILD_OUTPUT := $(O) 102 KBUILD_OUTPUT := $(O)
103endif 103endif
104 104
105ifeq ("$(origin W)", "command line")
106 export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
107endif
108
105# That's our default target when none is given on the command line 109# That's our default target when none is given on the command line
106PHONY := _all 110PHONY := _all
107_all: 111_all:
@@ -1262,6 +1266,7 @@ help:
1262 @echo ' make O=dir [targets] Locate all output files in "dir", including .config' 1266 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1263 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' 1267 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
1264 @echo ' make C=2 [targets] Force check of all c source with $$CHECK' 1268 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1269 @echo ' make W=1 [targets] Enable extra gcc checks'
1265 @echo '' 1270 @echo ''
1266 @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 1271 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
1267 @echo 'For further info see the ./README file' 1272 @echo 'For further info see the ./README file'
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 4eb99ab34053..d5f925abe4d2 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -49,6 +49,40 @@ ifeq ($(KBUILD_NOPEDANTIC),)
49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) 49 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
50 endif 50 endif
51endif 51endif
52
53#
54# make W=1 settings
55#
56# $(call cc-option... ) handles gcc -W.. options which
57# are not supported by all versions of the compiler
58ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
59KBUILD_EXTRA_WARNINGS := -Wextra
60KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
61KBUILD_EXTRA_WARNINGS += -Waggregate-return
62KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
63KBUILD_EXTRA_WARNINGS += -Wcast-qual
64KBUILD_EXTRA_WARNINGS += -Wcast-align
65KBUILD_EXTRA_WARNINGS += -Wconversion
66KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
67KBUILD_EXTRA_WARNINGS += -Wlogical-op
68KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
69KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
70KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
71KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
72KBUILD_EXTRA_WARNINGS += -Wnested-externs
73KBUILD_EXTRA_WARNINGS += -Wold-style-definition
74KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
75KBUILD_EXTRA_WARNINGS += -Wpacked
76KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
77KBUILD_EXTRA_WARNINGS += -Wpadded
78KBUILD_EXTRA_WARNINGS += -Wpointer-arith
79KBUILD_EXTRA_WARNINGS += -Wredundant-decls
80KBUILD_EXTRA_WARNINGS += -Wshadow
81KBUILD_EXTRA_WARNINGS += -Wswitch-default
82KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
83KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
84endif
85
52include scripts/Makefile.lib 86include scripts/Makefile.lib
53 87
54ifdef host-progs 88ifdef host-progs
@@ -403,7 +437,6 @@ ifneq ($(cmd_files),)
403 include $(cmd_files) 437 include $(cmd_files)
404endif 438endif
405 439
406
407# Declare the contents of the .PHONY variable as phony. We keep that 440# Declare the contents of the .PHONY variable as phony. We keep that
408# information in a variable se we can use it in if_changed and friends. 441# information in a variable se we can use it in if_changed and friends.
409 442