WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [PATCH 01/04] Kexec / Kdump: Generic code

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] Re: [PATCH 01/04] Kexec / Kdump: Generic code
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 16:05:41 +0100
Cc: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Kazuo Moriwaka <moriwaka@xxxxxxxxxxxxx>, Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>, magnus.damm@xxxxxxxxx, Magnus Damm <magnus@xxxxxxxxxxxxx>, Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, Horms <horms@xxxxxxxxxxxx>
Delivery-date: Tue, 17 Oct 2006 08:06:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C15AABF8.2A87%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C15AABF8.2A87%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.8.2
> > The comment attached to every use of xchg() is dubious. We don't specify
> > warn_unused_result on that function so there's no good reason for the
> > compiler to complain about discarding the result. If it's a reproducible
> > problem it needs investigating. We shouldn't work around a broken
> > compiler.
>
> Ok, this seems to be a new 'feature' of gcc4, which has widened the class
> of things it will complain about with -Wunused-value. Basically any cast of
> a value causes the compiler to see an expression whose value must not be
> discarded -- what a pain! This seems to me that it could mean that ignoring
> return value of any function becomes potentially dangerous, as the function
> may be a macro that includes a cast on the return value.
>
> I think the fix is -Wno-unused-value. :-) It's about the least useful of
> the -Wunused-<foo> warnings anyway.
>
> I'll check this in, so please just get rid of the if(xchg()) hacky
> workaround.

If you wanted to leave the warning on, you should be able to cast to (void) 
instead of using the if

(void)xchg(&kexec_crash_lock, 0))

in order to explicitly indicate the value is unused.  Alternatively I imagine 
there's a gcc attribute somewhere to tell it not to worry about unused 
returns from xchg (like for printf)

Cheers,
Mark

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel