From patchwork Mon Jul 30 15:13:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10372 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3861823E57 for ; Mon, 30 Jul 2012 15:13:17 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id EFE72A18278 for ; Mon, 30 Jul 2012 15:13:16 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so4819683ggn.11 for ; Mon, 30 Jul 2012 08:13:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=qgqKaAWJhMQOapF/HHymauXAURCXTSmOZL2lux8W8R8=; b=ed3Mdk1Bg5uFCJQhG6knNVVWGZiJ4IMd9ZBktYNzVoc2cz1R02DKkx2KS1fvixEWNs CbDrhBuBjlQxO8Sf2ytTslrG8xItyskRmrNE9x4+B3j1pP5pjjEfAjESzwyYzWxGn3Pq QAKOX2cqQR4eE740+jjiMj4CJaZLDS+S0tSGNHtOCI/1QnY472kPaYKDFP+InuQTWIeb 93PmkZYdKj6ad6Bz+9f9/hEYMWPp7iQXvsXeKNAnUTxDR3bbJabZCnFLv/4Al5L7bpl+ ljMAxIqmcj1S5qmXpg5cZvNxF6VEzbVp65kh3Atu/Jd5I/0DK1gYS3zi0ALFWm75oVbQ mkuA== Received: by 10.50.94.166 with SMTP id dd6mr8500821igb.11.1343661196554; Mon, 30 Jul 2012 08:13:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.87.40 with SMTP id u8csp94396igz; Mon, 30 Jul 2012 08:13:15 -0700 (PDT) Received: by 10.14.203.193 with SMTP id f41mr12601806eeo.14.1343661194506; Mon, 30 Jul 2012 08:13:14 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id u5si5464212eeo.113.2012.07.30.08.13.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 08:13:14 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1Svred-0001eH-6z; Mon, 30 Jul 2012 16:13:07 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Blue Swirl , Kevin Wolf Subject: [PATCH] configure: Split valgrind test into pragma test and valgrind.h test Date: Mon, 30 Jul 2012 16:13:07 +0100 Message-Id: <1343661187-6312-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQmOMkPldTYAMl1IqPilzfkSUnPtzopvpen/aVJWkw/8/4iYxh1H382daGOFHql5PH9DLpq1 Split the configure test that checks for valgrind into two, one part checking whether we have the gcc pragma to disable unused-but-set variables, and the other part checking for the existence of valgrind.h. The first of these has to be compiled with -Werror and the second does not and shouldn't generate any warnings. This (a) allows us to enable "make errors in configure tests be build failures" and (b) enables use of valgrind on systems with a gcc which doesn't know about -Wunused-but-set-varibale, like Debian squeeze. Signed-off-by: Peter Maydell --- This can be applied now and I think it ought to be sufficient that we could then apply the 11-patch configure series I sent earlier. If patch 1 in that series still causes trouble after this, then I'd suggest committing patches 2-10, to save yet more people sending patches to the list for those. configure | 23 +++++++++++++++++++++-- coroutine-ucontext.c | 4 ++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/configure b/configure index c65b5f6..1d713de 100755 --- a/configure +++ b/configure @@ -2873,14 +2873,29 @@ if compile_prog "" "" ; then fi ######################################## +# check whether we can disable the -Wunused-but-set-variable +# option with a pragma (this is needed to silence a warning in +# some versions of the valgrind VALGRIND_STACK_DEREGISTER macro.) +# This test has to be compiled with -Werror as otherwise an +# unknown pragma is only a warning. +pragma_disable_unused_but_set=no +cat > $TMPC << EOF +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +int main(void) { + return 0; +} +EOF +if compile_prog "-Werror" "" ; then + pragma_disable_unused_but_set=yes +fi + +######################################## # check if we have valgrind/valgrind.h valgrind_h=no cat > $TMPC << EOF #include -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" int main(void) { - VALGRIND_STACK_DEREGISTER(0); return 0; } EOF @@ -3397,6 +3412,10 @@ if test "$linux_magic_h" = "yes" ; then echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak fi +if test "$pragma_disable_unused_but_set" = "yes" ; then + echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak +fi + if test "$valgrind_h" = "yes" ; then echo "CONFIG_VALGRIND_H=y" >> $config_host_mak fi diff --git a/coroutine-ucontext.c b/coroutine-ucontext.c index e3c450b..784081a 100644 --- a/coroutine-ucontext.c +++ b/coroutine-ucontext.c @@ -200,14 +200,18 @@ Coroutine *qemu_coroutine_new(void) } #ifdef CONFIG_VALGRIND_H +#ifdef CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET /* Work around an unused variable in the valgrind.h macro... */ #pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif static inline void valgrind_stack_deregister(CoroutineUContext *co) { VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id); } +#ifdef CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET #pragma GCC diagnostic error "-Wunused-but-set-variable" #endif +#endif void qemu_coroutine_delete(Coroutine *co_) {