[cfe-dev] scan-build, --use-cc/--use-c++, and system includes

John Saxton john.saxton at elementaltechnologies.com
Fri May 29 15:49:24 PDT 2015


Hi,

My organization is using clang 3.5's scan-build tool. Our development
systems typically have gcc 4.4.7 installed in /usr/bin and gcc 4.8.2
installed in /opt/rh/devtoolset-2/root/usr/bin/

In order to get scan-build to work with gcc 4.8.2, we are now invoking
scan-build with --use-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc and
--use-c++=/opt/rh/devtoolset-2/root/usr/bin/g++. Unfortunately, this
introduces build errors, as we're trying to use C++11 features, but clang++
is still using the gcc 4.4.7 includes (-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7).

I spent some time digging through the code, and I was able to fix the issue
by adding the following line to the Analyze function in ccc-analyzer:
push @Args, "--gcc-toolchain=/opt/rh/devtoolset-2/root/usr";

Is there a better way? If not, would the development team accept a patch
that set the --gcc-toolchain argument if scan-build is invoked with
--use-cc or --use-c++?

Thanks,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150529/74c3c750/attachment.html>


More information about the cfe-dev mailing list