Skip to content

Commit e576ffd

Browse files
arndbgregkh
authored andcommitted
kbuild: move -Wunused-const-variable to W=1 warning level
commit c9c6837d39311b0cc14cdbe7c18e815ab44aefb1 upstream. gcc-6 started warning by default about variables that are not used anywhere and that are marked 'const', generating many false positives in an allmodconfig build, e.g.: arch/arm/mach-davinci/board-da830-evm.c:282:20: warning: 'da830_evm_emif25_pins' defined but not used [-Wunused-const-variable=] arch/arm/plat-omap/dmtimer.c:958:34: warning: 'omap_timer_match' defined but not used [-Wunused-const-variable=] drivers/bluetooth/hci_bcm.c:625:39: warning: 'acpi_bcm_default_gpios' defined but not used [-Wunused-const-variable=] drivers/char/hw_random/omap-rng.c:92:18: warning: 'reg_map_omap4' defined but not used [-Wunused-const-variable=] drivers/devfreq/exynos/exynos5_bus.c:381:32: warning: 'exynos5_busfreq_int_pm' defined but not used [-Wunused-const-variable=] drivers/dma/mv_xor.c:1139:34: warning: 'mv_xor_dt_ids' defined but not used [-Wunused-const-variable=] This is similar to the existing -Wunused-but-set-variable warning that was added in an earlier release and that we disable by default now and only enable when W=1 is set, so it makes sense to do the same here. Once we have eliminated the majority of the warnings for both, we can put them back into the default list. We probably want this in backport kernels as well, to allow building them with gcc-6 without introducing extra warnings. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Michal Marek <mmarek@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9acf553 commit e576ffd

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,10 @@ KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
682682
KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
683683
else
684684

685-
# This warning generated too much noise in a regular build.
686-
# Use make W=1 to enable this warning (see scripts/Makefile.build)
685+
# These warnings generated too much noise in a regular build.
686+
# Use make W=1 to enable them (see scripts/Makefile.build)
687687
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
688+
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
688689
endif
689690

690691
ifdef CONFIG_FRAME_POINTER

scripts/Makefile.extrawarn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ warning-1 += $(call cc-option, -Wmissing-prototypes)
2424
warning-1 += -Wold-style-definition
2525
warning-1 += $(call cc-option, -Wmissing-include-dirs)
2626
warning-1 += $(call cc-option, -Wunused-but-set-variable)
27+
warning-1 += $(call cc-option, -Wunused-const-variable)
2728
warning-1 += $(call cc-disable-warning, missing-field-initializers)
2829

2930
warning-2 := -Waggregate-return

0 commit comments

Comments
 (0)