[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions - FAIL
Keir Fraser writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions - FAIL"): > I've been fiddling with a similar principle but much smaller patch (see > below). But it's failing for me in the same way as yours -- *all* optional > flags disappear from my CFLAGS (e.g., -Wno-unused-but-set-variable, which my > gcc-4.5.1 definitely does support). You have to check the exit status, not the stderr output. It might be right do do that even for ordinary (non -Wno-*) options. But TBH I really prefer my script because it's actually comprehensible. You can even run it by hand from the command line: mariner:xen-unstable-tools.hg> config/test-cc-option.sh gcc -fno-strict-aliasing -fno-strict-aliasing mariner:xen-unstable-tools.hg> config/test-cc-option.sh gcc -fno-rapture mariner:xen-unstable-tools.hg> config/test-cc-option.sh gcc -Wdeclaration-after-statement -Wdeclaration-after-statement mariner:xen-unstable-tools.hg> config/test-cc-option.sh gcc -Wno-declaration-after-statement -Wno-declaration-after-statement mariner:xen-unstable-tools.hg> config/test-cc-option.sh gcc -Wno-rapture mariner:xen-unstable-tools.hg> Below is a final version of my fix, ready to push to unstable. Ian. # HG changeset patch # User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> # Date 1306164314 -3600 # Node ID 512f0b1937b40e3ecc79dea6768646206e0f69f3 # Parent 0f670f5146c858ffdc743176d4e22aef4bfe12da gcc compile fix (reprise): deal with fallout from GCC PR 28322 21492:19eefd764f6f breaks the build on certain GCC 4.3 systems which have a broken version of the fix to upstream GCC PR 28322. Specifically, those gcc's (which include current Debian lenny's) ignore unknown -Wno-foo options if there are no warnings, but treat them as an error otherwise. If you compile with -Wno-error the effect is to defeat straightforward attempts (like ours) to filter out unknown -Wno-foo options and instead to bomb out with a complaint the first time any file is compiled which causes any other, unrelated, warning. In this patch I introduce a more sophisticated way of trying to filter out unknown -Wno-foo options. The machinery is moved into a helper script. For -Wno-foo options, we test whether compiling a file with another warning, with -Wno-error, and with the option to be tested, succeeds or fails. On compilers with no fix for PR 28322, or with the broken fix, this will fail. On compilers with a correct fix for PR 28322 this will succeed but the warning option is then harmless. For normal compiler options, we simply use the same test we did before: does compiling /dev/null with this option produce any stderr output. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> diff -r 0f670f5146c8 -r 512f0b1937b4 Config.mk --- a/Config.mk Sat May 21 07:55:46 2011 +0100 +++ b/Config.mk Mon May 23 16:25:14 2011 +0100 @@ -72,8 +72,7 @@ PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX) # cc-option: Check if compiler supports first option, else fall back to second. # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586) -cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \ - /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) +cc-option = $(shell $(XEN_ROOT)/config/test-cc-option.sh "$(1)" "$(2)" "$(3)") # cc-option-add: Add an option to compilation flags, but only if supported. # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6) diff -r 0f670f5146c8 -r 512f0b1937b4 config/test-cc-option.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/test-cc-option.sh Mon May 23 16:25:14 2011 +0100 @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +cc="$1" +opt="$2" +alt="$3" + +case "$opt" in +-Wno-*) + # Sadly a broken implementation of the fix to GCC PR 28322 + # (actually shipped eg in Debian lenny) makes it hard to spot + # whether the compiler recognises a -Wno-foo option without + # generating a warning for some other reason. + + input="${0%-cc-option.sh}-cc-warning.c" + if $cc $opt -Wreturn-type -Wno-error -S -o /dev/null "$input" \ + >/dev/null 2>&1; then + res="$opt" + else + res="$alt" + fi + ;; +*) + if test -z "`$cc $opt -S -o /dev/null -xc $input 2>&1`"; then + res="$opt" + else + res="$alt" + fi + ;; +esac +printf "%s\n" "$res" diff -r 0f670f5146c8 -r 512f0b1937b4 config/test-cc-warning.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/test-cc-warning.c Mon May 23 16:25:14 2011 +0100 @@ -0,0 +1,2 @@ +extern int bogus(void); +int bogus(void) { } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |