aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-08-31 12:25:55 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-09-06 10:46:52 -0400
commite27128db62834c5b906585c2d97f0ddd431fa28f (patch)
tree14ce5ad32429d3364d18ed760c2efce3abaa2e8f
parent64a91907c896247c19f8314add2c9baa573fbd3c (diff)
kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN
KBUILD_ENABLE_EXTRA_GCC_CHECKS started as a switch to add extra warning options for GCC, but now it is a historical misnomer since we use it also for Clang, DTC, and even kernel-doc. Rename it to more sensible, shorter KBUILD_EXTRA_WARN. For the backward compatibility, KBUILD_ENABLE_EXTRA_GCC_CHECKS is still supported (but not advertised in the documentation). I also fixed up 'make help', and updated the documentation. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Sedat Dilek <sedat.dilek@gmail.com>
-rw-r--r--Documentation/kbuild/kbuild.rst14
-rw-r--r--Makefile2
-rw-r--r--scripts/Makefile.build2
-rw-r--r--scripts/Makefile.extrawarn13
-rw-r--r--scripts/Makefile.lib4
-rw-r--r--scripts/genksyms/Makefile2
6 files changed, 23 insertions, 14 deletions
diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
index 62f9d86c082c..f1e5dce86af7 100644
--- a/Documentation/kbuild/kbuild.rst
+++ b/Documentation/kbuild/kbuild.rst
@@ -105,6 +105,15 @@ The output directory can also be specified using "O=...".
105 105
106Setting "O=..." takes precedence over KBUILD_OUTPUT. 106Setting "O=..." takes precedence over KBUILD_OUTPUT.
107 107
108KBUILD_EXTRA_WARN
109-----------------
110Specify the extra build checks. The same value can be assigned by passing
111W=... from the command line.
112
113See `make help` for the list of the supported values.
114
115Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
116
108KBUILD_DEBARCH 117KBUILD_DEBARCH
109-------------- 118--------------
110For the deb-pkg target, allows overriding the normal heuristics deployed by 119For the deb-pkg target, allows overriding the normal heuristics deployed by
@@ -241,11 +250,6 @@ To get all available archs you can also specify all. E.g.::
241 250
242 $ make ALLSOURCE_ARCHS=all tags 251 $ make ALLSOURCE_ARCHS=all tags
243 252
244KBUILD_ENABLE_EXTRA_GCC_CHECKS
245------------------------------
246If enabled over the make command line with "W=1", it turns on additional
247gcc -W... options for more extensive build-time checking.
248
249KBUILD_BUILD_TIMESTAMP 253KBUILD_BUILD_TIMESTAMP
250---------------------- 254----------------------
251Setting this to a date string overrides the timestamp used in the 255Setting this to a date string overrides the timestamp used in the
diff --git a/Makefile b/Makefile
index 06e1e21c0f45..adc0cabe2382 100644
--- a/Makefile
+++ b/Makefile
@@ -1538,7 +1538,7 @@ help:
1538 @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)' 1538 @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)'
1539 @echo ' make C=2 [targets] Force check of all c source with $$CHECK' 1539 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1540 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' 1540 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1541 @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' 1541 @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
1542 @echo ' 1: warnings which may be relevant and do not occur too often' 1542 @echo ' 1: warnings which may be relevant and do not occur too often'
1543 @echo ' 2: warnings which occur quite often but may still be relevant' 1543 @echo ' 2: warnings which occur quite often but may still be relevant'
1544 @echo ' 3: more obscure warnings, can most likely be ignored' 1544 @echo ' 3: more obscure warnings, can most likely be ignored'
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 2a21ca86b720..f72aba64d611 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -85,7 +85,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
85 cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< 85 cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
86endif 86endif
87 87
88ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),) 88ifneq ($(KBUILD_EXTRA_WARN),)
89 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< 89 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
90endif 90endif
91 91
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index d226c5fb13e2..53eb7e0c6a5a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -8,14 +8,19 @@
8 8
9KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) 9KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
10 10
11# backward compatibility
12KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
13
11ifeq ("$(origin W)", "command line") 14ifeq ("$(origin W)", "command line")
12 export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) 15 KBUILD_EXTRA_WARN := $(W)
13endif 16endif
14 17
18export KBUILD_EXTRA_WARN
19
15# 20#
16# W=1 - warnings which may be relevant and do not occur too often 21# W=1 - warnings which may be relevant and do not occur too often
17# 22#
18ifneq ($(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 23ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
19 24
20KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter 25KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
21KBUILD_CFLAGS += -Wmissing-declarations 26KBUILD_CFLAGS += -Wmissing-declarations
@@ -48,7 +53,7 @@ endif
48# 53#
49# W=2 - warnings which occur quite often but may still be relevant 54# W=2 - warnings which occur quite often but may still be relevant
50# 55#
51ifneq ($(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 56ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
52 57
53KBUILD_CFLAGS += -Wcast-align 58KBUILD_CFLAGS += -Wcast-align
54KBUILD_CFLAGS += -Wdisabled-optimization 59KBUILD_CFLAGS += -Wdisabled-optimization
@@ -65,7 +70,7 @@ endif
65# 70#
66# W=3 - more obscure warnings, can most likely be ignored 71# W=3 - more obscure warnings, can most likely be ignored
67# 72#
68ifneq ($(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 73ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
69 74
70KBUILD_CFLAGS += -Wbad-function-cast 75KBUILD_CFLAGS += -Wbad-function-cast
71KBUILD_CFLAGS += -Wcast-qual 76KBUILD_CFLAGS += -Wcast-qual
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 380a7d11a573..4a0cdd6f5909 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -251,7 +251,7 @@ quiet_cmd_gzip = GZIP $@
251DTC ?= $(objtree)/scripts/dtc/dtc 251DTC ?= $(objtree)/scripts/dtc/dtc
252 252
253# Disable noisy checks by default 253# Disable noisy checks by default
254ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 254ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
255DTC_FLAGS += -Wno-unit_address_vs_reg \ 255DTC_FLAGS += -Wno-unit_address_vs_reg \
256 -Wno-unit_address_format \ 256 -Wno-unit_address_format \
257 -Wno-avoid_unnecessary_addr_size \ 257 -Wno-avoid_unnecessary_addr_size \
@@ -262,7 +262,7 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \
262 -Wno-pci_device_reg 262 -Wno-pci_device_reg
263endif 263endif
264 264
265ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 265ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
266DTC_FLAGS += -Wnode_name_chars_strict \ 266DTC_FLAGS += -Wnode_name_chars_strict \
267 -Wproperty_name_chars_strict 267 -Wproperty_name_chars_strict
268endif 268endif
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index baf44ed0a93a..78629f515e78 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -12,7 +12,7 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o
12# 12#
13# Just in case, run "$(YACC) --version" without suppressing stderr 13# Just in case, run "$(YACC) --version" without suppressing stderr
14# so that 'bison: not found' will be displayed if it is missing. 14# so that 'bison: not found' will be displayed if it is missing.
15ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 15ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
16 16
17quiet_cmd_bison_no_warn = $(quiet_cmd_bison) 17quiet_cmd_bison_no_warn = $(quiet_cmd_bison)
18 cmd_bison_no_warn = $(YACC) --version >/dev/null; \ 18 cmd_bison_no_warn = $(YACC) --version >/dev/null; \