[cfe-dev] Using clang static analyzer on linux with Objective C for arm-apple-darwin9-gcc
Ted Kremenek
kremenek at apple.com
Wed May 27 22:17:13 PDT 2009
On May 27, 2009, at 10:01 PM, Eli Friedman wrote:
>> I have an Objective C project which compiles fine under Fedora 8 on
>> x86
>> gcc-4.2.1 cross compiler for arm-apple-darwin9.
>>
>> When I use scan-build with ccc-analyzer it fails to compile. The
>> first
>> compiler error is
>> /Projects/iphone/toolchain/toolchain/sys/usr/include/Foundation/
>> NSObject.h:105:
>> error: expected ‘;’ before ‘__attribute__’
>>
>> I can provide more info, please let me know what kind of info is
>> needed.
>
> Is that error coming out of gcc? (The complete console output might
> be useful here.) If it is, it's probably a bug in the scan-build
> script. Also, if you could show a few lines around the error, it
> might be useful for figuring out what exactly the error is complaining
> about.
I don't think it's a scan-build bug, but just a limitation of what the
scan-build script can do. It doesn't know what version of gcc you
want to use, so it just uses the system default gcc. It sounds like
it isn't calling Jay's cross compiler.
scan-build "interposes" on a build by overriding the CC environment
variable to point to ccc-analyzer. ccc-analyzer then calls 'gcc' to
do the compilation, and 'clang-cc' to do the analysis.
Jay: To have scan-build use your cross-compiler, check out the '-use-
cc' option. 'scan-build' with no options will tell you more.
More information about the cfe-dev
mailing list