xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xen.org>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Olaf Hering <olaf@aepfle.de>
Subject: Re: [xen-4.0-testing test] 7147: regressions - FAIL
Date: Mon, 23 May 2011 16:37:56 +0100	[thread overview]
Message-ID: <CA003DE4.2D8EA%keir@xen.org> (raw)
In-Reply-To: <CA003AA1.2D8CD%keir@xen.org>

On 23/05/2011 16:24, "Keir Fraser" <keir@xen.org> wrote:

> On 23/05/2011 16:08, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:
> 
>> 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... :-(

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

diff -r 0f670f5146c8 Config.mk
--- a/Config.mk    Sat May 21 07:55:46 2011 +0100
+++ b/Config.mk    Mon May 23 16:32:43 2011 +0100
@@ -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)


> 
> diff -r 0f670f5146c8 Config.mk
> --- a/Config.mk Sat May 21 07:55:46 2011 +0100
> +++ b/Config.mk Mon May 23 16:16:54 2011 +0100
> @@ -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)
> 
> 
>> Ian.
>> 
>> diff -r 0f670f5146c8 Config.mk
>> --- a/Config.mk Sat May 21 07:55:46 2011 +0100
>> +++ b/Config.mk Mon May 23 16:07:59 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 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:07:59 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 $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
>> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
>> +++ b/config/test-cc-warning.c Mon May 23 16:07:59 2011 +0100
>> @@ -0,0 +1,2 @@
>> +extern int bogus(void);
>> +int bogus(void) { }
> 
> 

  parent reply	other threads:[~2011-05-23 15:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21 21:34 [xen-4.0-testing test] 7147: regressions - FAIL xen.org
2011-05-21 22:19 ` Keir Fraser
2011-05-23 11:10   ` Olaf Hering
2011-05-23 12:32   ` Ian Campbell
2011-05-23 14:06     ` Ian Jackson
2011-05-23 15:08       ` Ian Jackson
2011-05-23 15:14         ` Ian Campbell
2011-05-23 15:18           ` Ian Jackson
2011-05-23 15:24         ` Keir Fraser
2011-05-23 15:33           ` Ian Jackson
2011-05-23 15:37           ` Keir Fraser [this message]
2011-05-23 15:40             ` Ian Jackson
2011-05-23 15:49               ` Keir Fraser
2011-05-23 16:16                 ` Keir Fraser
2011-05-23 12:59   ` Olaf Hering
  -- strict thread matches above, loose matches on Subject: below --
2011-05-22 16:29 M A Young
2011-05-22 18:10 ` [xen-4.0-testing " Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA003DE4.2D8EA%keir@xen.org \
    --to=keir@xen.org \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=olaf@aepfle.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).