Skip to content

Commit e27128d

Browse files
committed
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 <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Reviewed-by: Sedat Dilek <[email protected]>
1 parent 64a9190 commit e27128d

File tree

6 files changed

+23
-14
lines changed

6 files changed

+23
-14
lines changed

Documentation/kbuild/kbuild.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ The output directory can also be specified using "O=...".
105105

106106
Setting "O=..." takes precedence over KBUILD_OUTPUT.
107107

108+
KBUILD_EXTRA_WARN
109+
-----------------
110+
Specify the extra build checks. The same value can be assigned by passing
111+
W=... from the command line.
112+
113+
See `make help` for the list of the supported values.
114+
115+
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
116+
108117
KBUILD_DEBARCH
109118
--------------
110119
For 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.::
241250

242251
$ make ALLSOURCE_ARCHS=all tags
243252

244-
KBUILD_ENABLE_EXTRA_GCC_CHECKS
245-
------------------------------
246-
If enabled over the make command line with "W=1", it turns on additional
247-
gcc -W... options for more extensive build-time checking.
248-
249253
KBUILD_BUILD_TIMESTAMP
250254
----------------------
251255
Setting this to a date string overrides the timestamp used in the

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ help:
15381538
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)'
15391539
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
15401540
@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'
15421542
@echo ' 1: warnings which may be relevant and do not occur too often'
15431543
@echo ' 2: warnings which occur quite often but may still be relevant'
15441544
@echo ' 3: more obscure warnings, can most likely be ignored'

scripts/Makefile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
8585
cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
8686
endif
8787

88-
ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
88+
ifneq ($(KBUILD_EXTRA_WARN),)
8989
cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
9090
endif
9191

scripts/Makefile.extrawarn

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88

99
KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
1010

11+
# backward compatibility
12+
KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
13+
1114
ifeq ("$(origin W)", "command line")
12-
export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
15+
KBUILD_EXTRA_WARN := $(W)
1316
endif
1417

18+
export KBUILD_EXTRA_WARN
19+
1520
#
1621
# W=1 - warnings which may be relevant and do not occur too often
1722
#
18-
ifneq ($(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
23+
ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
1924

2025
KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
2126
KBUILD_CFLAGS += -Wmissing-declarations
@@ -48,7 +53,7 @@ endif
4853
#
4954
# W=2 - warnings which occur quite often but may still be relevant
5055
#
51-
ifneq ($(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
56+
ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
5257

5358
KBUILD_CFLAGS += -Wcast-align
5459
KBUILD_CFLAGS += -Wdisabled-optimization
@@ -65,7 +70,7 @@ endif
6570
#
6671
# W=3 - more obscure warnings, can most likely be ignored
6772
#
68-
ifneq ($(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
73+
ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
6974

7075
KBUILD_CFLAGS += -Wbad-function-cast
7176
KBUILD_CFLAGS += -Wcast-qual

scripts/Makefile.lib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ quiet_cmd_gzip = GZIP $@
251251
DTC ?= $(objtree)/scripts/dtc/dtc
252252

253253
# Disable noisy checks by default
254-
ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
254+
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
255255
DTC_FLAGS += -Wno-unit_address_vs_reg \
256256
-Wno-unit_address_format \
257257
-Wno-avoid_unnecessary_addr_size \
@@ -262,7 +262,7 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \
262262
-Wno-pci_device_reg
263263
endif
264264

265-
ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
265+
ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
266266
DTC_FLAGS += -Wnode_name_chars_strict \
267267
-Wproperty_name_chars_strict
268268
endif

scripts/genksyms/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o
1212
#
1313
# Just in case, run "$(YACC) --version" without suppressing stderr
1414
# so that 'bison: not found' will be displayed if it is missing.
15-
ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
15+
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
1616

1717
quiet_cmd_bison_no_warn = $(quiet_cmd_bison)
1818
cmd_bison_no_warn = $(YACC) --version >/dev/null; \

0 commit comments

Comments
 (0)