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: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH 01/04] Kexec / Kdump: Generic code
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 23:38:19 +0100
Cc: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Kazuo Moriwaka <moriwaka@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, 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 15:39:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C15B01A4.2AE8%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: <C15B01A4.2AE8%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.1
> 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.

Does that happen in the tree at the moment?  In any case, I guess it's not 
something we want to bite us in the bum in future!

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

Oh sorry, I see.  How icky.

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

Ah, I hadn't understood that it was caused by the cast in the definition of 
xchg.  What a pain!

I've not actually been able to repoduce this problem in test cases with gcc 
4.0.0, so I assume it's a more recent addition - what's your compiler 
version?

Do you know if the warn_unused_result attribute will override 
the -Wno-unused-value and generate a warning anyhow?  There's probably only a 
few functions we'd want this warning on - if anyone cared about switching 
these warnings off a fairly small patch could anotate the relevant ones.

Cheers,
Mark

-- 
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

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