[PATCH 34/34] kbuild: always enable -Wunused-const-variable

Arnd Bergmann posted 34 patches 1 year, 10 months ago
[PATCH 34/34] kbuild: always enable -Wunused-const-variable
Posted by Arnd Bergmann 1 year, 10 months ago
From: Arnd Bergmann <arnd@arndb.de>

The last such warnings are fixed now, so the option can be enabled by default.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 24d29e477644..a534aba0b97a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -96,7 +96,6 @@ else
 # Some diagnostics enabled by default are noisy.
 # Suppress them by using -Wno... except for W=1.
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
-KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
 ifdef CONFIG_CC_IS_GCC
-- 
2.39.2
Re: [PATCH 34/34] kbuild: always enable -Wunused-const-variable
Posted by Andy Shevchenko 1 year, 10 months ago
On Wed, Apr 03, 2024 at 10:06:52AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The last such warnings are fixed now, so the option can be enabled by default.

> @@ -96,7 +96,6 @@ else
>  # Some diagnostics enabled by default are noisy.
>  # Suppress them by using -Wno... except for W=1.
>  KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
> -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
>  KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
>  KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)

What about line #43 in this file?

Citing 40-43 below:

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

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 34/34] kbuild: always enable -Wunused-const-variable
Posted by Arnd Bergmann 1 year, 10 months ago
On Wed, Apr 3, 2024, at 11:19, Andy Shevchenko wrote:
> On Wed, Apr 03, 2024 at 10:06:52AM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> The last such warnings are fixed now, so the option can be enabled by default.
>
>> @@ -96,7 +96,6 @@ else
>>  # Some diagnostics enabled by default are noisy.
>>  # Suppress them by using -Wno... except for W=1.
>>  KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
>> -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
>>  KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
>>  KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
>
> What about line #43 in this file?
>
> Citing 40-43 below:
>
> # These warnings generated too much noise in a regular build.
> # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
> KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
> KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)

I sent a patch to simplify this earlier, the -Wunused-const-variable
series is based on that, but I kept it separate since I think the
33 patches will take a couple of revisions while the first series
should make it into v6.10:

https://lore.kernel.org/lkml/20240326145140.3257163-3-arnd@kernel.org/

      Arnd