[PATCH 4/5] kbuild: disable -Winitializer-overrides for clang

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Sep 4 00:59:16 PDT 2026


From: Ahmad Fatoum <a.fatoum at barebox.org>

clang warns about the intentional [0 ... N] = default followed by
per-entry overrides, e.g. in arch/arm/cpu/interrupts_64.c:

  arch/arm/cpu/interrupts_64.c:28:26: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]

Disable it for clang, as Linux does.

Assisted-by: Claude:fable-5
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 scripts/Makefile.warn | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn
index 393f7fd522c8..237597d18af4 100644
--- a/scripts/Makefile.warn
+++ b/scripts/Makefile.warn
@@ -47,6 +47,9 @@ KBUILD_CFLAGS += -Wno-pointer-sign
 # 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)
+ifdef CONFIG_CC_IS_CLANG
+KBUILD_CFLAGS += -Wno-initializer-overrides
+endif
 
 #
 # W=e and CONFIG_WERROR - error out on warnings
-- 
2.47.3




More information about the barebox mailing list