[cfe-dev] Issue #1 from RTEMS run of clang-analyzer
Ted Kremenek
kremenek at apple.com
Wed Sep 29 10:51:22 PDT 2010
On Sep 24, 2010, at 6:03 AM, Joel Sherrill wrote:
> The first is this which looks like a quoted string on the command
> line is getting mangled:
>
> /usr/lib/clang-analyzer/scan-build/ccc-analyzer
> -DPACKAGE_NAME=\"rtems-c-src\" -DPACKAGE_TARNAME=\"rtems-c-src\"
> -DPACKAGE_VERSION=\"4.10.99.0\" -DPACKAGE_STRING=\"rtems-c-src\
> 4.10.99.0\" -DPACKAGE_BUGREPORT=\"http://www.rtems.org/bugzilla\"
> -DPACKAGE_URL=\"\" -DCPU_U32_FIX=1 -I.
> -I/home/joel/rtems-4.11-work/build/rtems/c/src/optman
> -I../../../sis/lib/include -mcpu=cypress -O2 -g -Wall
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -MT
> rtems/no_timer_rel-no-timer.o -MD -MP -MF
> rtems/.deps/no_timer_rel-no-timer.Tpo -c -o
> rtems/no_timer_rel-no-timer.o `test -f 'rtems/no-timer.c' || echo
> '/home/joel/rtems-4.11-work/build/rtems/c/src/optman/'`rtems/no-timer.c
> error: error reading '4.10.99.0"'
> In file included from <built-in>:109:
> <command line>:5:24: error: missing terminating '"' character
> #define PACKAGE_STRING "rtems-c-src
> ^
>
> This is from this -D option...
>
> -DPACKAGE_STRING=\"rtems-c-src\ 4.10.99.0\"
>
> Notice that there is an embedded space in the right hand side of the
> -DPACKAGE_STRING which is causing the parsing of the command line to break.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100929/65fb2841/attachment.html>
More information about the cfe-dev
mailing list