scan-build, --use-cc/--use-c++, and system includes

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