[cfe-dev] testing the clang static code analyzer

Jordan Rose jordan_rose at apple.com
Thu Aug 15 11:20:10 PDT 2013


On Aug 15, 2013, at 10:57 , Anna Zaks <ganna at apple.com> wrote:

>> 1.       Unused variable: a
> 
> We are warning about this one if the value is being assigned to:
>                 int a;
>                 a = 2;
> 
> Though, we do not warn when it's not being assigned to to allow code like this:
> int a;
> if (flag) { 
>   a = 1;
>   use (a);
> }
> // We don't want to warn here.
> 

The analyzer also generally doesn't show errors that the compiler knows how to catch:

	warning: unused variable 'a' [-Wunused-variable]

-Wunused and -Wall include -Wunused-variable.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130815/03aeebb7/attachment.html>


More information about the cfe-dev mailing list