From: Michal Marek <mmarek@suse.cz>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Dave Jones <davej@redhat.com>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
Sam Ravnborg <sam@ravnborg.org>
Subject: Re: linux-next: build warning after merge of the kbuild tree
Date: Mon, 2 May 2011 13:13:37 +0200 [thread overview]
Message-ID: <20110502111337.GA15769@sepie.suse.cz> (raw)
In-Reply-To: <20110502145338.7be2fdbc.sfr@canb.auug.org.au>
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@canb.auug.org.au>
Signed-off-by: Michal Marek <mmarek@suse.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
next prev parent reply other threads:[~2011-05-02 11:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-02 2:18 linux-next: build warning after merge of the kbuild tree Stephen Rothwell
2011-05-02 2:24 ` Dave Jones
2011-05-02 3:45 ` Stephen Rothwell
2011-05-02 4:02 ` Dave Jones
2011-05-02 4:44 ` Stephen Rothwell
2011-05-02 4:24 ` Stephen Rothwell
2011-05-02 4:36 ` Dave Jones
2011-05-02 5:57 ` Stephen Rothwell
2011-05-02 4:53 ` Stephen Rothwell
2011-05-02 11:13 ` Michal Marek [this message]
2011-05-02 12:13 ` [PATCH] kbuild: Fix passing -Wno-* options to gcc 4.4+ Michal Marek
2011-05-03 0:44 ` Stephen Rothwell
2011-05-03 8:52 ` Michal Marek
2011-05-02 15:17 ` linux-next: build warning after merge of the kbuild tree Valdis.Kletnieks
2011-05-02 15:31 ` Michal Marek
-- strict thread matches above, loose matches on Subject: below --
2023-10-03 23:13 Stephen Rothwell
2023-08-28 4:57 Stephen Rothwell
2023-08-28 17:28 ` Nick Desaulniers
2021-08-19 23:28 Stephen Rothwell
2021-08-23 0:25 ` Masahiro Yamada
2020-12-20 22:10 Stephen Rothwell
2020-12-09 9:30 Stephen Rothwell
2020-12-09 13:01 ` Dominique Martinet
2020-12-09 20:56 ` Stephen Rothwell
2020-12-10 6:47 ` Dominique Martinet
2020-12-14 20:44 ` Stephen Rothwell
2017-12-10 22:52 Stephen Rothwell
2017-12-11 0:22 ` Masahiro Yamada
2017-12-11 16:11 ` Bart Van Assche
2016-11-30 23:06 Stephen Rothwell
2016-12-01 2:00 ` Nicholas Piggin
2010-12-23 0:00 Stephen Rothwell
2010-09-30 0:52 Stephen Rothwell
2010-09-30 20:24 ` Michal Marek
2010-09-30 0:50 Stephen Rothwell
2010-09-30 20:25 ` Michal Marek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110502111337.GA15769@sepie.suse.cz \
--to=mmarek@suse.cz \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).