History

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

Masahiro Yamada committed 2 years ago

Commit 92ef4321 parent ef6609a3 files · +18 −9Browse files

Unified · Split

3 files
  1. Makefile +10 −0
  2. scripts/Makefile.extrawarn +0 −9
  3. scripts/kconfig/Makefile +8 −0
Makefile+10−0
@@ -155,6 +155,15 @@ endif · 154 unmodified lines
155 155
156export KBUILD_EXTMOD156export KBUILD_EXTMOD
157 157
158# backward compatibility
159KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
160
161ifeq ("$(origin W)", "command line")
162 KBUILD_EXTRA_WARN := $(W)
163endif
164
165export KBUILD_EXTRA_WARN
166
158# Kbuild will save output files in the current working directory.167# Kbuild will save output files in the current working directory.
159# This does not need to match to the root of the kernel source tree.168# This does not need to match to the root of the kernel source tree.
160#169#
@@ -1659,6 +1668,7 @@ help: · 1498 unmodified lines
1659 @echo ' 1: warnings which may be relevant and do not occur too often'1668 @echo ' 1: warnings which may be relevant and do not occur too often'
1660 @echo ' 2: warnings which occur quite often but may still be relevant'1669 @echo ' 2: warnings which occur quite often but may still be relevant'
1661 @echo ' 3: more obscure warnings, can most likely be ignored'1670 @echo ' 3: more obscure warnings, can most likely be ignored'
1671 @echo ' c: extra checks in the configuration stage (Kconfig)'
1662 @echo ' e: warnings are being treated as errors'1672 @echo ' e: warnings are being treated as errors'
1663 @echo ' Multiple levels can be combined with W=12 or W=123'1673 @echo ' Multiple levels can be combined with W=12 or W=123'
1664 @$(if $(dtstree), \1674 @$(if $(dtstree), \
scripts/Makefile.extrawarn+0−9
@@ -80,15 +80,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) · 79 unmodified lines
80# Warn if there is an enum types mismatch80# Warn if there is an enum types mismatch
81KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)81KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
82 82
83# backward compatibility
84KBUILD_EXTRA_WARN ?= $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)
85
86ifeq ("$(origin W)", "command line")
87 KBUILD_EXTRA_WARN := $(W)
88endif
89
90export KBUILD_EXTRA_WARN
91
92#83#
93# W=1 - warnings which may be relevant and do not occur too often84# W=1 - warnings which may be relevant and do not occur too often
94#85#
scripts/kconfig/Makefile+8−0
@@ -27,6 +27,14 @@ KCONFIG_DEFCONFIG_LIST += \ · 26 unmodified lines
27endif27endif
28KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)28KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)
29 29
30ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),)
31export KCONFIG_WARN_UNKNOWN_SYMBOLS=1
32endif
33
34ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),)
35export KCONFIG_WERROR=1
36endif
37
30# We need this, in case the user has it in its environment38# We need this, in case the user has it in its environment
31unexport CONFIG_39unexport CONFIG_
32 40

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t