Skip to content

Commit 92ef432

Browse files
committed
kbuild: support W=c and W=e shorthands for Kconfig
KCONFIG_WARN_UNKNOWN_SYMBOLS=1 and KCONFIG_WERROR=1 are descriptive and suitable in scripting, but typing them from the command line can be tedious. Associate them with KBUILD_EXTRA_WARN (and the W= shorthand). Support a new letter 'c' to enable extra checks in Kconfig. You can still manage compiler warnings (W=1) and Kconfig warnings (W=c) independently. Reuse the letter 'e' to turn Kconfig warnings into errors. As usual, you can combine multiple letters in KCONFIG_EXTRA_WARN. $ KCONFIG_WARN_UNKNOWN_SYMBOLS=1 KCONFIG_WERROR=1 make defconfig can be shortened to: $ KBUILD_EXTRA_WARN=ce make defconfig or, even shorter: $ make W=ce defconfig Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]>
1 parent ef6609a commit 92ef432

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ endif
155155

156156
export KBUILD_EXTMOD
157157

158+
# backward compatibility
159+
KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
160+
161+
ifeq ("$(origin W)", "command line")
162+
KBUILD_EXTRA_WARN := $(W)
163+
endif
164+
165+
export KBUILD_EXTRA_WARN
166+
158167
# Kbuild will save output files in the current working directory.
159168
# This does not need to match to the root of the kernel source tree.
160169
#
@@ -1659,6 +1668,7 @@ help:
16591668
@echo ' 1: warnings which may be relevant and do not occur too often'
16601669
@echo ' 2: warnings which occur quite often but may still be relevant'
16611670
@echo ' 3: more obscure warnings, can most likely be ignored'
1671+
@echo ' c: extra checks in the configuration stage (Kconfig)'
16621672
@echo ' e: warnings are being treated as errors'
16631673
@echo ' Multiple levels can be combined with W=12 or W=123'
16641674
@$(if $(dtstree), \

scripts/Makefile.extrawarn

-9
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
8080
# Warn if there is an enum types mismatch
8181
KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
8282

83-
# backward compatibility
84-
KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
85-
86-
ifeq ("$(origin W)", "command line")
87-
KBUILD_EXTRA_WARN := $(W)
88-
endif
89-
90-
export KBUILD_EXTRA_WARN
91-
9283
#
9384
# W=1 - warnings which may be relevant and do not occur too often
9485
#

scripts/kconfig/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ KCONFIG_DEFCONFIG_LIST += \
2727
endif
2828
KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)
2929

30+
ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),)
31+
export KCONFIG_WARN_UNKNOWN_SYMBOLS=1
32+
endif
33+
34+
ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),)
35+
export KCONFIG_WERROR=1
36+
endif
37+
3038
# We need this, in case the user has it in its environment
3139
unexport CONFIG_
3240

0 commit comments

Comments
 (0)