From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 3/5] kbuild: disable -Wunused-but-set-variable after -Wall
Date: Fri, 4 Sep 2026 09:59:15 +0200 [thread overview]
Message-ID: <20260904080025.147376-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260904080025.147376-1-a.fatoum@pengutronix.de>
From: Ahmad Fatoum <a.fatoum@barebox.org>
The top-level Makefile passes -Wno-unused-but-set-variable before
scripts/Makefile.warn adds -Wall. GCC keeps the warning disabled, but
clang processes options in order and re-enables it, failing dozens of
files with CONFIG_WERROR=y:
drivers/video/edid.c:390:6: error: variable 'hfmin' set but not used [-Werror,-Wunused-but-set-variable]
Move the option after -Wall in scripts/Makefile.warn, where Linux'
scripts/Makefile.extrawarn has it.
Assisted-by: Claude:fable-5
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
Makefile | 4 ----
scripts/Makefile.warn | 5 +++++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index be81ac70403d..8762d2ae68b9 100644
--- a/Makefile
+++ b/Makefile
@@ -833,10 +833,6 @@ endif
# Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
KBUILD_CFLAGS-$(CONFIG_ZERO_CALL_USED_REGS) += -fzero-call-used-regs=used-gpr
-# 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)
-
KBUILD_CFLAGS += $(call cc-disable-warning, trampolines)
KBUILD_CFLAGS += $(call cc-option, -fno-delete-null-pointer-checks,)
diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn
index a39c8223352a..393f7fd522c8 100644
--- a/scripts/Makefile.warn
+++ b/scripts/Makefile.warn
@@ -43,6 +43,11 @@ endif
# disable pointer signed / unsigned warnings in gcc 4.0
KBUILD_CFLAGS += -Wno-pointer-sign
+# Some diagnostics enabled by default are noisy. Unlike GCC, Clang re-enables
+# them when -Wall is passed later on the command line, so the -Wno... options
+# must come after -Wall
+KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
+
#
# W=e and CONFIG_WERROR - error out on warnings
#
--
2.47.3
next prev parent reply other threads:[~2026-09-04 8:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 7:59 [PATCH 0/5] clang: more warning and error fixes Ahmad Fatoum
2026-09-04 7:59 ` [PATCH 1/5] kbuild: emit asm-offsets markers as .ascii strings Ahmad Fatoum
2026-09-04 7:59 ` [PATCH 2/5] scripts: imx9image: fix warnings reported by clang Ahmad Fatoum
2026-09-04 7:59 ` Ahmad Fatoum [this message]
2026-09-04 7:59 ` [PATCH 4/5] kbuild: disable -Winitializer-overrides for clang Ahmad Fatoum
2026-09-04 7:59 ` [PATCH 5/5] ARM64: cache: use WEAK() for v8_flush_l3_cache stub Ahmad Fatoum
2026-09-04 9:44 ` [PATCH 0/5] clang: more warning and error fixes 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=20260904080025.147376-4-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=a.fatoum@barebox.org \
--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