I wanted to try the clang static analyzer. I am on Windows and am creating clang with Visual Studio. It seems to work, but at the same time it seems extremely useless.
I made an example file
example.c
int main(void) { int h = 0; return 1/h; }
Calling scan-build gcc -c example.c
does not detect an error.
example.c
int main(void) { int h; return 1/h; }
Calling scan-build gcc -c example.c
does not detect an error.
example.c
int main(void) { return 1/0; }
Calling scan-build gcc -c example.c
does not detect an error.
If these very basic errors cannot be found (and they can be found by the clan itself), how can a static analyzer be used?
My gcc
is MinGW, if that matters. I also tried replacing clang
, but nothing happens.
Am I doing something wrong here?
source share