From: "Michael S. Tsirkin" <mst@redhat.com>
To: Laurent Desnogues <laurent.desnogues@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] move -Wno-error=uninitialized to configure
Date: Tue, 30 Jun 2009 14:39:49 +0300 [thread overview]
Message-ID: <20090630113949.GA32364@redhat.com> (raw)
Move -Wno-error=uninitialized out of rules.mak and into configure. Only
use it if supported by compiler.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
configure | 15 ++++++++++++++-
rules.mak | 2 +-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index eb9d73a..69c7471 100755
--- a/configure
+++ b/configure
@@ -526,8 +526,21 @@ if test -z "$werror" ; then
fi
fi
+# Disable uninitialized variable warning or convert it to non-error, if possible
+cat > $TMPC <<EOF
+int main(void) {}
+EOF
+if $cc -Werror -Wno-error=uninitialized -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
+ # Enable werror by default for recent compilers
+ werror_cflags="-Werror -Wno-error=uninitialized"
+elif $cc -Werror -Wno-uninitialized -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
+ werror_cflags="-Werror -Wno-uninitialized"
+else
+ werror_cflags="-Werror"
+fi
+
if test "$werror" = "yes" ; then
- CFLAGS="$CFLAGS -Werror"
+ CFLAGS="$CFLAGS $werror_cflags"
fi
if test "$solaris" = "no" ; then
diff --git a/rules.mak b/rules.mak
index defee1d..8d6d96e 100644
--- a/rules.mak
+++ b/rules.mak
@@ -1,6 +1,6 @@
%.o: %.c
- $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -Werror -Wno-error=uninitialized -c -o $@ $<," CC $(TARGET_DIR)$@")
+ $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
%.o: %.S
$(call quiet-command,$(CC) $(CPPFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@")
--
1.6.2.2
next reply other threads:[~2009-06-30 11:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 11:39 Michael S. Tsirkin [this message]
2009-06-30 12:07 ` [Qemu-devel] [PATCH] move -Wno-error=uninitialized to configure Paul Brook
2009-06-30 12:12 ` Michael S. Tsirkin
2009-06-30 12:16 ` Michael S. Tsirkin
2009-06-30 12:44 ` Paul Brook
2009-06-30 12:58 ` Michael S. Tsirkin
2009-06-30 15:22 ` Stuart Brady
2009-06-30 12:30 ` Avi Kivity
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=20090630113949.GA32364@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=laurent.desnogues@gmail.com \
--cc=qemu-devel@nongnu.org \
/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).