From 9805321dfdeb5225fe5c5e0721abf49c0875637e Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Fri, 28 Feb 2025 10:04:33 +0000 Subject: Kconfig: Introduce CONFIG_WERROR Add a new config option under "General setup" to enable the -Werror flag when building U-Boot. This is useful during development to help catch mistakes. This is based on a similar config option added to the Linux kernel by Linus in 2021 - see Linux commit 3fe617ccafd6 ("Enable '-Werror' by default for all kernel builds"). The modification of KBUILD_CFLAGS is done in Makefile.extrawarn, matching where it was moved in the kernel by Linux commit e88ca24319e4 ("kbuild: consolidate warning flags in scripts/Makefile.extrawarn"). Signed-off-by: Paul Barker --- scripts/Makefile.extrawarn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 7d39b27d24a..f687515fc79 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -13,6 +13,9 @@ KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y) + ifeq ("$(origin W)", "command line") export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) endif -- cgit v1.2.3