[cfe-dev] Potential scan-build issue

Steve McCoy mccoyst at gmail.com
Tue Aug 27 09:41:03 PDT 2013


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

% cat makefile
CC := clang
all:
@echo $(CC)
% make
clang
% CC=gcc make
clang
% make CC=gcc
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!



On Tue, Aug 27, 2013 at 11:21 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> 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.
>
> Thanks!
> Jordan
>
>
> On Aug 26, 2013, at 10:32 , Steve McCoy <mccoyst at gmail.com> wrote:
>
> > 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!
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130827/d2fb2923/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scan-build.patch
Type: application/octet-stream
Size: 704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130827/d2fb2923/attachment.obj>


More information about the cfe-dev mailing list