[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110502111337.GA15769@sepie.suse.cz>
Date: Mon, 2 May 2011 13:13:37 +0200
From: Michal Marek <mmarek@...e.cz>
To: Stephen Rothwell <sfr@...b.auug.org.au>
Cc: Dave Jones <davej@...hat.com>, linux-next@...r.kernel.org,
linux-kernel@...r.kernel.org, Sam Ravnborg <sam@...nborg.org>
Subject: Re: linux-next: build warning after merge of the kbuild tree
On Mon, May 02, 2011 at 02:53:38PM +1000, Stephen Rothwell wrote:
> Hi Dave,
>
> hmmm,
>
> On my build machine:
> $ /opt/cross/gcc-4.4.5-nolibc/x86_64-linux/bin/x86_64-linux-gcc -Wno-unused-but-set-variable -c -xc /dev/null -o /tmp/xx.o; echo $?
> 0
> $ /opt/cross/gcc-4.4.5-nolibc/x86_64-linux/bin/x86_64-linux-gcc -Wunused-but-set-variable -c -xc /dev/null -o /tmp/xx.o; echo $?
> cc1: error: unrecognized command line option "-Wunused-but-set-variable"
> 1
> $ gcc -Wno-unused-but-set-variable -c -xc /dev/null -o /tmp/xx.o; echo $?
> 0
> $ gcc -Wunused-but-set-variable -c -xc /dev/null -o /tmp/xx.o; echo $?
> cc1: error: unrecognized command line option "-Wunused-but-set-variable"
> 1
I reproduced this myself with 4.5.1 and 4.6.0 and was about to file a
bug at gcc.gnu.org, but I learned that this is a feature :-(, see here:
http://gcc.gnu.org/PR28322 . It treats invalid -Wno-* options as
warnings and it only issues them when there is another warning or error
in the source.
I have a patch below, but after learning the above, I'm going to rewrite
it to some more generic cc-disable-warning fuction, because it can hit
us anytime again.
Michal
Subject: [PATCH] kbuild: Fix passing -Wno-unused-but-set-variable to some gcc versions
Some versions of gcc will happily accept -Wno-<anything> in the
cc-option test and complain later when compiling some random file that
-Wno-unused-but-set-variable is not recognized. Work around this by
testing if gcc supports the -Wunused-but-set-variable option insteaed.
Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
Signed-off-by: Michal Marek <mmarek@...e.cz>
diff --git a/Makefile b/Makefile
index 4527dc2..db6b6df 100644
--- a/Makefile
+++ b/Makefile
@@ -569,7 +569,12 @@ 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)
+# We test for support of the -Wunused-but-set-variable option, because
+# some version of gcc will happily accept any -Wno-* switch and complain
+# later during build.
+ifeq ($(call cc-option-yn, -Wunused-but-set-variable), y)
+KBUILD_CFLAGS += -Wno-unused-but-set-variable
+endif
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists