aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-11-21 09:18:22 +0000
committerGitHub2016-11-21 09:18:22 +0000
commit6b2242822b30f7a0d4c4399d782dc3d091aba12b (patch)
treeaca50fb62166fc8dffe93c2b67530dd19cada7f0 /Library
parent17109737925c65acfba761aa107567d07a910557 (diff)
parentb9d0d7719a9ecc31be4b2fb3e027e20b3ba378e6 (diff)
downloadbrew-6b2242822b30f7a0d4c4399d782dc3d091aba12b.tar.bz2
Merge pull request #1546 from MikeMcQuaid/llvm-clang-fixes
LLVM Clang fixes
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/development_tools.rb35
-rwxr-xr-xLibrary/Homebrew/shims/super/cc4
-rw-r--r--Library/Homebrew/version/null.rb4
3 files changed, 26 insertions, 17 deletions
diff --git a/Library/Homebrew/development_tools.rb b/Library/Homebrew/development_tools.rb
index d081067a8..ea7f5837d 100644
--- a/Library/Homebrew/development_tools.rb
+++ b/Library/Homebrew/development_tools.rb
@@ -42,54 +42,61 @@ class DevelopmentTools
end
def gcc_40_build_version
- @gcc_40_build_version ||=
+ @gcc_40_build_version ||= begin
if (path = locate("gcc-4.0")) &&
build_version = `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1]
Version.new build_version
else
Version::NULL
end
+ end
end
alias gcc_4_0_build_version gcc_40_build_version
def gcc_42_build_version
- @gcc_42_build_version ||=
- begin
- gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
- if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")&&
- build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
- Version.new build_version
- else
- Version::NULL
- end
+ @gcc_42_build_version ||= begin
+ gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
+ if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")&&
+ build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
+ Version.new build_version
+ else
+ Version::NULL
end
+ end
end
alias gcc_build_version gcc_42_build_version
def clang_version
- @clang_version ||=
+ @clang_version ||= begin
if (path = locate("clang")) &&
build_version = `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1]
Version.new build_version
else
Version::NULL
end
+ end
end
def clang_build_version
- @clang_build_version ||=
+ @clang_build_version ||= begin
if (path = locate("clang")) &&
build_version = `#{path} --version`[/clang-(\d{2,})/, 1]
Version.new build_version
else
Version::NULL
end
+ end
end
def llvm_clang_build_version
- @llvm_clang_build_version ||= if Tab.for_name "llvm"
+ @llvm_clang_build_version ||= begin
path = Formulary.factory("llvm").opt_prefix/"bin/clang"
- `#{path} --version`[/clang version (\d\.\d\.\d)/, 1]
+ if path.executable? &&
+ build_version = `#{path} --version`[/clang version (\d\.\d\.\d)/, 1]
+ Version.new build_version
+ else
+ Version::NULL
+ end
end
end
diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc
index 167fe8c21..9d2ee0d34 100755
--- a/Library/Homebrew/shims/super/cc
+++ b/Library/Homebrew/shims/super/cc
@@ -156,7 +156,7 @@ class Cmd
/^-O[0-9zs]?$/, "-fast", "-no-cpp-precomp",
"-pedantic", "-pedantic-errors", "-Wno-long-double",
"-Wno-unused-but-set-variable"
- when "-mno-fused-madd", "-fforce-addr", "-fno-defer-pop",
+ when "-fopenmp", "-lgomp", "-mno-fused-madd", "-fforce-addr", "-fno-defer-pop",
"-mno-dynamic-no-pic", "-fearly-inlining", /^-f(?:no-)?inline-functions-called-once/,
/^-finline-limit/, /^-f(?:no-)?check-new/, "-fno-delete-null-pointer-checks",
"-fcaller-saves", "-fthread-jumps", "-fno-reorder-blocks", "-fcse-skip-blocks",
@@ -165,8 +165,6 @@ class Cmd
"-fuse-linker-plugin", "-frounding-math"
# clang doesn't support these flags
args << arg unless tool =~ /^clang/
- when "-fopenmp", "-lgomp"
- args << arg if tool =~ /^llvm_clang/
when "--fast-math"
arg = "-ffast-math" if tool =~ /^clang/
args << arg
diff --git a/Library/Homebrew/version/null.rb b/Library/Homebrew/version/null.rb
index 77106bcce..65e3d56c0 100644
--- a/Library/Homebrew/version/null.rb
+++ b/Library/Homebrew/version/null.rb
@@ -34,5 +34,9 @@ class Version
""
end
alias_method :to_str, :to_s
+
+ def inspect
+ "#<Version::NULL>".freeze
+ end
end.new
end