mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
kbuild: support W=e to make build abort in case of warning
When developing new code/feature, CONFIG_WERROR is most often turned off, especially for people using make W=12 to get more warnings. In such case, turning on -Werror temporarily would require switching on CONFIG_WERROR in the configuration, building, then switching off CONFIG_WERROR. For this use case, this patch introduces a new 'e' modifier to W= as a short hand for KCFLAGS+=-Werror" so that -Werror got added to the kernel (built-in) and modules' CFLAGS. Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
feb7d79fea
commit
c77d06e70d
2 changed files with 12 additions and 2 deletions
1
Makefile
1
Makefile
|
@ -1650,6 +1650,7 @@ help:
|
||||||
@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'
|
||||||
|
@echo ' e: warnings are being treated as errors'
|
||||||
@echo ' Multiple levels can be combined with W=12 or W=123'
|
@echo ' Multiple levels can be combined with W=12 or W=123'
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
|
@echo 'Execute "make" or "make all" to build all targets marked with [*] '
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
# make W=... settings
|
# make W=... settings
|
||||||
#
|
#
|
||||||
# There are three warning groups enabled by W=1, W=2, W=3.
|
# There are four warning groups enabled by W=1, W=2, W=3, and W=e
|
||||||
# They are independent, and can be combined like W=12 or W=123.
|
# They are independent, and can be combined like W=12 or W=123e.
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
|
|
||||||
KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
|
KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
|
||||||
|
@ -94,3 +94,12 @@ KBUILD_CFLAGS += $(call cc-option, -Wpacked-bitfield-compat)
|
||||||
KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3
|
KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN3
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
# W=e - error out on warnings
|
||||||
|
#
|
||||||
|
ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),)
|
||||||
|
|
||||||
|
KBUILD_CFLAGS += -Werror
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue