FWIW, I found -Wunneeded-internal-declaration fairly confusing. I
tried to turn it on for chromium, and it fired in a few instances
where the function it warned about was used for something and couldn't
be easily removed.

Nico

On Fri, Oct 26, 2012 at 1:54 PM, Argyrios Kyrtzidis <[email protected]> wrote:
> On Oct 26, 2012, at 1:35 PM, Richard Smith <[email protected]> wrote:
>
>> Argyrios: It looks like you added this warning in r129794. Can you
>> comment on what it's intended to detect?
>
> variables/functions with internal linkage that are not used from the codegen 
> perspective.
> This differs from -Wunused which will consider a 'use' even in an unevaluated 
> context.
> For example:
>
> static void foo() { }
>
> this gives:
> warning: unused function 'foo' [-Wunused-function]
>
> static void foo() { }
> template <typename T>
> void goo() {
>   foo();
> }
>
> this gives:
> warning: function 'foo' is not needed and will not be emitted 
> [-Wunneeded-internal-declaration]
>
> -Argyrios
>
>>
>> On Fri, Oct 26, 2012 at 9:52 AM, Craig Topper <[email protected]> wrote:
>>> No its used right here in the same file. It only warns on C++11 enabled
>>> builds.
>>>
>>>    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>>>      AU.setPreservesAll();
>>>      AU.addRequiredID(PreVerifyID);
>>>
>>>
>>> On Fri, Oct 26, 2012 at 9:41 AM, Matthieu Monrocq
>>> <[email protected]> wrote:
>>>>
>>>>
>>>>
>>>> On Fri, Oct 26, 2012 at 8:51 AM, Richard Smith <[email protected]>
>>>> wrote:
>>>>>
>>>>> On Thu, Oct 25, 2012 at 10:48 PM, Craig Topper <[email protected]>
>>>>> wrote:
>>>>>> I think this change broke bootstrap builds with C++11 and -Werror
>>>>>> enabled.
>>>>>>
>>>>>> lib/VMCore/Verifier.cpp:116:14: error: variable 'PreVerifyID' is not
>>>>>> needed
>>>>>> and will not be emitted [-Werror,-Wunneeded-internal-declaration]
>>>>>> static char &PreVerifyID = PreVerifier::ID;
>>>>>
>>>>> Yes, I think this change probably caused that. I'm unclear on what the
>>>>> purpose of that warning is: it appears to be warning on variables
>>>>> which are referenced but not odr-used, which seems like a pretty
>>>>> questionable thing to warn on. It'd be easy enough to fix this by
>>>>> teaching Sema::ShouldWarnIfUnusedFileScopedDecl to ignore references
>>>>> (along with its existing check for const variables), but I'm not sure
>>>>> that's the right fix, since I'm not really sure what the intent is
>>>>> here.
>>>>
>>>>
>>>>
>>>> Is not PreVerifyID just an unused variable ? (not the difference with
>>>> PreVerifier::ID)
>>>>
>>>> -- Matthieu
>>>
>>>
>>>
>>>
>>> --
>>> ~Craig
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to