[PATCH RFC next 09/18] kbuild: support W=c and W=e shorthands for Kconfig

Quentin Schulz foss+uboot at 0leil.net
Mon May 4 15:20:36 CEST 2026


From: Quentin Schulz <quentin.schulz at cherry.de>

[ Upstream commit c77d06e70d59cbc6e3c22bf644bb0b197a5fc182 ]

Original commit log:

  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

[note that U-Boot currently doesn't make use of the KCONFIG_WERROR or
 KCONFIG_WARN_UNKNOWN_SYMBOLS symbols as we're using an ancient version
 of kconfig, so technically W=c won't do anything.]
Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
 Makefile                   | 10 ++++++++++
 scripts/Makefile.extrawarn |  9 ---------
 scripts/kconfig/Makefile   |  8 ++++++++
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index aed54cee4a4..bd33437fdfd 100644
--- a/Makefile
+++ b/Makefile
@@ -105,6 +105,15 @@ endif
 
 export quiet Q KBUILD_VERBOSE
 
+# 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.
 #
@@ -2745,6 +2754,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'
 	@echo  ''
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 6bbba36c596..b1881d83e06 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -8,15 +8,6 @@
 
 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
 
-# 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
 #
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index abc34f60d15..f072772eba8 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -22,6 +22,14 @@ ifeq ($(quiet),silent_)
 silent := -s
 endif
 
+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_
 

-- 
2.54.0



More information about the U-Boot mailing list