aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
authorBorislav Petkov <bp@alien8.de>2011-03-01 03:35:29 -0500
committerMichal Marek <mmarek@suse.cz>2011-03-09 09:35:35 -0500
commit4a5838ad9d2d4f7354a310982483f4c76aa0abeb (patch)
treefd037adafd8d7dd367292fe20ab290ccc79569a4 /scripts/Makefile.build
parentde933bd833be1a53bd361c9a327afd3c65413351 (diff)
kbuild: Add extra gcc checks
Add a 'W=1' Makefile switch which adds additional checking per build object. The idea behind this option is targeted at developers who, in the process of writing their code, want to do the occasional make W=1 [target.o] and let gcc do more extensive code checking for them. Then, they could eyeball the output for valid gcc warnings about various bugs/discrepancies which are not reported during the normal build process. For more background information and a use case, read through this thread: http://marc.info/?l=kernel-janitors&m=129802065918147&w=2 Cc: Michal Marek <mmarek@suse.cz> Cc: linux-kbuild@vger.kernel.org Acked-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build35
1 files changed, 34 insertions, 1 deletions
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