[cfe-dev] Issue #1 from RTEMS run of clang-analyzer

John Bytheway jbytheway+llvm at gmail.com
Thu Sep 30 01:18:46 PDT 2010


On 29/09/10 18:51, Ted Kremenek wrote:
> Hi Joel,
> 
> I looked into this issue.  The error is coming from the compiler, which
> is directly forwarded the arguments (with no extra interpretation) from
> ccc-analyzer.  I'm not certain where the issue is, because I see this
> problem even when just using the compiler directly (and not using
> scan-build).  For example:
> 
> $ touch t.c
> $ cat Makefile 
> t.o:
> $(CC) -DFOO=\"Foo Bar\" -c t.c
> 
> clean:
> rm -f t.o
> 
> all: t.o
> 
> $ CC=gcc make
> gcc -DFOO=\"Foo Bar\" -c t.c
> i686-apple-darwin11-gcc-4.2.1: Bar": No such file or directory
> <command-line>: warning: missing terminating " character
> make: *** [t.o] Error 1
> 
> 
> Note that if I change the relevant line in the Makefile to:
> 
> t.o:
>         $(CC) -DFOO='"Foo Bar"' -c t.c
> 
> 
> the problem goes away.

Indeed, this example is a bug in the Makefile.  In the first form the
shell will see two words, not one.  You need to quote or escape the
space as well as the double quotes, such as is done in the revised
version above.  This would work too:

t.o:
        $(CC) -DFOO=\"Foo\ Bar\" -c t.c

John Bytheway




More information about the cfe-dev mailing list