[cfe-dev] can "clang --analyze" return non-zero result?

Andrzej Krzemienski via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 12 05:50:22 PDT 2017


Thanks for the advice. So, I tried using scan-build instead, but I run onto
a problem. I am compiling with clang with a gcc toolset:

```
clang++ -std=c++11 -stdlib=libstdc++ --gcc-toolchain=my/path/gcc-5.4.0
-Wall -Wextra main.cpp
```

And it works fine. But when I add  scan-build atop:

```
scan-build --force-analyze-debug-code --status-bugs -v -v -v clang++
-std=c++11 -stdlib=libstdc++ --gcc-toolchain=/my/path/gcc-5.4.0 -Wall
-Wextra main.cpp
```

Somehow it accesses standard library header files from a different, older
g++ version, under path `/usr/lib/gcc/x86_64-redhat-linux/4.4.7/` which I
never wanted to use. Is there some way to instruct scan-build which path it
should use for libstdc++ header files?

2017-09-10 4:32 GMT+02:00 Laszlo Nagy <rizsotto.mailinglist at gmail.com>:

> Hi Andrzej,
>
> Clang itself might not have this flag, but scan-build has the
> `--status-bugs`. Alternatively you can ask Clang to output the report in
> `.plist` file, and then you can parse that file. (So you end up writing a
> wrapper around Clang, but that's nearly the same thing what scan-build is
> doing.)
>
> Regards,
> Laszlo
>
> On Thu, Sep 7, 2017 at 4:41 PM, Andrzej Krzemienski via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi Everyone,
>> When I run static analyzer from clang with `clang++ --analyze`, is there
>> a way to make clang return a non-zero status code in case any warning from
>> the analyzer is reported? (I am looking for something analogous to -Werror
>> for normal compiler warnings.)
>>
>> Regards,
>> &rzej;
>>
>> _______________________________________________
>> 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/20170912/41a2ac42/attachment.html>


More information about the cfe-dev mailing list