[PATCH v3 4/4] x86/boot/compressed: Enable -Wunused
From: Thorsten Blum
Date: Sun Nov 08 2026 - 19:57:20 EST
arch/x86/boot/compressed/Makefile resets KBUILD_CFLAGS for this
directory, but does not re-enable -Wunused. Therefore, unused variables
and static functions in arch/x86/boot/compressed/ currently do not emit
warnings.
Add -Wunused to warn about these, and -Wno-unused-but-set-variable as
well as -Wno-unused-const-variable to match the W=0 kernel defaults.
Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
---
arch/x86/boot/compressed/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 680ad803cba7..3ff75bc2239b 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -29,6 +29,9 @@ KBUILD_CFLAGS += $(CC_FLAGS_DIALECT)
KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
KBUILD_CFLAGS += -fno-jump-tables
KBUILD_CFLAGS += -Wundef
+KBUILD_CFLAGS += -Wunused
+KBUILD_CFLAGS += -Wno-unused-but-set-variable
+KBUILD_CFLAGS += -Wno-unused-const-variable
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
cflags-$(CONFIG_X86_32) := -march=i386
cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone