Commit e27128db authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Reviewed-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
parent 64a91907
...@@ -105,6 +105,15 @@ The output directory can also be specified using "O=...". ...@@ -105,6 +105,15 @@ The output directory can also be specified using "O=...".
Setting "O=..." takes precedence over KBUILD_OUTPUT. Setting "O=..." takes precedence over KBUILD_OUTPUT.
KBUILD_EXTRA_WARN
-----------------
Specify the extra build checks. The same value can be assigned by passing
W=... from the command line.
See `make help` for the list of the supported values.
Setting "W=..." takes precedence over KBUILD_EXTRA_WARN.
KBUILD_DEBARCH KBUILD_DEBARCH
-------------- --------------
For the deb-pkg target, allows overriding the normal heuristics deployed by 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.:: ...@@ -241,11 +250,6 @@ To get all available archs you can also specify all. E.g.::
$ make ALLSOURCE_ARCHS=all tags $ make ALLSOURCE_ARCHS=all tags
KBUILD_ENABLE_EXTRA_GCC_CHECKS
------------------------------
If enabled over the make command line with "W=1", it turns on additional
gcc -W... options for more extensive build-time checking.
KBUILD_BUILD_TIMESTAMP KBUILD_BUILD_TIMESTAMP
---------------------- ----------------------
Setting this to a date string overrides the timestamp used in the Setting this to a date string overrides the timestamp used in the
......
...@@ -1538,7 +1538,7 @@ help: ...@@ -1538,7 +1538,7 @@ help:
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)' @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)'
@echo ' make C=2 [targets] Force check of all c source with $$CHECK' @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
@echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
@echo ' 1: warnings which may be relevant and do not occur too often' @echo ' 1: warnings which may be relevant and do not occur too often'
@echo ' 2: warnings which occur quite often but may still be relevant' @echo ' 2: warnings which occur quite often but may still be relevant'
@echo ' 3: more obscure warnings, can most likely be ignored' @echo ' 3: more obscure warnings, can most likely be ignored'
......
...@@ -85,7 +85,7 @@ else ifeq ($(KBUILD_CHECKSRC),2) ...@@ -85,7 +85,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $<
endif endif
ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),) ifneq ($(KBUILD_EXTRA_WARN),)
cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
endif endif
......
...@@ -8,14 +8,19 @@ ...@@ -8,14 +8,19 @@
KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
# backward compatibility
KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
ifeq ("$(origin W)", "command line") ifeq ("$(origin W)", "command line")
export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) KBUILD_EXTRA_WARN := $(W)
endif endif
export KBUILD_EXTRA_WARN
# #
# W=1 - warnings which may be relevant and do not occur too often # W=1 - warnings which may be relevant and do not occur too often
# #
ifneq ($(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
KBUILD_CFLAGS += -Wmissing-declarations KBUILD_CFLAGS += -Wmissing-declarations
...@@ -48,7 +53,7 @@ endif ...@@ -48,7 +53,7 @@ endif
# #
# W=2 - warnings which occur quite often but may still be relevant # W=2 - warnings which occur quite often but may still be relevant
# #
ifneq ($(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
KBUILD_CFLAGS += -Wcast-align KBUILD_CFLAGS += -Wcast-align
KBUILD_CFLAGS += -Wdisabled-optimization KBUILD_CFLAGS += -Wdisabled-optimization
...@@ -65,7 +70,7 @@ endif ...@@ -65,7 +70,7 @@ endif
# #
# W=3 - more obscure warnings, can most likely be ignored # W=3 - more obscure warnings, can most likely be ignored
# #
ifneq ($(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
KBUILD_CFLAGS += -Wbad-function-cast KBUILD_CFLAGS += -Wbad-function-cast
KBUILD_CFLAGS += -Wcast-qual KBUILD_CFLAGS += -Wcast-qual
......
...@@ -251,7 +251,7 @@ quiet_cmd_gzip = GZIP $@ ...@@ -251,7 +251,7 @@ quiet_cmd_gzip = GZIP $@
DTC ?= $(objtree)/scripts/dtc/dtc DTC ?= $(objtree)/scripts/dtc/dtc
# Disable noisy checks by default # Disable noisy checks by default
ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
DTC_FLAGS += -Wno-unit_address_vs_reg \ DTC_FLAGS += -Wno-unit_address_vs_reg \
-Wno-unit_address_format \ -Wno-unit_address_format \
-Wno-avoid_unnecessary_addr_size \ -Wno-avoid_unnecessary_addr_size \
...@@ -262,7 +262,7 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \ ...@@ -262,7 +262,7 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \
-Wno-pci_device_reg -Wno-pci_device_reg
endif endif
ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
DTC_FLAGS += -Wnode_name_chars_strict \ DTC_FLAGS += -Wnode_name_chars_strict \
-Wproperty_name_chars_strict -Wproperty_name_chars_strict
endif endif
......
...@@ -12,7 +12,7 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o ...@@ -12,7 +12,7 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o
# #
# Just in case, run "$(YACC) --version" without suppressing stderr # Just in case, run "$(YACC) --version" without suppressing stderr
# so that 'bison: not found' will be displayed if it is missing. # so that 'bison: not found' will be displayed if it is missing.
ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
quiet_cmd_bison_no_warn = $(quiet_cmd_bison) quiet_cmd_bison_no_warn = $(quiet_cmd_bison)
cmd_bison_no_warn = $(YACC) --version >/dev/null; \ cmd_bison_no_warn = $(YACC) --version >/dev/null; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment