Questions tagged [scan-build]
28 questions
21
votes
1 answer
How can I make Clang's "scan-build" work with SCons?
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?

Greg Hewgill
- 951,095
- 183
- 1,149
- 1,285
14
votes
2 answers
Using Clang's scan-build with scons and C++11
I've added everything to my $PATH and I've tweaked my SConstruct to set the appropriate environment variables, as per these answers [ 1, 2, 3 ]. Now when I run
scan-build --use-c++=`which clang++` scons
the build begins, and I can see the process…

chrisaycock
- 36,470
- 14
- 88
- 125
13
votes
1 answer
scan-build make does not detect any bugs
I have a very simple .c file, with some obvious bugs inside it.
#include
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();
…

platisd
- 153
- 1
- 9
9
votes
1 answer
how to exclude third party lib / dll from getting analyzed in CLANG scan-build xcodebuild?
I have used some open-source code and third party libs in my project and want to exclude that code from getting analyzed while analyzing my project using scan-build file.
I know we can #ifndef clang_analyzer use this macro to suppress the code from…

Mahesh Mahindrakar
- 173
- 8
5
votes
1 answer
Does clang-tidy make scan-build redundant?
I have a project that currently uses both scan-build and clang-tidy (enabled via CMake).
If I enable clang-analyzer-* in my set of clang-tidy checks, is the usage of scan-build redundant?
For reference, there is a similar question asked here about…

tbre
- 51
- 2
4
votes
2 answers
clang scan-build Redhat installation
I've installed clang-3.4.2-7.el7.x86_64.rpm on RHEL 7 and it came with llvm, but i couldn't find the scan-build utility.
I have already installed gcc and cmake and all other tools that are mentioned here But unfortunately i can't execute the…

Alex Brodov
- 3,365
- 18
- 43
- 66
4
votes
1 answer
how to make scan-build(clang) work together with prebuilt android gcc?
Im trying to carry out static source code analysis for my android native project written in C/C++ using scan-build.
I tried the instructoins on this page(http://clang.llvm.org/get_started.html#build) for building and running scan-build. All these…

jin
- 1,542
- 1
- 9
- 10
3
votes
1 answer
Can scan-build or Clang static analyzer discover problems at link time?
While revisiting some codes I've written, I noticed that the build commands in the test scripts did not correctly invoke the scan-build command. The formation of a revision is ready, but I have some question with regard to the capability of…

DannyNiu
- 1,313
- 8
- 27
3
votes
1 answer
Clang's 'scan-build' utilite does not work with 'make'
I'm trying to statically analyze my code via Clang's static code analyzer tool scan-build and when I run the code with scan-build g++ command, it provides me a bug report, but when I'm trying to do same thing with CMake and the scan-build make…

Yevhenii Mamontov
- 164
- 3
- 15
3
votes
4 answers
clang scan-build only works with arch i386
I am evaluating the use of clang scan-build as one of my build steps in my Jenkins iOS build job. I first tried running the scan-build on command line using the following command
../clang-scan/scan-build -k -v -v -o…

ash1977
- 187
- 1
- 4
- 12
2
votes
0 answers
scan-build always reports No Bugs found with make but working with single file on Linux
I am trying to use scan-build to do static analysis for my project.
When I run the scan-build with single .cpp or .c file , it reports the bugs correctly.
But when I use with cmake/make , it always says No Bugs found.
Commands used:
scan-build…

Lucky
- 41
- 3
2
votes
2 answers
Is there any analyzer for Clang scan-build reports, similar to Jenkins xUnit plugin?
I am participating in a project that goes for more than a year. Recently our management has decided to employ routine checking of the code with the Clang static analyzer.
Our project has a CI server, based on Jenkins. Call to scan-build is added to…

wl2776
- 4,099
- 4
- 35
- 77
2
votes
1 answer
running clang scan-build with g++ on linux
I have the following code:
#include
#include
using namespace std;
class A
{
public:
void foo() const;
};
void A::foo() const {}
std::unique_ptr foo2()
{
std::unique_ptr pa(new A());
return…

gudge
- 1,053
- 4
- 18
- 33
2
votes
1 answer
Infinite loop calling cmake, why?
I have the following script for a static analysis build using clang's scan-build tool:
#!/usr/bin/env bash
export CC=clang
export CXX=clang++
export CCC_CC=$CC
export CCC_CXX=$CXX
mkdir -p static-analysis/build
cd static-analysis/build
cmake…

oblitum
- 11,380
- 6
- 54
- 120
2
votes
1 answer
Using clangs scan-build with bjam and Boost.Build
Is it possible to use clangs static analyser scan-build in combination with bjam and Boost.Build? I tried to run
scan-build bjam
which does not work. scan-build reports that the reporting directory does not contain any reports.

headmyshoulder
- 6,240
- 2
- 20
- 27