]> git.itanic.dy.fi Git - linux-stable/commitdiff
kbuild: support W=c and W=e shorthands for Kconfig
authorMasahiro Yamada <masahiroy@kernel.org>
Thu, 23 Nov 2023 09:05:40 +0000 (18:05 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 3 Dec 2023 09:50:48 +0000 (18:50 +0900)
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 <masahiroy@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Makefile
scripts/Makefile.extrawarn
scripts/kconfig/Makefile

index 0df737217529444dec35c8ad22594488dd6c2be1..5a11804af640addc8ce3eb04ca1e3368c88ab78d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -155,6 +155,15 @@ endif
 
 export KBUILD_EXTMOD
 
+# backward compatibility
+KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
+
+ifeq ("$(origin W)", "command line")
+  KBUILD_EXTRA_WARN := $(W)
+endif
+
+export KBUILD_EXTRA_WARN
+
 # Kbuild will save output files in the current working directory.
 # This does not need to match to the root of the kernel source tree.
 #
@@ -1659,6 +1668,7 @@ help:
        @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  '                3: more obscure warnings, can most likely be ignored'
+       @echo  '                c: extra checks in the configuration stage (Kconfig)'
        @echo  '                e: warnings are being treated as errors'
        @echo  '                Multiple levels can be combined with W=12 or W=123'
        @$(if $(dtstree), \
index 2fe6f2828d3769a88da2a8ffcae91a64442fc9fb..3f94915fab372341b2644981c65dbd8b54116b97 100644 (file)
@@ -80,15 +80,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
 # Warn if there is an enum types mismatch
 KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
 
-# backward compatibility
-KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
-
-ifeq ("$(origin W)", "command line")
-  KBUILD_EXTRA_WARN := $(W)
-endif
-
-export KBUILD_EXTRA_WARN
-
 #
 # W=1 - warnings which may be relevant and do not occur too often
 #
index 4eee155121a8b37c201e70c8327c3ea556d5cd94..322c061b464d2cebbdcf4ab27f0c251d5b0db702 100644 (file)
@@ -27,6 +27,14 @@ KCONFIG_DEFCONFIG_LIST += \
 endif
 KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)
 
+ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),)
+export KCONFIG_WARN_UNKNOWN_SYMBOLS=1
+endif
+
+ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),)
+export KCONFIG_WERROR=1
+endif
+
 # We need this, in case the user has it in its environment
 unexport CONFIG_