[cfe-dev] ccc-analyzer progression/regression

John Smith lbalbalba at gmail.com
Sun Oct 2 14:11:14 PDT 2011

On Sun, Oct 2, 2011 at 8:46 PM, funceval <funceval at gmail.com> wrote:
> Did you modify the gdb makefiles in any way before running "scan-build"? I
> have implemented a checker and I want to test its effectiveness against open
> source code. For that I am trying to run scan-build on gdb. Nothing happens
> as in the analysis never gets run during the gdb make process. I dug through
> the scan-build files to see whats going on and found that unless the
> makefile uses $(CC) and $(CXX) in it, the analyzer is not run. So I wanted
> to find out if you modified anything for this experiment? If yes, can you
> please give me the details?


I dont remember doing anything special for gdb. I just downloaded the
source tarball for gdb-7.2, unzipped/untarred, and ran

scan-build ./configure
scan-build make

dont know if it makes any difference, but after doing a './configure
&& make && make install' on llvm/clang, I did manually copy scan-build
to a directory that's included in my PATH:

cp llvm/tools/clang/tools/scan-build/* /usr/local/bin

For glib, I did have to make a small modification to the generated
make stuff though. For some reason, glib wont compile unless you
specify that you want optimizations (? perhaps depending on
optimizations done by gcc for correct code generation ?). And
scan-build wont work if you specify optimizations. So after doing

scan-build ./configure --disable-sanity-checks

for glib, i had to edit config.h and comment out the following section

/* #if !defined __ASSEMBLER__ && !defined _ISOMAC && !defined __OPTIMIZE__
# error "glibc cannot be compiled without optimization"
#endif */

After which the scan worked without problems. I doubt that this
generates working binaries, though.

Hope this helps.

- John Smith.

More information about the cfe-dev mailing list