From patchwork Wed Jul 18 14:10:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10120 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 64C0423E56 for ; Wed, 18 Jul 2012 14:10:41 +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 35167A180E3 for ; Wed, 18 Jul 2012 14:10:41 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1720098ggn.11 for ; Wed, 18 Jul 2012 07:10:40 -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:in-reply-to:references :x-gm-message-state; bh=gB5JEbtQEV271SxzVtYyW3mQhlCDjzmlj0W0lODbZaM=; b=SuylCKjqQeub8ZVbZ2uOXyiSNFboShikUF9k8QSHJL5gD7f3/9DtwZvpC9Y0tgtKKE FnGaZyx+hl+1erTZEV3Erg2rCYbObBCCanQxuCtLLeTD5vxV2SPk5VHzlo7NGFkfETRU d3qUgJyjjjaaC6KFb4ariYCK4wSScgidr2GtCzhFqGKk3RhCJVStU57EVoy2F8LrjRq4 2z3vKkr0WBgcrPgVBgRJawNEE5gS82WE8nDPQNPxsumMUdge36n41rFqebBMUc90svnp FlGPs52+p26HAW9lVBW+dzCsUIh+ht/RcHB4t6W0aTniRr3qx01tXhvuIo1zIki7FoV+ 03ZQ== Received: by 10.43.63.140 with SMTP id xe12mr331097icb.57.1342620640395; Wed, 18 Jul 2012 07:10:40 -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.231.153.7 with SMTP id i7csp252ibw; Wed, 18 Jul 2012 07:10:37 -0700 (PDT) Received: by 10.180.100.35 with SMTP id ev3mr7120897wib.10.1342620636070; Wed, 18 Jul 2012 07:10:36 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id r6si38422682wiw.0.2012.07.18.07.10.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 Jul 2012 07:10:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SrUxQ-0003KS-OU; Wed, 18 Jul 2012 15:10:28 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Stefan Weil Subject: [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests Date: Wed, 18 Jul 2012 15:10:28 +0100 Message-Id: <1342620628-12751-12-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1342620628-12751-1-git-send-email-peter.maydell@linaro.org> References: <1342620628-12751-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkvG+fP7XkzhWQVSRyadqXmM+PzjbaZCLdtBwE7W6C0NcJbmt+SUALAf6Czuock4DrKfwZb Add support for checking whether test case code can compile without warnings, by recompiling each successful test with -Werror. If the -Werror version doesn't pass, we bail out. This gives us the same level of visibility of warnings in test code as --enable-werror provides for the main compile. Signed-off-by: Peter Maydell --- configure | 32 ++++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 8140464..1939bdb 100755 --- a/configure +++ b/configure @@ -27,16 +27,40 @@ printf " '%s'" "$0" "$@" >> config.log echo >> config.log echo "#" >> config.log +do_cc() { + # Run the compiler, capturing its output to the log. + echo $cc "$@" >> config.log + $cc "$@" >> config.log 2>&1 || return $? + # Test passed. If this is an --enable-werror build, rerun + # the test with -Werror and bail out if it fails. This + # makes warning-generating-errors in configure test code + # obvious to developers. + if test "$werror" != "yes"; then + return 0 + fi + # Don't bother rerunning the compile if we were already using -Werror + case "$*" in + *-Werror*) + return 0 + ;; + esac + echo $cc -Werror "$@" >> config.log + $cc -Werror "$@" >> config.log 2>&1 && return $? + echo "ERROR: configure test passed without -Werror but failed with -Werror." + echo "This is probably a bug in the configure script. The failing command" + echo "will be at the bottom of config.log." + echo "You can run configure with --disable-werror to bypass this check." + exit 1 +} + compile_object() { - echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log - $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1 + do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC } compile_prog() { local_cflags="$1" local_ldflags="$2" - echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log - $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 + do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags } # symbolically link $1 to $2. Portable version of "ln -sf".