Fix --use-cc when no absolute path is provided (Closes: #748777)

This commit is contained in:
Sylvestre Ledru 2014-06-22 16:05:05 +00:00
parent 22dfe00ec5
commit d4f852c217
3 changed files with 42 additions and 0 deletions

1
debian/changelog vendored
View File

@ -5,6 +5,7 @@ llvm-toolchain-3.4 (1:3.4.2-3) unstable; urgency=medium
(Closes: #751943)
* Fix FTBFS on powerpc and powerpcspe (Closes: #733890)
* Broken library symlink fixed in lldb-3.4 (Closes: #715130)
* Fix --use-cc when no absolute path is provided (Closes: #748777)
-- Sylvestre Ledru <sylvestre@debian.org> Thu, 19 Jun 2014 19:13:16 +0200

View File

@ -0,0 +1,39 @@
Index: llvm-toolchain-3.4-3.4.2/clang/tools/scan-build/ccc-analyzer
===================================================================
--- llvm-toolchain-3.4-3.4.2.orig/clang/tools/scan-build/ccc-analyzer 2014-06-22 08:51:25.452950214 -0700
+++ llvm-toolchain-3.4-3.4.2/clang/tools/scan-build/ccc-analyzer 2014-06-22 08:52:17.602331808 -0700
@@ -25,6 +25,17 @@
# Compiler command setup.
##===----------------------------------------------------------------------===##
+# 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;
+}
+
my $Compiler;
my $Clang;
my $DefaultCCompiler;
@@ -40,14 +51,14 @@
if ($FindBin::Script =~ /c\+\+-analyzer/) {
$Compiler = $ENV{'CCC_CXX'};
- if (!defined $Compiler || ! -x $Compiler) { $Compiler = $DefaultCXXCompiler; }
+ if (!defined $Compiler || ! -x $Compiler || ! SearchInPath($Compiler)) { $Compiler = $DefaultCXXCompiler; }
$Clang = $ENV{'CLANG_CXX'};
if (!defined $Clang || ! -x $Clang) { $Clang = 'clang++'; }
}
else {
$Compiler = $ENV{'CCC_CC'};
- if (!defined $Compiler || ! -x $Compiler) { $Compiler = $DefaultCCompiler; }
+ if (!defined $Compiler || ! -x $Compiler && ! SearchInPath($Compiler)) { $Compiler = $DefaultCCompiler; }
$Clang = $ENV{'CLANG'};
if (!defined $Clang || ! -x $Clang) { $Clang = 'clang'; }

View File

@ -41,3 +41,5 @@ compiler-rt-path.diff
lldb-soname.diff
CVE-2014-2893.diff
follow-parallel-var.diff
scan-build-search-path.diff