scan-build

scan-build make does not detect any bugs

China☆狼群 提交于 2020-04-06 02:27:45
问题 I have a very simple .c file, with some obvious bugs inside it. #include <stdio.h> struct S { int x; }; void f(struct S s){ } void test() { struct S s; f(s); // warn } int test2(int x){ return 5/(x-x); // warn } int main(){ test(); test2(532); printf("Hej\r\r"); } I am trying to use the clang's static code analyzer tool (scan-build) to detect errors. When I run the tool directly on the files, as for example using the following command: scan-build g++ -o 1 1.c I do get the intended output,

scan-build make does not detect any bugs

会有一股神秘感。 提交于 2020-04-06 02:25:51
问题 I have a very simple .c file, with some obvious bugs inside it. #include <stdio.h> struct S { int x; }; void f(struct S s){ } void test() { struct S s; f(s); // warn } int test2(int x){ return 5/(x-x); // warn } int main(){ test(); test2(532); printf("Hej\r\r"); } I am trying to use the clang's static code analyzer tool (scan-build) to detect errors. When I run the tool directly on the files, as for example using the following command: scan-build g++ -o 1 1.c I do get the intended output,

scan-build make does not detect any bugs

谁说胖子不能爱 提交于 2020-04-06 02:25:04
问题 I have a very simple .c file, with some obvious bugs inside it. #include <stdio.h> struct S { int x; }; void f(struct S s){ } void test() { struct S s; f(s); // warn } int test2(int x){ return 5/(x-x); // warn } int main(){ test(); test2(532); printf("Hej\r\r"); } I am trying to use the clang's static code analyzer tool (scan-build) to detect errors. When I run the tool directly on the files, as for example using the following command: scan-build g++ -o 1 1.c I do get the intended output,

How can I make Clang's “scan-build” work with SCons?

独自空忆成欢 提交于 2019-11-30 08:13:13
I've got a project built with SCons and I'm trying to use the Clang Static Analyzer to analyze the code. However, when running scan-build scons SCons seems to ignore the settings introduced by scan-build . How can I make this work? The way scan-build works is it sets up various environment variables that are usually used by build systems (such as make ) to control how the build happens. Some of these are: CC - name of program to use as C compiler CXX - name of program to use as C++ compiler CCC_* - various environment variables that control the behaviour of Clang's static analyzer SCons

How can I make Clang's “scan-build” work with SCons?

旧城冷巷雨未停 提交于 2019-11-29 11:11:03
问题 I've got a project built with SCons and I'm trying to use the Clang Static Analyzer to analyze the code. However, when running scan-build scons SCons seems to ignore the settings introduced by scan-build . How can I make this work? 回答1: The way scan-build works is it sets up various environment variables that are usually used by build systems (such as make ) to control how the build happens. Some of these are: CC - name of program to use as C compiler CXX - name of program to use as C++