Re: annoying new gcc 4.6.0 warnings.

Dave Jones
2011-04-21T21:28:35Z

On Thu, Apr 21, 2011 at 10:56:12PM +0200, Sam Ravnborg wrote:
>
> Seems soo. It semi works now.
> "make W=1" is broken for reasons that is not related to this patch - will submit
> a fix in a minute for that.
>
> So you can add:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
> Tested-by: Sam Ravnborg <sam@ravnborg.org>
>
> on the patch.
>
> And if you really want to make me happy then you add a comment about _why_
> we disable the warning.

ok, last time for reals.

Dave

--

Disable the new -Wunused-but-set-variable that was added in gcc 4.6.0
It produces more false positives than useful warnings.

This can still be enabled using W=1

Signed-off-by: Dave Jones <davej@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Sam Ravnborg <sam@ravnborg.org>

diff --git a/Makefile b/Makefile
index b967b96..08c5484 100644
--- a/Makefile
+++ b/Makefile
@@ -559,6 +559,10 @@ ifndef CONFIG_CC_STACKPROTECTOR
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
endif

+# This warning generated too much noise in a regular build.
+# Use make W=1 to enable this warning (see scripts/Makefile.build)
+KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
+
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index d5f925a..021f7eb 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -79,6 +79,7 @@ KBUILD_EXTRA_WARNINGS += -Wpointer-arith
KBUILD_EXTRA_WARNINGS += -Wredundant-decls
KBUILD_EXTRA_WARNINGS += -Wshadow
KBUILD_EXTRA_WARNINGS += -Wswitch-default
+KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wunused-but-set-variable)
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
endif