summaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.extrawarn
diff options
context:
space:
mode:
authorYann Droneaud <ydroneaud@opteya.com>2022-04-08 10:46:07 +0200
committerMasahiro Yamada <masahiroy@kernel.org>2022-05-08 03:16:59 +0900
commitc77d06e70d59cbc6e3c22bf644bb0b197a5fc182 (patch)
treed6d32c03811d2f6375ff112491e0c6a1f2812534 /scripts/Makefile.extrawarn
parentfeb7d79fea1d43ddf51a09359b52e73bba0340fd (diff)
downloadlinux-c77d06e70d59cbc6e3c22bf644bb0b197a5fc182.tar.gz
linux-c77d06e70d59cbc6e3c22bf644bb0b197a5fc182.tar.bz2
linux-c77d06e70d59cbc6e3c22bf644bb0b197a5fc182.zip
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>
Diffstat (limited to 'scripts/Makefile.extrawarn')
-rw-r--r--scripts/Makefile.extrawarn13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 650d0b8ceec3..f5f0d6f09053 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -2,8 +2,8 @@
# ==========================================================================
# make W=... settings
#
-# There are three warning groups enabled by W=1, W=2, W=3.
-# They are independent, and can be combined like W=12 or W=123.
+# 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=123e.
# ==========================================================================
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
endif
+
+#
+# W=e - error out on warnings
+#
+ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),)
+
+KBUILD_CFLAGS += -Werror
+
+endif