r190437 - Fix regression from r190382.

Eli Friedman eli.friedman at gmail.com
Tue Sep 10 16:07:50 PDT 2013


On Tue, Sep 10, 2013 at 3:43 PM, Nick Lewycky <nlewycky at google.com> wrote:

> On 10 September 2013 14:10, Eli Friedman <eli.friedman at gmail.com> wrote:
>
>> Author: efriedma
>> Date: Tue Sep 10 16:10:25 2013
>> New Revision: 190437
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=190437&view=rev
>> Log:
>> Fix regression from r190382.
>>
>> Make sure we perform the correct "referenced-but-not-used" check for
>> static member constants.
>>
>> Fixes bug reported on cfe-commits by Alexey Samsonov.
>>
>
> This breaks -Werror clang bootstrap. Eli, could you help triage?
>

Looking.  It looks like just a bunch of unused junk that nobody ever
noticed.


> The main problem looks like this:
>
> lib/Transforms/Scalar/EarlyCSE.cpp:77:21: error: unused variable 'value' [-Werror,-Wunused-variable]
>   static const bool value = true;                    ^lib/Transforms/Scalar/EarlyCSE.cpp:225:23: error: unused variable 'value' [-Werror,-Wunused-variable]
>     static const bool value = true;                      ^
>
> I'm not sure whether this counts as a true positive or not? Is the problem
> that the template is never instantiated?
>

Yes: the variable would be referenced if the relevant DenseMap
specialization were completely instantiated...

I'm still thinking about it, but the best approach might be to just use
LLVM_ATTRIBUTE_UNUSED markings.


>
> This sort of thing occurs here,
> lib/Transforms/InstCombine/InstCombinePHI.cpp:608,
> tools/clang/lib/Sema/SemaType.cpp:256 and
> lib/Rewrite/Frontend/RewriteModernObjC.cpp:61.
>
> The others are various:
>
> lib/CodeGen/RegAllocGreedy.cpp:123:28: error: unused variable 'StageName' [-Werror,-Wunused-variable]
>   static const char *const StageName[];                           ^
>
> StageName is only used in debug builds. I suppose we can fix it with (void)StageName?
>
>
Yes, or put it in an "#ifndef NDEBUG".

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130910/2e20fafb/attachment.html>


More information about the cfe-commits mailing list