[libvirt] [PATCHv2 28/27] build: avoid ATTRIBUTE_UNUSED in headers
Eric Blake
eblake at redhat.com
Thu Jul 14 13:57:31 UTC 2011
On 07/13/2011 07:42 AM, Matthias Bolte wrote:
> 2011/7/9 Eric Blake <eblake at 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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110714/a4b96ff6/attachment-0001.sig>
More information about the libvir-list
mailing list