[cfe-commits] r158317 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td test/FixIt/fixit.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Jun 11 13:24:58 PDT 2012
On 11.06.2012, at 22:18, Nico Weber wrote:
> Hi Benjamin,
>
> in WebKit this fires on a few instances where the unused data members
> are used just for their size. For example:
>
> // See the function above if you need to update this.
> class SameSizeAsStylePropertySet : public
> RefCounted<SameSizeAsStylePropertySet> {
> unsigned bitfield;
> void* properties;
> };
> COMPILE_ASSERT(sizeof(StylePropertySet) ==
> sizeof(SameSizeAsStylePropertySet),
> style_property_set_should_stay_small);
>
>
> What's the recommended way to update code like that so that it doesn't
> trigger this warning? #pragma clang?
The easiest way to silence the warning is to just make the fields public instead of private.
- Ben
>
> Nico
>
> On Mon, Jun 11, 2012 at 9:06 AM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Mon Jun 11 11:06:57 2012
>> New Revision: 158317
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=158317&view=rev
>> Log:
>> Enable -Wunused-private-field with -Wunused.
>>
>> It found a lot of cruft in LLVM that I removed last week and I couldn't find any
>> false positives. Time to give it more testing.
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> cfe/trunk/test/FixIt/fixit.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=158317&r1=158316&r2=158317&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Jun 11 11:06:57 2012
>> @@ -312,7 +312,7 @@
>> [UnusedArgument, UnusedFunction, UnusedLabel,
>> // UnusedParameter, (matches GCC's behavior)
>> // UnusedMemberFunction, (clean-up llvm before enabling)
>> - // UnusedPrivateField, (clean-up llvm before enabling)
>> + UnusedPrivateField,
>> UnusedValue, UnusedVariable]>,
>> DiagCategory<"Unused Entity Issue">;
>>
>>
>> Modified: cfe/trunk/test/FixIt/fixit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=158317&r1=158316&r2=158317&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/FixIt/fixit.cpp (original)
>> +++ cfe/trunk/test/FixIt/fixit.cpp Mon Jun 11 11:06:57 2012
>> @@ -54,7 +54,7 @@
>> }
>>
>> namespace rdar7796492 {
>> - class A { int x, y; A(); };
>> + struct A { int x, y; A(); };
>>
>> A::A()
>> : x(1) y(2) { // expected-error{{missing ',' between base or member initializers}}
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list