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

Joel Sherrill joel.sherrill at OARcorp.com
Wed Sep 29 16:02:53 PDT 2010


  On 09/29/2010 12:51 PM, Ted Kremenek wrote:
>
> 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\ 
>> <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
>
Try "scan-build make"

$ scan-build make
scan-build: 'clang' executable not found in 
'/usr/lib/clang-analyzer/scan-build/bin'.
scan-build: Using 'clang' from path: /usr/bin/clang
/usr/lib/clang-analyzer/scan-build/ccc-analyzer -DFOO=\"Foo Bar\"  -c t.c
gcc: Bar": No such file or directory
<command-line>: warning: missing terminating " character
make: *** [t.o] Error 1
scan-build: Removing directory '/tmp/scan-build-2010-09-29-1' because it 
contains no reports.

>
> 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.
>




More information about the cfe-dev mailing list