[static checker] unexpected strip -std=gnu99


Sounds like sometimes after 2013-aug-23 (probably before 28 aug)
scan-build (or maybe clang) starts strip '-std=gnu99' from command

I configure/make project using gcc for build and static checker for analyze.

make with gcc has '-std=gnu99' in command line, but with
scan-build/ccc-analyzer not.

Anybody can confirm this?

Thank you,

I don't see this in a simple test. Can you send a test project that exhibits this behavior?


Thank you, Jordan

I'll try to reduce project to something reasonable.



Now I know problem commit -- 189372, but I don't have a little testcase yet.

[ clang]$ svn log -r189372

Are you setting ‘CC=gcc -std=gnu99’ in your build script, rather than putting the -std flag inCFLAGS

I use autoconf/libtool.
In configure.ac I have 'AC_PROG_CC_C99'

After all Makefile contains
CC = /home/dimhen/src/llvm_189371/tools/clang/tools/scan-build/ccc-analyzer
-fvar-tracking-assignments -fno-builtin -fno-common -O0 -pipe -m64

According to the autoconf docs, AC_PROG_CC_C99 will put the flag in the CC variable. I am not yet sure what is the right thing for scan-build to do, but in the meantime you may be able to work around this with

scan-build make CFLAGS=-std=gnu99

or by putting the flag in AM_CFLAGS in configure.ac.

The autoconf people seem to believe that CC should not be overridden except via the environment variable during ./configure, so they feel free to add flags to it. However, there is currently no way for scan-build to be passed a “make” command and know whether it will run a handwritten makefile or one generated by autoconf. Therefore, with or without r189372, some user will have to do extra work. From what I understand, running an autoconf-generated make through scan-build is only necessary to collect and generate the bug reports and not to override CC with ccc-analyzer, as that step is done when running “scan-build ./configure”. If I’m right, maybe the solution would be to simply add another flag to scan-build, e.g. -a, which will prevent scan-build from passing CC and CXX to make, and the autoconf example of scan-build.html could change to use this flag. Anybody have thoughts on that?


thank you for clarification.