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: 174029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EE18A2C008F for ; Tue, 31 Jul 2012 01:13:35 +1000 (EST) Received: from localhost ([::1]:53237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svrf3-0001aB-Uu for incoming@patchwork.ozlabs.org; Mon, 30 Jul 2012 11:13:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svreu-0001ZL-Dm for qemu-devel@nongnu.org; Mon, 30 Jul 2012 11:13:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Svrep-0002x7-Bh for qemu-devel@nongnu.org; Mon, 30 Jul 2012 11:13:24 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:58715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Svrep-0002vO-3m for qemu-devel@nongnu.org; Mon, 30 Jul 2012 11:13:19 -0400 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 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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Blue Swirl , Kevin Wolf , patches@linaro.org Subject: [Qemu-devel] [PATCH] configure: Split valgrind test into pragma test and valgrind.h test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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_) {