From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] common: add CONFIG_WERROR option
Date: Mon, 5 Jun 2023 08:37:55 +0200 [thread overview]
Message-ID: <20230605063755.1438127-1-a.fatoum@pengutronix.de> (raw)
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
next reply other threads:[~2023-06-05 6:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 6:37 Ahmad Fatoum [this message]
2023-06-06 9:41 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230605063755.1438127-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox