Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+23 -14
+9 -5
Documentation/kbuild/kbuild.rst
··· 105 105 106 106 Setting "O=..." takes precedence over KBUILD_OUTPUT. 107 107 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 + 108 117 KBUILD_DEBARCH 109 118 -------------- 110 119 For the deb-pkg target, allows overriding the normal heuristics deployed by ··· 249 240 To get all available archs you can also specify all. E.g.:: 250 241 251 242 $ make ALLSOURCE_ARCHS=all tags 252 - 253 - KBUILD_ENABLE_EXTRA_GCC_CHECKS 254 - ------------------------------ 255 - If enabled over the make command line with "W=1", it turns on additional 256 - gcc -W... options for more extensive build-time checking. 257 243 258 244 KBUILD_BUILD_TIMESTAMP 259 245 ----------------------
+1 -1
Makefile
··· 1538 1538 @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)' 1539 1539 @echo ' make C=2 [targets] Force check of all c source with $$CHECK' 1540 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 1542 @echo ' 1: warnings which may be relevant and do not occur too often' 1543 1543 @echo ' 2: warnings which occur quite often but may still be relevant' 1544 1544 @echo ' 3: more obscure warnings, can most likely be ignored'
+1 -1
scripts/Makefile.build
··· 85 85 cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< 86 86 endif 87 87 88 - ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),) 88 + ifneq ($(KBUILD_EXTRA_WARN),) 89 89 cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< 90 90 endif 91 91
+9 -4
scripts/Makefile.extrawarn
··· 8 8 9 9 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) 10 10 11 + # backward compatibility 12 + KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS) 13 + 11 14 ifeq ("$(origin W)", "command line") 12 - export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) 15 + KBUILD_EXTRA_WARN := $(W) 13 16 endif 17 + 18 + export KBUILD_EXTRA_WARN 14 19 15 20 # 16 21 # W=1 - warnings which may be relevant and do not occur too often 17 22 # 18 - ifneq ($(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 23 + ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) 19 24 20 25 KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter 21 26 KBUILD_CFLAGS += -Wmissing-declarations ··· 53 48 # 54 49 # W=2 - warnings which occur quite often but may still be relevant 55 50 # 56 - ifneq ($(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 51 + ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) 57 52 58 53 KBUILD_CFLAGS += -Wcast-align 59 54 KBUILD_CFLAGS += -Wdisabled-optimization ··· 70 65 # 71 66 # W=3 - more obscure warnings, can most likely be ignored 72 67 # 73 - ifneq ($(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 68 + ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) 74 69 75 70 KBUILD_CFLAGS += -Wbad-function-cast 76 71 KBUILD_CFLAGS += -Wcast-qual
+2 -2
scripts/Makefile.lib
··· 251 251 DTC ?= $(objtree)/scripts/dtc/dtc 252 252 253 253 # Disable noisy checks by default 254 - ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 254 + ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) 255 255 DTC_FLAGS += -Wno-unit_address_vs_reg \ 256 256 -Wno-unit_address_format \ 257 257 -Wno-avoid_unnecessary_addr_size \ ··· 262 262 -Wno-pci_device_reg 263 263 endif 264 264 265 - ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 265 + ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),) 266 266 DTC_FLAGS += -Wnode_name_chars_strict \ 267 267 -Wproperty_name_chars_strict 268 268 endif
+1 -1
scripts/genksyms/Makefile
··· 12 12 # 13 13 # Just in case, run "$(YACC) --version" without suppressing stderr 14 14 # 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)),) 16 16 17 17 quiet_cmd_bison_no_warn = $(quiet_cmd_bison) 18 18 cmd_bison_no_warn = $(YACC) --version >/dev/null; \