From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLbhP-0000Hj-16 for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:40:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLbhI-0000G6-G2 for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:40:29 -0400 Received: from [199.232.76.173] (port=50539 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLbhH-0000Ft-MG for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:40:23 -0400 Received: from mx2.redhat.com ([66.187.237.31]:40612) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLbhH-0001WN-6z for qemu-devel@nongnu.org; Tue, 30 Jun 2009 07:40:23 -0400 Date: Tue, 30 Jun 2009 14:39:49 +0300 From: "Michael S. Tsirkin" Message-ID: <20090630113949.GA32364@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] move -Wno-error=uninitialized to configure List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: Anthony Liguori , qemu-devel@nongnu.org Move -Wno-error=uninitialized out of rules.mak and into configure. Only use it if supported by compiler. Signed-off-by: Michael S. Tsirkin --- 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 < /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