[cfe-commits] [patch][pr11550] Extend the unused variable warning

Chandler Carruth chandlerc at google.com
Sat Dec 24 19:26:00 PST 2011


On Sat, Dec 24, 2011 at 6:13 PM, Rafael Ávila de Espíndola <
rafael.espindola at gmail.com> wrote:

> The attached patch extends clang's warning for unused variables to cover
> cases where the variable type has a constructor, but it is not used. For
> example:
>
> struct S {
>  S();
> };
> S foo();
> void bar() {
>  S x = foo(); // expected-warning {{unused variable 'x'}}
> }
>
> I have tested the patch in clang itself and I am now testing it on
> firefox. Is the patch OK if there are no false positives in the firefox
> build?
>

What about all of the objects whose constructor and destructor *are* the
desired uses? It's not hard for me to imagine ones with a constructor alone
that is the only desired side-effect....


>
> Cheers,
> Rafael
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111224/fbf2287a/attachment.html>


More information about the cfe-commits mailing list