[PATCH RFC next 03/18] scripts/Makefile.extrawarn: migrate -Wvla to a U-Boot-specific file

Quentin Schulz foss+uboot at 0leil.net
Mon May 4 15:20:30 CEST 2026


From: Quentin Schulz <quentin.schulz at cherry.de>

In the next commits, we'll be synchronizing scripts/Makefile.extrawarn
with the Linux kernel's at version 6.1 which is what we've been claiming
we've synced to for a while but that isn't true.

In kernel commit 0bb95f80a38f ("Makefile: Globally enable VLA warning"),
available in v4.20, -Wvla is now enabled tree-wide and not present in
scripts/Makefile.extrawarn anymore. When we'll be syncing to v6.1, we'll
therefore be losing this flag (since it's not in our root Makefile). We
could backport the changes to the root Makefile to our root Makefile but
U-Boot is not VLA-free unlike the kernel.

We have two options:
- backport the changes to the root Makefile and disable it in
  scripts/Makefile.extrawarn.u-boot,
- only enable it in scripts/Makefile.extrawarn.u-boot, with the same
  warn level as currently: 3,

For now, do the second option. We should probably go for the first
option in the long term and try to synchronize our flags with the
kernel's. Much bigger undertaking than desired right now.

Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
 Makefile                          | 1 +
 scripts/Makefile.extrawarn        | 1 -
 scripts/Makefile.extrawarn.u-boot | 9 +++++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 49d9740327e..eb61df70838 100644
--- a/Makefile
+++ b/Makefile
@@ -1025,6 +1025,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
 KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
 
 include $(srctree)/scripts/Makefile.extrawarn
+include $(srctree)/scripts/Makefile.extrawarn.u-boot
 
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 KBUILD_CPPFLAGS += $(KCPPFLAGS)
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 4e1714c9484..c5ed501d374 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -65,7 +65,6 @@ warning-3 += -Wpointer-arith
 warning-3 += -Wredundant-decls
 warning-3 += -Wswitch-default
 warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
-warning-3 += $(call cc-option, -Wvla)
 
 warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
 warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
diff --git a/scripts/Makefile.extrawarn.u-boot b/scripts/Makefile.extrawarn.u-boot
new file mode 100644
index 00000000000..21872a5492b
--- /dev/null
+++ b/scripts/Makefile.extrawarn.u-boot
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+# ==========================================================================
+#
+# Collection of warnings that are specific to U-Boot
+#
+# ==========================================================================
+ifneq ($(findstring 3, $(KBUILD_EXTRA_WARN)),)
+KBUILD_CFLAGS += $(call cc-option, -Wvla)
+endif

-- 
2.54.0



More information about the U-Boot mailing list