aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg2011-04-27 15:15:27 -0500
committerMichal Marek2011-04-28 10:59:07 -0500
commit28bc20dccadc610c56e27255aeef2938141a0cd3 (patch)
treedfaf1a2b593a25cabffe8a83e5aaf34b3c2c166d
parent40df759e2b9ec945f1a5ddc61b3fdfbb6583257e (diff)
downloadam43-linux-kernel-28bc20dccadc610c56e27255aeef2938141a0cd3.tar.gz
am43-linux-kernel-28bc20dccadc610c56e27255aeef2938141a0cd3.tar.xz
am43-linux-kernel-28bc20dccadc610c56e27255aeef2938141a0cd3.zip
kbuild: implement several W= levels
Building a kernel with "make W=1" produces far too much noise to be useful. Divide the warning options in three groups: W=1 - warnings that may be relevant and does not occur too often W=2 - warnings that occur quite often but may still be relevant W=3 - the more obscure warnings, can most likely be ignored When building the whole kernel, those levels produce: W=1 - 4859 warnings W=2 - 1394 warnings W=3 - 86666 warnings respectively. Warnings have been counted with Geert's script at http://www.kernel.org/pub/linux/kernel/people/geert/linux-log/linux-log-summary.pl Many warnings occur from .h files so fixing one file may have a nice effect on the total number of warnings. With these changes I am actually tempted to try W=1 now and then. Previously there was just too much noise. Borislav: - make the W= levels exclusive - move very noisy and making little sense for the kernel warnings to W=3 - drop -Woverlength-strings due to useless warning message - copy explanatory text for the different warning levels to 'make help' - recount warnings per level Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Borislav Petkov <bp@alien8.de> Cc: Dave Jones <davej@redhat.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r--Makefile8
-rw-r--r--scripts/Makefile.build65
2 files changed, 44 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index d7c42319fe1..d43429f4ced 100644
--- a/Makefile
+++ b/Makefile
@@ -103,7 +103,7 @@ ifeq ("$(origin O)", "command line")
103endif 103endif
104 104
105ifeq ("$(origin W)", "command line") 105ifeq ("$(origin W)", "command line")
106 export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1 106 export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
107endif 107endif
108 108
109# 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
@@ -1274,7 +1274,11 @@ help:
1274 @echo ' make O=dir [targets] Locate all output files in "dir", including .config' 1274 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1275 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' 1275 @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
1276 @echo ' make C=2 [targets] Force check of all c source with $$CHECK' 1276 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1277 @echo ' make W=1 [targets] Enable extra gcc checks' 1277 @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where'
1278 @echo ' 1: warnings which may be relevant and do not occur too often'
1279 @echo ' 2: warnings which occur quite often but may still be relevant'
1280 @echo ' 3: more obscure warnings, can most likely be ignored'
1281
1278 @echo '' 1282 @echo ''
1279 @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 1283 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
1280 @echo 'For further info see the ./README file' 1284 @echo 'For further info see the ./README file'
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e1244ef308c..9c0c4812794 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -51,36 +51,47 @@ ifeq ($(KBUILD_NOPEDANTIC),)
51endif 51endif
52 52
53# 53#
54# make W=1 settings 54# make W=... settings
55# 55#
56# $(call cc-option... ) handles gcc -W.. options which 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
57# are not supported by all versions of the compiler 61# are not supported by all versions of the compiler
58ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS 62ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
59KBUILD_EXTRA_WARNINGS := -Wextra 63warning-1 := -Wextra -Wunused -Wno-unused-parameter
60KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter 64warning-1 += -Wmissing-declarations
61KBUILD_EXTRA_WARNINGS += -Waggregate-return 65warning-1 += -Wmissing-format-attribute
62KBUILD_EXTRA_WARNINGS += -Wbad-function-cast 66warning-1 += -Wmissing-prototypes
63KBUILD_EXTRA_WARNINGS += -Wcast-qual 67warning-1 += -Wold-style-definition
64KBUILD_EXTRA_WARNINGS += -Wcast-align 68warning-1 += $(call cc-option, -Wmissing-include-dirs)
65KBUILD_EXTRA_WARNINGS += -Wconversion 69
66KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization 70warning-2 := -Waggregate-return
67KBUILD_EXTRA_WARNINGS += -Wlogical-op 71warning-2 += -Wcast-align
68KBUILD_EXTRA_WARNINGS += -Wmissing-declarations 72warning-2 += -Wdisabled-optimization
69KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute 73warning-2 += -Wnested-externs
70KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,) 74warning-2 += -Wshadow
71KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes 75warning-2 += $(call cc-option, -Wlogical-op)
72KBUILD_EXTRA_WARNINGS += -Wnested-externs 76
73KBUILD_EXTRA_WARNINGS += -Wold-style-definition 77warning-3 := -Wbad-function-cast
74KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,) 78warning-3 += -Wcast-qual
75KBUILD_EXTRA_WARNINGS += -Wpacked 79warning-3 += -Wconversion
76KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat 80warning-3 += -Wpacked
77KBUILD_EXTRA_WARNINGS += -Wpadded 81warning-3 += -Wpadded
78KBUILD_EXTRA_WARNINGS += -Wpointer-arith 82warning-3 += -Wpointer-arith
79KBUILD_EXTRA_WARNINGS += -Wredundant-decls 83warning-3 += -Wredundant-decls
80KBUILD_EXTRA_WARNINGS += -Wshadow 84warning-3 += -Wswitch-default
81KBUILD_EXTRA_WARNINGS += -Wswitch-default 85warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
82KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,) 86warning-3 += $(call cc-option, -Wvla)
83KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS) 87
88warning := $(warning-$(KBUILD_ENABLE_EXTRA_GCC_CHECKS))
89
90ifeq ("$(warning)","")
91 $(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
92endif
93
94KBUILD_CFLAGS += $(warning)
84endif 95endif
85 96
86include scripts/Makefile.lib 97include scripts/Makefile.lib