qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] move -Wno-error=uninitialized to configure


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH] move -Wno-error=uninitialized to configure
Date: Tue, 30 Jun 2009 14:39:49 +0300
User-agent: Mutt/1.5.19 (2009-01-05)

Move -Wno-error=uninitialized out of rules.mak and into configure. Only
use it if supported by compiler.

Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]