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: Mark Williamson <mark.williamson@xxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH 01/04] Kexec / Kdump: Generic code
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 21:54:44 +0100
Cc: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Kazuo Moriwaka <moriwaka@xxxxxxxxxxxxx>, Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>, magnus.damm@xxxxxxxxx, Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, Magnus Damm <magnus@xxxxxxxxxxxxx>, Horms <horms@xxxxxxxxxxxx>
Delivery-date: Tue, 17 Oct 2006 14:06:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <200610171605.41647.mark.williamson@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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcbyLnkNt59BtV4hEduKLgANk04WTA==
Thread-topic: [Xen-devel] Re: [PATCH 01/04] Kexec / Kdump: Generic code
User-agent: Microsoft-Entourage/11.2.5.060620
On 17/10/06 4:05 pm, "Mark Williamson" <mark.williamson@xxxxxxxxxxxx> wrote:

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

This would be fine if the problem were known to be restricted to xchg(), but
it's not. For example, on my build box ignoring the return value of
strncmp() can in some cases trigger the same warning. This is because of
some optimisation trickery which includes casting the return value of a
memcpy() to char *. Because callers are usually unaware of such trickery,
ignoring the return value of any function that produces a return value
becomes hazardous.

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

Which attribute would this be? There's one to force a warning, but I don't
believe there's one to force the opposite. Anyway, this problem is caused by
a cast of the return value, so it's not actually a property of the C
function itself.

 -- Keir



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