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

Re: [libvirt] [PATCHv2 28/27] build: avoid ATTRIBUTE_UNUSED in headers

On 07/13/2011 07:42 AM, Matthias Bolte wrote:
> 2011/7/9 Eric Blake <eblake redhat com>:
>> The compiler might optimize based on our declaration that something
>> is unused.
> Can this actually happen? The unused marker only says that something
> _might_ be unused. I don't think that a compiler can optimize
> something based on this when it cannot actually prove that it is
> really unused.

Hmm, given gcc's documentation that it is a 'might' be unused, then
yeah, gcc shouldn't do premature optimizations on the caller side.  But
better safe than sorry.

>> Putting that declaration in the header risks getting
>> out of sync with the actual implementation, so it belongs better
>> only in the .c files.  We were mostly compliant, and a new syntax
>> check will help us in the future.
> This is a valid point.

Consistency is a good argument, even if the argument for (lack of)
compiler optimizations is weak in this case :)

> ACK.

I've now applied 25, 26, and 28.  Expect a v3 later today which fixes
the fallout comments on the remaining patches.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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