Skip to contentSkip to conversation

7147: regressions - FAIL

xen-4.0-testing test xen.org 6 participants 15 messages May 21, 2011 – May 23, 2011

lore
Share & tools
lore

xen.org

author
#0 lore raw

flight 7147 xen-4.0-testing real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/7147/

Regressions :-(

Tests which did not succeed and are blocking:

 build-amd64-oldkern           4 xen-build                  fail REGR. vs. 7136
 build-amd64                   4 xen-build                  fail REGR. vs. 7136
 build-i386-oldkern            4 xen-build                  fail REGR. vs. 7136
 build-i386                    4 xen-build                  fail REGR. vs. 7136

Tests which did not succeed, but are not blocking, including regressions (tests previously passed) regarded as allowable:

 test-amd64-amd64-pair         1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-pv           1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-win          1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-xl-win       1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-xl           1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-pair          1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-pv            1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-rhel6hvm-amd  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-rhel6hvm-intel  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-win-vcpus1    1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-win           1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl-credit2    1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl-multivcpu  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl-win-vcpus1  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl            1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-pair  1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-pv    1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-rhel6hvm-amd  1 xen-build-check(1)         blocked n/a
 test-amd64-xcpkern-i386-rhel6hvm-intel  1 xen-build-check(1)       blocked n/a
 test-amd64-xcpkern-i386-win   1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-xl-credit2  1 xen-build-check(1)           blocked n/a
 test-amd64-xcpkern-i386-xl-multivcpu  1 xen-build-check(1)         blocked n/a
 test-amd64-xcpkern-i386-xl-win  1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-xl    1 xen-build-check(1)           blocked  n/a
 test-i386-i386-pair           1 xen-build-check(1)           blocked  n/a
 test-i386-i386-pv             1 xen-build-check(1)           blocked  n/a
 test-i386-i386-win            1 xen-build-check(1)           blocked  n/a
 test-i386-i386-xl-win         1 xen-build-check(1)           blocked  n/a
 test-i386-i386-xl             1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-pair   1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-pv     1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-win    1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-xl     1 xen-build-check(1)           blocked  n/a

version targeted for testing:
xen 9f8f91033546
baseline version:
xen c6034ee9b46e

------------------------------------------------------------
People who touched revisions under test:
Jan Beulich <[email protected]>
Keir Fraser <[email protected]>
Olaf Hering <[email protected]>
------------------------------------------------------------

jobs:

 build-i386-xcpkern                                           pass     
 build-amd64                                                  fail     
 build-i386                                                   fail     
 build-amd64-oldkern                                          fail     
 build-i386-oldkern                                           fail     
 build-amd64-pvops                                            pass     
 build-i386-pvops                                             pass     
 test-amd64-amd64-xl                                          blocked  
 test-amd64-i386-xl                                           blocked  
 test-i386-i386-xl                                            blocked  
 test-amd64-xcpkern-i386-xl                                   blocked  
 test-i386-xcpkern-i386-xl                                    blocked  
 test-amd64-i386-rhel6hvm-amd                                 blocked  
 test-amd64-xcpkern-i386-rhel6hvm-amd                         blocked  
 test-amd64-i386-xl-credit2                                   blocked  
 test-amd64-xcpkern-i386-xl-credit2                           blocked  
 test-amd64-i386-rhel6hvm-intel                               blocked  
 test-amd64-xcpkern-i386-rhel6hvm-intel                       blocked  
 test-amd64-i386-xl-multivcpu                                 blocked  
 test-amd64-xcpkern-i386-xl-multivcpu                         blocked  
 test-amd64-amd64-pair                                        blocked  
 test-amd64-i386-pair                                         blocked  
 test-i386-i386-pair                                          blocked  
 test-amd64-xcpkern-i386-pair                                 blocked  
 test-i386-xcpkern-i386-pair                                  blocked  
 test-amd64-amd64-pv                                          blocked  
 test-amd64-i386-pv                                           blocked  
 test-i386-i386-pv                                            blocked  
 test-amd64-xcpkern-i386-pv                                   blocked  
 test-i386-xcpkern-i386-pv                                    blocked  
 test-amd64-i386-win-vcpus1                                   blocked  
 test-amd64-i386-xl-win-vcpus1                                blocked  
 test-amd64-amd64-win                                         blocked  
 test-amd64-i386-win                                          blocked  
 test-i386-i386-win                                           blocked  
 test-amd64-xcpkern-i386-win                                  blocked  
 test-i386-xcpkern-i386-win                                   blocked  
 test-amd64-amd64-xl-win                                      blocked  
 test-i386-i386-xl-win                                        blocked  
 test-amd64-xcpkern-i386-xl-win                               blocked  

------------------------------------------------------------
sg-report-flight on woking.cam.xci-test.com
logs: /home/xc_osstest/logs
images: /home/xc_osstest/images

Logs, config files, etc. are available at
http://www.chiark.greenend.org.uk/~xensrcts/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary

Not pushing.

------------------------------------------------------------

changeset:   21495:9f8f91033546
tag:         tip
user:        Keir Fraser <[email protected]>
date:        Sat May 21 07:59:15 2011 +0100

Added signature for changeset 82f6fd38f5c2

changeset:   21494:50134c9b77ca
user:        Keir Fraser <[email protected]>
date:        Sat May 21 07:58:38 2011 +0100
    Added tag 4.0.2-rc4 for changeset 82f6fd38f5c2
changeset:   21493:82f6fd38f5c2
tag:         4.0.2-rc4
user:        Keir Fraser <[email protected]>
date:        Sat May 21 07:58:25 2011 +0100

Update Xen version to 4.0.2-rc4

changeset:   21492:19eefd764f6f
user:        Olaf Hering <[email protected]>
date:        Sat May 21 07:57:03 2011 +0100

gcc-4.6 compile fix: build with -Wno-unused-but-set-variable

Avoid "error: variable 'unused' set but not used [-Werror=unused-but-set-variable]" with gcc 4.6.

xen-unstable changeset: 23368:0f670f5146c8
xen-unstable date: Sat May 21 07:55:46 2011 +0100

changeset:   21491:c6034ee9b46e
user:        Keir Fraser <[email protected]>
date:        Fri May 20 13:56:31 2011 +0100

x86: clear CPUID output of leaf 0xd for Dom0 when xsave is disabled

Linux starting with 2.6.36 uses the XSAVEOPT instruction and has certain code paths that look only at the feature bit reported through CPUID leaf 0xd sub-leaf 1 (i.e. without qualifying the check with one evaluating leaf 4 output). Consequently the hypervisor ought to mimic actual hardware in clearing leaf 0xd output when not supporting xsave.

xen-unstable changeset: 23353:a768a10d32b4
xen-unstable date: Fri May 20 08:54:45 2011 +0100

Make this unconditional for 4.0 (no pv xsave support) and fix for domU guests as well (this was already okay in 4.1 and later).

(qemu changes not included)

#1 lore raw

Related to the -Wno-unused-but-set-variable patch. But this is weird because the compiler runs many times with this option quite happily, before failing on it as an unrecognised option much later in the build (building qemu in this case, or stubdom in the case of xen-unstable). Any ideas?

-- Keir

Quoted 190 lines · Ian Jackson

flight 7147 xen-4.0-testing real [real]
http://www.chiark.greenend.org.uk/~xensrcts/logs/7147/

Regressions :-(

Tests which did not succeed and are blocking:
build-amd64-oldkern 4 xen-build fail REGR. vs.
7136
build-amd64 4 xen-build fail REGR. vs.
7136
build-i386-oldkern 4 xen-build fail REGR. vs.
7136
build-i386 4 xen-build fail REGR. vs.
7136

Tests which did not succeed, but are not blocking, including regressions (tests previously passed) regarded as allowable:

 test-amd64-amd64-pair         1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-pv           1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-win          1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-xl-win       1 xen-build-check(1)           blocked  n/a
 test-amd64-amd64-xl           1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-pair          1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-pv            1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-rhel6hvm-amd  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-rhel6hvm-intel  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-win-vcpus1    1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-win           1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl-credit2    1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl-multivcpu  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl-win-vcpus1  1 xen-build-check(1)           blocked  n/a
 test-amd64-i386-xl            1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-pair  1 xen-build-check(1)           blocked  n/a
 test-amd64-xcpkern-i386-pv    1 xen-build-check(1)           blocked  n/a

test-amd64-xcpkern-i386-rhel6hvm-amd 1 xen-build-check(1) blocked
n/a
test-amd64-xcpkern-i386-rhel6hvm-intel 1 xen-build-check(1) blocked
n/a
test-amd64-xcpkern-i386-win 1 xen-build-check(1) blocked n/a
test-amd64-xcpkern-i386-xl-credit2 1 xen-build-check(1) blocked
n/a
test-amd64-xcpkern-i386-xl-multivcpu 1 xen-build-check(1) blocked
n/a
test-amd64-xcpkern-i386-xl-win 1 xen-build-check(1) blocked n/a

 test-amd64-xcpkern-i386-xl    1 xen-build-check(1)           blocked  n/a
 test-i386-i386-pair           1 xen-build-check(1)           blocked  n/a
 test-i386-i386-pv             1 xen-build-check(1)           blocked  n/a
 test-i386-i386-win            1 xen-build-check(1)           blocked  n/a
 test-i386-i386-xl-win         1 xen-build-check(1)           blocked  n/a
 test-i386-i386-xl             1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-pair   1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-pv     1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-win    1 xen-build-check(1)           blocked  n/a
 test-i386-xcpkern-i386-xl     1 xen-build-check(1)           blocked  n/a

version targeted for testing:
xen 9f8f91033546
baseline version:
xen c6034ee9b46e

------------------------------------------------------------
People who touched revisions under test:
Jan Beulich <[email protected]>
Keir Fraser <[email protected]>
Olaf Hering <[email protected]>
------------------------------------------------------------

jobs:

 build-i386-xcpkern                                           pass
 build-amd64                                                  fail
 build-i386                                                   fail
 build-amd64-oldkern                                          fail
 build-i386-oldkern                                           fail
 build-amd64-pvops                                            pass
 build-i386-pvops                                             pass
 test-amd64-amd64-xl                                          blocked
 test-amd64-i386-xl                                           blocked
 test-i386-i386-xl                                            blocked
 test-amd64-xcpkern-i386-xl                                   blocked
 test-i386-xcpkern-i386-xl                                    blocked
 test-amd64-i386-rhel6hvm-amd                                 blocked
 test-amd64-xcpkern-i386-rhel6hvm-amd                         blocked
 test-amd64-i386-xl-credit2                                   blocked
 test-amd64-xcpkern-i386-xl-credit2                           blocked
 test-amd64-i386-rhel6hvm-intel                               blocked
 test-amd64-xcpkern-i386-rhel6hvm-intel                       blocked
 test-amd64-i386-xl-multivcpu                                 blocked
 test-amd64-xcpkern-i386-xl-multivcpu                         blocked
 test-amd64-amd64-pair                                        blocked
 test-amd64-i386-pair                                         blocked
 test-i386-i386-pair                                          blocked
 test-amd64-xcpkern-i386-pair                                 blocked
 test-i386-xcpkern-i386-pair                                  blocked
 test-amd64-amd64-pv                                          blocked
 test-amd64-i386-pv                                           blocked
 test-i386-i386-pv                                            blocked
 test-amd64-xcpkern-i386-pv                                   blocked
 test-i386-xcpkern-i386-pv                                    blocked
 test-amd64-i386-win-vcpus1                                   blocked
 test-amd64-i386-xl-win-vcpus1                                blocked
 test-amd64-amd64-win                                         blocked
 test-amd64-i386-win                                          blocked
 test-i386-i386-win                                           blocked
 test-amd64-xcpkern-i386-win                                  blocked
 test-i386-xcpkern-i386-win                                   blocked
 test-amd64-amd64-xl-win                                      blocked
 test-i386-i386-xl-win                                        blocked
 test-amd64-xcpkern-i386-xl-win                               blocked

------------------------------------------------------------
sg-report-flight on woking.cam.xci-test.com
logs: /home/xc_osstest/logs
images: /home/xc_osstest/images

Logs, config files, etc. are available at
http://www.chiark.greenend.org.uk/~xensrcts/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary

Not pushing.

------------------------------------------------------------

changeset:   21495:9f8f91033546
tag:         tip
user:        Keir Fraser <[email protected]>
date:        Sat May 21 07:59:15 2011 +0100

Added signature for changeset 82f6fd38f5c2

changeset:   21494:50134c9b77ca
user:        Keir Fraser <[email protected]>
date:        Sat May 21 07:58:38 2011 +0100
    Added tag 4.0.2-rc4 for changeset 82f6fd38f5c2
changeset:   21493:82f6fd38f5c2
tag:         4.0.2-rc4
user:        Keir Fraser <[email protected]>
date:        Sat May 21 07:58:25 2011 +0100

Update Xen version to 4.0.2-rc4

changeset:   21492:19eefd764f6f
user:        Olaf Hering <[email protected]>
date:        Sat May 21 07:57:03 2011 +0100

gcc-4.6 compile fix: build with -Wno-unused-but-set-variable

Avoid "error: variable 'unused' set but not used [-Werror=unused-but-set-variable]" with gcc 4.6.

xen-unstable changeset: 23368:0f670f5146c8
xen-unstable date: Sat May 21 07:55:46 2011 +0100

changeset:   21491:c6034ee9b46e
user:        Keir Fraser <[email protected]>
date:        Fri May 20 13:56:31 2011 +0100

x86: clear CPUID output of leaf 0xd for Dom0 when xsave is disabled

Linux starting with 2.6.36 uses the XSAVEOPT instruction and has certain code paths that look only at the feature bit reported through CPUID leaf 0xd sub-leaf 1 (i.e. without qualifying the check with one evaluating leaf 4 output). Consequently the hypervisor ought to mimic actual hardware in clearing leaf 0xd output when not supporting xsave.

xen-unstable changeset: 23353:a768a10d32b4
xen-unstable date: Fri May 20 08:54:45 2011 +0100

Make this unconditional for 4.0 (no pv xsave support) and fix for domU guests as well (this was already okay in 4.1 and later).

(qemu changes not included)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 4 lines · Keir Fraser

Related to the -Wno-unused-but-set-variable patch. But this is weird because the compiler runs many times with this option quite happily, before failing on it as an unrecognised option much later in the build (building qemu in this case, or stubdom in the case of xen-unstable). Any ideas?

I will look at this today.

Olaf

#3 lore raw
In reply to Keir Fraser
Quoted 4 lines · Keir Fraser

Related to the -Wno-unused-but-set-variable patch. But this is weird because the compiler runs many times with this option quite happily, before failing on it as an unrecognised option much later in the build (building qemu in this case, or stubdom in the case of xen-unstable). Any ideas?

Weirdly it seems like the
unrecognized command line option "-Wno-unused-but-set-variable"
only shows up if the compiler has also generated a warning of some sort. Since much of the xen tree is built with -Werror it is generally warning free and so succeeds, but the stbudom and ioemu builds do not use Werror and sodo have some warnings...

I noticed this because I made a change to hvmloader which caused a warning, followed by this error. Having fixed the warning it now succeeds.

It seems like gcc (at least in Debian Squeeze) does some sort of lazy evaluation of -W options, which seems terribly unlikely but does seem to be reality. Try compiling the following always with -Wno-unused-but-set-variable but with and without -DHACK to see what I mean:

$ gcc -Wno-unused-but-set-variable -DHACK ~/t.c
/home/ianc/t.c: In function 'main':
/home/ianc/t.c:6: warning: initialization makes pointer from integer without a cast
At top level:
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
$ gcc -Wno-unused-but-set-variable ~/t.c
$ cat ~/t.c

#include <stdio.h>

int main(void)
{

#ifdef HACK
	void *p = 0x1234;
#else
	void *p = NULL;
#endif
	printf("P is %p\n", p);
}

Funky.

Ian.

#14 lore raw
In reply to Keir Fraser
Quoted 4 lines · Keir Fraser

Related to the -Wno-unused-but-set-variable patch. But this is weird because the compiler runs many times with this option quite happily, before failing on it as an unrecognised option much later in the build (building qemu in this case, or stubdom in the case of xen-unstable). Any ideas?

This is weird, why did the new option get passed to CFLAGS anyway? Its properly filtered out in my SLES11SP1 builds.
What compiler is that?

Olaf

#4 lore raw
In reply to Ian Campbell

Ian Campbell writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions - FAIL"):

Quoted 6 lines

It seems like gcc (at least in Debian Squeeze) does some sort of lazy evaluation of -W options, which seems terribly unlikely but does seem to be reality. Try compiling the following always with -Wno-unused-but-set-variable but with and without -DHACK to see what I mean:

Quoted 7 lines
$ gcc -Wno-unused-but-set-variable -DHACK ~/t.c
/home/ianc/t.c: In function 'main':
/home/ianc/t.c:6: warning: initialization makes pointer from integer without a cast
At top level:
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
$ gcc -Wno-unused-but-set-variable ~/t.c
$ cat ~/t.c

This is related to my efforts to try to make new warnings easier to cope with in future. Note that the "unrecognised -W option" message is itself only a warning in squeeze (which is correct), but apparently in lenny it is an error:

mariner:~/junk> gcc -Wno-unused-but-set-variable -DHACK t.c t.c: In function 'main':
t.c:7: warning: initialization makes pointer from integer without a cast At top level:
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable" mariner:~/junk> gcc -Wno-unused-but-set-variable t.c mariner:~/junk>

That makes it harder, rather than easier, to figure out what's going on and write correct Makefiles.

Ian.

#5 lore raw
Quoted 2 lines · I wrote:

At top level:
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"

How about this fix.

Ian.

Config.mk +1 -2
diff -r 0f670f5146c8 Config.mk
@@ -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)
config/test-cc-option.sh new file +31 -0
diff -r 0f670f5146c8 config/test-cc-option.sh
@@ -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 $nerr -S -o /dev/null -xc $input 2>&1`"; then
+        res="$opt"
+    else
+        res="$alt"
+    fi
+    ;;
+esac
+printf "%s\n" "$res"
config/test-cc-warning.c new file +2 -0
diff -r 0f670f5146c8 config/test-cc-warning.c
@@ -0,0 +1,2 @@
+extern int bogus(void);
+int bogus(void) { }
#6 lore raw
Quoted 39 lines · Ian Jackson
Quoted 2 lines · I wrote:

At top level:
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"

How about this fix.

Ian.

diff -r 0f670f5146c8 Config.mk

Config.mk +1 -2
@@ -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 config/test-cc-option.sh

config/test-cc-option.sh new file +14 -0
@@ -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.
+

config/test-cc-option.sh line 24

Quoted 10 lines
config/test-cc-option.sh new file +10 -0
+   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 $nerr -S -o /dev/null -xc $input 2>&1`"; then

Where does $nerr come from?

Quoted 13 lines
config/test-cc-option.sh new file +7 -0
+        res="$opt"
+    else
+        res="$alt"
+    fi
+    ;;
+esac
+printf "%s\n" "$res"

diff -r 0f670f5146c8 config/test-cc-warning.c

config/test-cc-warning.c new file +2 -0
@@ -0,0 +1,2 @@
+extern int bogus(void);
+int bogus(void) { }
#7 lore raw

Ian Campbell writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions - FAIL"):

Quoted 4 lines · Ian Jackson
Quoted 1 line

+ if test -z "$cc $opt $nerr -S -o /dev/null -xc $input 2>&1"; then

Where does $nerr come from?

Oh, that's a leftover from a previous version. I'll delete it.

Ian.

#8 lore raw
In reply to Ian Jackson
Quoted 5 lines · Ian Jackson
Quoted 2 lines · I wrote:

At top level:
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"

How about this fix.

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).

So I'm still scratching my head on this one... :-(

Config.mk Mon May 23 16:16:54 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +0 -0
diff -r 0f670f5146c8 Config.mk
@@ -72,8 +72,10 @@ 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 if test -z "`$(1) $(2) -S -o /dev/null -xc \
+# /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
+cc-option = $(shell if test -z "`echo 'void*p=1;' | \
+ $(1) $(2) -S -o /dev/null -xc - 2>&1`"; then echo "$(2)";
else echo "$(3)"; fi ;)

# cc-option-add: Add an option to compilation flags, but only if supported. # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)

Quoted 57 lines

Ian.

diff -r 0f670f5146c8 Config.mk

Config.mk Mon May 23 16:07:59 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +0 -0
@@ -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)

Config.mk Mon May 23 16:07:59 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +1 -2
-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 config/test-cc-option.sh

config/test-cc-option.sh Mon May 23 16:07:59 2011 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +31 -0
@@ -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 $nerr -S -o /dev/null -xc $input 2>&1`"; then
+        res="$opt"
+    else
+        res="$alt"
+    fi
+    ;;
+esac
+printf "%s\n" "$res"

diff -r 0f670f5146c8 config/test-cc-warning.c

config/test-cc-warning.c Mon May 23 16:07:59 2011 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +2 -0
@@ -0,0 +1,2 @@
+extern int bogus(void);
+int bogus(void) { }
#9 lore raw

Keir Fraser writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions - FAIL"):

Quoted 4 lines

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 <[email protected]>
# 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.

Config.mk +1 -2
diff -r 0f670f5146c8 -r 512f0b1937b4 Config.mk
@@ -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)
config/test-cc-option.sh new file +31 -0
diff -r 0f670f5146c8 -r 512f0b1937b4 config/test-cc-option.sh
@@ -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"
config/test-cc-warning.c new file +2 -0
diff -r 0f670f5146c8 -r 512f0b1937b4 config/test-cc-warning.c
@@ -0,0 +1,2 @@
+extern int bogus(void);
+int bogus(void) { }
#10 lore raw
In reply to Keir Fraser
Quoted 6 lines · Keir Fraser
Quoted 4 lines · Ian Jackson
Quoted 2 lines · I wrote:

At top level:
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"

Quoted 8 lines
Quoted 1 line

How about this fix.

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).

So I'm still scratching my head on this one... :-(

Here's a nice short one that seems to work for me. It does rely on the compiler emitting the word 'unrecognized' iff the option under test is unrecognised. I strongly suspect this is a safe bet. Unfortunately I can't see any way around grepping the output, since otherwise we can't distinguish the integer-assignment-to-pointer warning from the unrecognised-option warning.

I'll refrain from applying it until we have general agreement.

-- Keir

Config.mk Mon May 23 16:32:43 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +0 -0
diff -r 0f670f5146c8 Config.mk
@@ -72,8 +72,9 @@ 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 if test -z "`echo 'void*p=1;' | \
+ $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep unrecognized`"; \
+ then echo "$(2)"; else echo "$(3)"; fi ;)

# cc-option-add: Add an option to compilation flags, but only if supported. # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)

Quoted 80 lines

diff -r 0f670f5146c8 Config.mk

Config.mk Mon May 23 16:16:54 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +0 -0
@@ -72,8 +72,10 @@ 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)

Config.mk Mon May 23 16:16:54 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +4 -2
-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 if test -z "`$(1) $(2) -S -o /dev/null -xc \
+#              /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
+cc-option = $(shell if test -z "`echo 'void*p=1;' | \
+              $(1) $(2) -S -o /dev/null -xc - 2>&1`"; then echo "$(2)";

else echo "$(3)"; fi ;)

# cc-option-add: Add an option to compilation flags, but only if supported. # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)

Quoted 57 lines

Ian.

diff -r 0f670f5146c8 Config.mk

Config.mk Mon May 23 16:07:59 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +0 -0
@@ -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)

Config.mk Mon May 23 16:07:59 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +1 -2
-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 config/test-cc-option.sh

config/test-cc-option.sh Mon May 23 16:07:59 2011 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +31 -0
@@ -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 $nerr -S -o /dev/null -xc $input 2>&1`"; then
+        res="$opt"
+    else
+        res="$alt"
+    fi
+    ;;
+esac
+printf "%s\n" "$res"

diff -r 0f670f5146c8 config/test-cc-warning.c

config/test-cc-warning.c Mon May 23 16:07:59 2011 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +2 -0
@@ -0,0 +1,2 @@
+extern int bogus(void);
+int bogus(void) { }
#11 lore raw

Keir Fraser writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions - FAIL"):

Quoted 3 lines

Here's a nice short one that seems to work for me. It does rely on the compiler emitting the word 'unrecognized' iff the option under test is unrecognised. I strongly suspect this is a safe bet.

Sadly, some mad people run with LC_MESSAGES set to something other than C which produces native-language error messages even from gcc.

Quoted 4 lines

Unfortunately I can't
see any way around grepping the output, since otherwise we can't distinguish the integer-assignment-to-pointer warning from the unrecognised-option warning.

We don't need to distinguish them. We just need to know whether passing the option works or not. That's what my patch does.

Ian.

#12 lore raw
Quoted 8 lines · Ian Jackson

Keir Fraser writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions
- FAIL"):

Quoted 3 lines

Here's a nice short one that seems to work for me. It does rely on the compiler emitting the word 'unrecognized' iff the option under test is unrecognised. I strongly suspect this is a safe bet.

Sadly, some mad people run with LC_MESSAGES set to something other than C which produces native-language error messages even from gcc.

Well LC_ALL=C is easy to add.

Quoted 7 lines
Quoted 4 lines

Unfortunately I can't
see any way around grepping the output, since otherwise we can't distinguish the integer-assignment-to-pointer warning from the unrecognised-option warning.

We don't need to distinguish them. We just need to know whether passing the option works or not. That's what my patch does.

Ahhh... Is this because of a emitted-as-an-error-not-a-warning bug in Debian gcc, on top of the more general lazily-detected-unrecognised-Wno-option behaviour?

Well, tbh I'd rather get rid of unsupported -Wno- options in general, not just where they are erroneously emitted as errors. Otherwise it will confuse everyone that each time they get a compile warning they also get extra bogus unrecognised option messages. That would be pretty crappy.

-- Keir

Quoted 1 line

Ian.

#13 lore raw
Quoted 4 lines · Keir Fraser
Quoted 2 lines · Ian Jackson

Keir Fraser writes ("Re: [Xen-devel] [xen-4.0-testing test] 7147: regressions
- FAIL"):

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Here's a nice short one that seems to work for me. It does rely on the compiler emitting the word 'unrecognized' iff the option under test is unrecognised. I strongly suspect this is a safe bet.

Sadly, some mad people run with LC_MESSAGES set to something other than C which produces native-language error messages even from gcc.

Well LC_ALL=C is easy to add.

Here is an updated version taking into account comments on- and off-list. To be clear, its main advantages are brevity and that it strips out even options that only cause harmless (but potentially annoying/crufting) conditional compile warnings. Its main *disadvantage* is that it scrapes the compiler's stdout/stderr, albeit for the option-under-test itself which frankly should be a very safe bet.

-- Keir

Config.mk Mon May 23 17:12:55 2011 +0100 renamed from Config.mk Sat May 21 07:55:46 2011 +0100 +0 -0
diff -r 0f670f5146c8 Config.mk
@@ -71,9 +71,19 @@ PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)
 #  https://bugs.launchpad.net/ubuntu/+bug/362570
 
 # cc-option: Check if compiler supports first option, else fall back to

second.
+#
+# This is complicated by the fact that unrecognised -Wno-* options:
+# (a) are ignored unless the compilation emits a warning; and
+# (b) even then produce a warning rather than an error
+# To handle this we do a test compile, passing the option-under-test, on a code
+# fragment that will always produce a warning (integer assigned to pointer).
+# We then grep for the option-under-test in the compiler's output, the presence
+# of which would indicate an "unrecognized command-line option" warning/error.
+#
# 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 if test -z "`echo 'void*p=1;' | \
+ $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2)`"; \
+ then echo "$(2)"; else echo "$(3)"; fi ;)

Quoted 22 lines
Quoted 7 lines
Quoted 4 lines

Unfortunately I can't
see any way around grepping the output, since otherwise we can't distinguish the integer-assignment-to-pointer warning from the unrecognised-option warning.

We don't need to distinguish them. We just need to know whether passing the option works or not. That's what my patch does.

Ahhh... Is this because of a emitted-as-an-error-not-a-warning bug in Debian gcc, on top of the more general lazily-detected-unrecognised-Wno-option behaviour?

Well, tbh I'd rather get rid of unsupported -Wno- options in general, not just where they are erroneously emitted as errors. Otherwise it will confuse everyone that each time they get a compile warning they also get extra bogus unrecognised option messages. That would be pretty crappy.

-- Keir

Quoted 1 line

Ian.