[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing fail
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests |
Date: |
Sat, 28 Jul 2012 09:04:24 +0000 |
On Wed, Jul 18, 2012 at 2:10 PM, Peter Maydell <address@hidden> wrote:
> 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 <address@hidden>
> ---
> 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
This should be degraded to a warning, I'm getting configure breakage
in some cases:
config-host.mak is out-of-date, running configure
ERROR: configure test passed without -Werror but failed with -Werror.
This is probably a bug in the configure script. The failing command
will be at the bottom of config.log.
You can run configure with --disable-werror to bypass this check.
gcc -Werror -m32 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall
-Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing
-fstack-protector-all -Wendif-labels -Wmissing-include-dirs
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
-Winit-self -Wignored-qualifiers -Wold-style-declaration
-Wold-style-definition -Wtype-limits -I/usr/include/libpng12 -o
/tmp/qemu-conf--24538-.exe /tmp/qemu-conf--24538-.c -m32 -g
cc1: warnings being treated as errors
/tmp/qemu-conf--24538-.c:2: error: unknown option after '#pragma GCC
diagnostic' kind
> +}
> +
> 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".
> --
> 1.7.5.4
>
>
- [Qemu-devel] [PATCH 00/11] configure: Fix -Werror issues, Peter Maydell, 2012/07/18
- [Qemu-devel] [PATCH 01/11] configure: Don't run configure tests with -Werror enabled, Peter Maydell, 2012/07/18
- [Qemu-devel] [PATCH 09/11] configure: Fix compile warning in utimensat/futimens test, Peter Maydell, 2012/07/18
- [Qemu-devel] [PATCH 10/11] configure: -I\$(SRC_PATH) goes in QEMU_INCLUDES not QEMU_CFLAGS, Peter Maydell, 2012/07/18
- [Qemu-devel] [PATCH 02/11] configure: Fix build with ALSA audio driver, Peter Maydell, 2012/07/18
- [Qemu-devel] [PATCH 03/11] configure: Fix build with capabilities, Peter Maydell, 2012/07/18
- [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Peter Maydell, 2012/07/18
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests,
Blue Swirl <=
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Peter Maydell, 2012/07/28
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Blue Swirl, 2012/07/28
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Peter Maydell, 2012/07/28
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Blue Swirl, 2012/07/28
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Blue Swirl, 2012/07/28
- Re: [Qemu-devel] [PATCH 11/11] configure: Check for -Werror causing failures when compiling tests, Peter Maydell, 2012/07/28
[Qemu-devel] [PATCH 05/11] configure: -march=i486 belongs in QEMU_CFLAGS, not CFLAGS, Peter Maydell, 2012/07/18
[Qemu-devel] [PATCH 04/11] configure: Replace bash code by standard shell code, Peter Maydell, 2012/07/18
[Qemu-devel] [PATCH 07/11] configure: Fix compile warning in PNG test, Peter Maydell, 2012/07/18