[cfe-commits] r158411 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaDeclCXX.cpp test/SemaCXX/warn-unused-member.cpp

Jordan Rose jordan_rose at apple.com
Thu Jun 14 10:11:49 PDT 2012


On Jun 13, 2012, at 12:21 PM, Jonathan Sauer wrote:

> Hello,
> 
>>> Allow __attribute__((unused)) for fields and make it silence
>>> -Wunused-private-field.
>> 
>> So that these annotations don't get out of date, should we warn when a
>> field is marked unused but is, in fact, used? (so that when it becomes
>> used the attribute is cleaned up and doesn't lead to the function
>> being accidentally unused again in the future)
> 
> There already is a warning for this, -Wused-but-marked-unused, which is emitted
> when a function marked unused is being used. I think it should be the same with
> fields.

I agree. Similarly, __attribute__((used)) ought to silence the warning whether we find an actual use or not.

(Sorry I didn't think of this in my pre-commit review.)

Jordan



More information about the cfe-commits mailing list