[llvm-bugs] [Bug 26220] New: ccc-analyzer does not accept CCC_CC/CCC_CXX with quotes
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 20 05:07:45 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26220
Bug ID: 26220
Summary: ccc-analyzer does not accept CCC_CC/CCC_CXX with
quotes
Product: clang
Version: 3.7
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: simon.kagstrom at netinsight.net
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
We're using ccache to speed up compilation, so in our system, CC is set to
"ccache gcc-4.9" (basically). We want and need to run scan-build with the same
underlying compiler, so we run it with the CCC_CC="$(CC)" environment variable.
However, ccc-analyzer doesn't accept this, but falls back to the default
compiler instead. An easy way to reproduce this is to do
$ touch /tmp/a.c # Empty C source
$ CCC_CC=ls ccc-analyzer /tmp/a.c
/tmp/a.c
$ CCC_CC="true ; ls" ccc-analyzer /tmp/a.c
/usr/bin/ld: [...]: relocation 0 has invalid symbol index 11
so in the second case, ccc-analyzer ignores CCC_CC and falls back to gcc. My
Perl-knowledge is extremely limited, but I believe this is caused by
ccc-analyzer verifying that the compiler exists in the path:
# Search in the PATH if the compiler exists
sub SearchInPath {
my $file = shift;
foreach my $dir (split (':', $ENV{PATH})) {
if (-x "$dir/$file") {
return 1;
}
}
return 0;
}
[...]
$Compiler = $ENV{'CCC_CC'};
if (!defined $Compiler || (! -x $Compiler && ! SearchInPath($Compiler))) {
$Compiler = $DefaultCCompiler; }
I tested this with clang-3.7, but the latest ccc-analyzer seems to have the
same construct. Obviously, the same is true for the handling of CCC_CXX.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160120/eb547554/attachment.html>
More information about the llvm-bugs
mailing list