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

Hi all

I run "clang --analyze a.c" just get a a.plist, no output in screen.
How can I analyze one single C file? "clang --analyze FILE" used to be
OK, but not for now:(

--Liu

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.

Cheers,
Anna.

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.

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

This is a.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<array>
</array>
<key>diagnostics</key>
<array>
</array>
</dict>
</plist>

Is it alright? I thought I should get something.

Thanks again.

--Liu

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

Aha, I'll try later.
Thank you Eli.