[cfe-dev] 回复: Re: Problem when using scan-build

逆水x轻风 via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 22 19:51:44 PST 2017


Thank you for answering my email. The cmd we use is "scan-build --use-analyzer=/home/clang/bin/clang --use-cc=/home/gcc/arm-none-eabi/bin/arm-none-eabi-gcc --analyzer-target=arm-linux-gnueabi make -s MMU=2 products_isp=hi6250 -j"

The version of clang is 3.8.256229 and gcc is 4.7.1 and os is Ubuntu 12.04
The error log of clang is : 
In file include from /usr/include/math.h/usr/include/bits/matchcalls.h:110:1 error expected identifier or "("
________________________________
However, /usr/include/math.h is not the head file we need, we found /usr/include/ is the default include <...> path of clang. Actually, we need /home/gcc/arm-none-eabi/include/math.h , it's in the default include path of gcc(/home/gcc/arm-none-eabi/include/).

So, how can we use the include path of gcc when run the scan-build cmd ?
---原始邮件---
发件人:"Artem Dergachev"<noqnoqneo at gmail.com>
发送时间:2017年2月20日 星期一 下午10:57
收件人:"Laszlo Nagy"<rizsotto.mailinglist at gmail.com>;"逆水x轻风"<526642675 at qq.com>
抄送:"cfe-dev"<cfe-dev at lists.llvm.org>
主题:Re: [cfe-dev] Problem when using scan-build
The scan-build tool should be using the original compiler for compiling
(transparently) and clang for analysis (inevitably). It means that both
compilers need to compile the code independently (even though the clang
instance that is used for analysis doesn't produce any binaries, all
earlier phases of compilation need to occur), which means they need to
find all includes. It also means that if a certain translation unit
cannot be compiled with clang (with relevantly interposed compilation
flags), it cannot be analyzed.
So i'd second the question regarding which includes you're having
problems with.
On 2/20/17 1:04 PM, Laszlo Nagy via cfe-dev wrote:
> This question is related little to scan-build. scan-build calls clang,
> so if you know how to compile your code with clang and use gcc
> specific header files, then you got the answer... You shall know,
> there are compiler specific header files, which you won't be able to
> interchange between compilers. Please be more specific with your
> question which header files you wish to be used. And also, in order to
> get help, you need to tell more about your setup. (what os? what
> version of gcc? which clang version? how clang got compiled? etc..)
>
> On Mon, Feb 20, 2017 at 6:19 PM, 逆水x轻风 via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
>     With --use-c=gcc and --use-analyzer=clang when run "scan-build" it
>     will use include<...> of clang , but we need include<...> of gcc.
>     How can I define the default include path of gcc when I run
>     "scan-build --use-c=gcc --use-analyzer=clang make" ?
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170223/f131f2bb/attachment.html>


More information about the cfe-dev mailing list