If I run scan-build on one file manually I get a report directory created as expected:<br><br><div># cat t.C</div><div>int * foo(){ int x ; return &x ;}</div><div><br></div><div># scan-build -o $HOME/scan-build --use-analyzer=`which clang` clang++ t.C -c</div>
<div>scan-build: Using '/home/peeterj/clang/optimized/bin/clang' for static analysis</div><div>t.C:1:30: warning: address of stack memory associated with local variable 'x' returned [-Wreturn-stack-address]</div>
<div>int * foo(){ int x ; return &x ;}</div><div>                             ^</div><div>1 warning generated.</div><div>t.C:1:22: warning: Address of stack memory associated with local variable 'x' returned to caller</div>
<div>int * foo(){ int x ; return &x ;}</div><div>             ~~~~~   ^      ~~</div><div>1 warning generated.</div><div>scan-build: 1 bugs found.</div><div>scan-build: Run 'scan-view /home/peeterj/scan-build/2012-12-12-3' to examine bug reports.</div>
<div><br></div><div>However, if I run this using a make rule, I see scan-build invoke make, but get the "contains no reports" message:<br><br><div># rm *.o</div><div><div># cat makefile</div><div>t.o : t.C</div>
<div>        clang++ t.C -c</div></div><div># scan-build -o $HOME/scan-build --use-analyzer=`which clang` make<br></div><div>scan-build: Using '/home/peeterj/clang/optimized/bin/clang' for static analysis</div><div>
clang++ t.C -c</div><div>t.C:1:30: warning: address of stack memory associated with local variable 'x' returned [-Wreturn-stack-address]</div><div>int * foo(){ int x ; return &x ;}</div><div>                             ^</div>
<div>1 warning generated.</div><div>scan-build: Removing directory '/home/peeterj/scan-build/2012-12-12-4' because it contains no reports.</div></div><div><br></div><div>From the scan-build man page, it appears that this is how to use this utility, but doing so just results in make being called as is.  In what way is the makefile for the project supposed to be modified to use scan-build?<br>
</div><div><br></div>-- <br>Peeter<br>