[cfe-dev] [clang static analyzer] How can I analyze one single C file now?

Eli Friedman eli.friedman at gmail.com
Fri Sep 23 18:17:48 PDT 2011


On Fri, Sep 23, 2011 at 6:08 PM, Liu <proljc at gmail.com> wrote:
> On Sat, Sep 24, 2011 at 2:17 AM, Anna Zaks <ganna at apple.com> wrote:
>> Hi Liu,
>>
>> Most likely, the analyzer does not find any issues in your input file. You can double verify that by checking if anything is reported in the plist file (you can examine it with a text editor). The default behavior is to create a plist file as well as print out the diagnostics on the screen.
>
> Thanks for reply.
>
> This is my file
>
> #include <stdio.h>
>
> int main(void)
> {
>  int a = 1;
>  int b = 3;
>       ^--------------unused vars.

Compiler warning; not something the static analyzer bothers with.

>  printf("haha");
>                     ^----------------NO'\n' here.

I don't see an issue... except maybe that the output of the program
doesn't end in a newline.  In any case, not something the static
analyzer picks up.

> -----------------------NO return here.
> }

There's an implicit "return 0" at the end of main().

-Eli




More information about the cfe-dev mailing list