Potential scan-build issue

I was having some trouble getting scan-build to scan my C code when running make, so I looked into the perl and saw that I need to pass the -k flag to scan-build to override the CC variable. Is this the intended behavior? The docs make it sound like -k is just there for convenience, but none of the examples with make show manually overriding CC when not passing -k. This is happening with checker-275, but the version in svn has identical logic around ‘AddIfNotPresent($Args, “CC=$CCAnalyzer”);’

Thanks for any help!

Hm, interesting. I think that's cause we do set CC in the environment, and usually that's good enough to get picked up by the Makefile. Is that not happening in your case?

If it's the right thing to do, please send a patch to invert the logic here, so that we check for make before checking for IgnoreErrors.


Yeah, make doesn’t treat environment variables in the same way as it does override arguments. Here’s a short example:

% cat makefile

@echo $(CC)

% make

% CC=gcc make
% make CC=gcc

More details: http://www.gnu.org/software/make/manual/html_node/Overriding.html

I’ve attached a patch. Let me know if you need anything else!

scan-build.patch (704 Bytes)

Committed in r189372. Thanks, Steve!

scan-build.patch (704 Bytes)