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.

Why is that a useful thing to warn on?

> 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]

That code certainly looks bogus, but I don't think that's the right
warning. We should warn either on the definition of 'goo' (because it
has external linkage but uses an internal linkage function) or warn
that 'goo' is unused and can't be used outside this TU.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to