mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] common: add CONFIG_WERROR option
@ 2023-06-05  6:37 Ahmad Fatoum
  2023-06-06  9:41 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-06-05  6:37 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For development, it may be useful to enforce warning-free builds.
Add a Kconfig option for this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
This can be enabled for CI, once my other series with warning
fixes is merged.
---
 Makefile       |  4 ++++
 common/Kconfig | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Makefile b/Makefile
index 4fdb8f1b41af..af5c1448b378 100644
--- a/Makefile
+++ b/Makefile
@@ -648,6 +648,8 @@ endif
 # Force gcc to behave correct even for buggy distributions
 KBUILD_CFLAGS          += $(call cc-option, -fno-stack-protector)
 
+KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror
+
 # This warning generated too much noise in a regular build.
 # Use make W=1 to enable this warning (see scripts/Makefile.build)
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
@@ -692,6 +694,8 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 # change __FILE__ to the relative path from the srctree
 KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
 
+KBUILD_CFLAGS += $(KBUILD_CFLAGS-y)
+
 include-y +=scripts/Makefile.ubsan
 include-$(CONFIG_KASAN)         += scripts/Makefile.kasan
 
diff --git a/common/Kconfig b/common/Kconfig
index 11aabbb509df..5cfe717aa70d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1701,6 +1701,20 @@ config COMPILE_TEST
 	  say Y here. If you are a user, say N here to avoid being prompted for
 	  inclusion of unrelated drivers.
 
+config WERROR
+	bool "Compile barebox with warnings as errors"
+	default COMPILE_TEST
+	help
+	  A barebox build should not cause any compiler warnings, and this
+	  enables the '-Werror' flags to enforce that rule by default.
+
+	  However, if you have a new (or very old) compiler with odd and
+	  unusual warnings, or you have some architecture with problems,
+	  you may need to disable this config option in order to
+	  successfully build barebox.
+
+	  If in doubt, say Y.
+
 endmenu
 
 source "common/efi/Kconfig"
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-06  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05  6:37 [PATCH] common: add CONFIG_WERROR option Ahmad Fatoum
2023-06-06  9:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox