[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.