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

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

 



On 07/13/2011 07:42 AM, Matthias Bolte wrote:
> 2011/7/9 Eric Blake <eblake@xxxxxxxxxx>:
>> 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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]