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

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

> 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 

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.


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



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