Merge pull request #1546 from MikeMcQuaid/llvm-clang-fixes
LLVM Clang fixes
This commit is contained in:
commit
6b2242822b
@ -42,7 +42,7 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
def gcc_40_build_version
|
def gcc_40_build_version
|
||||||
@gcc_40_build_version ||=
|
@gcc_40_build_version ||= begin
|
||||||
if (path = locate("gcc-4.0")) &&
|
if (path = locate("gcc-4.0")) &&
|
||||||
build_version = `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
build_version = `#{path} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
||||||
Version.new build_version
|
Version.new build_version
|
||||||
@ -50,11 +50,11 @@ class DevelopmentTools
|
|||||||
Version::NULL
|
Version::NULL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
alias gcc_4_0_build_version gcc_40_build_version
|
alias gcc_4_0_build_version gcc_40_build_version
|
||||||
|
|
||||||
def gcc_42_build_version
|
def gcc_42_build_version
|
||||||
@gcc_42_build_version ||=
|
@gcc_42_build_version ||= begin
|
||||||
begin
|
|
||||||
gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
|
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")&&
|
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")&&
|
||||||
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
|
||||||
@ -67,7 +67,7 @@ class DevelopmentTools
|
|||||||
alias gcc_build_version gcc_42_build_version
|
alias gcc_build_version gcc_42_build_version
|
||||||
|
|
||||||
def clang_version
|
def clang_version
|
||||||
@clang_version ||=
|
@clang_version ||= begin
|
||||||
if (path = locate("clang")) &&
|
if (path = locate("clang")) &&
|
||||||
build_version = `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1]
|
build_version = `#{path} --version`[/(?:clang|LLVM) version (\d\.\d)/, 1]
|
||||||
Version.new build_version
|
Version.new build_version
|
||||||
@ -75,9 +75,10 @@ class DevelopmentTools
|
|||||||
Version::NULL
|
Version::NULL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def clang_build_version
|
def clang_build_version
|
||||||
@clang_build_version ||=
|
@clang_build_version ||= begin
|
||||||
if (path = locate("clang")) &&
|
if (path = locate("clang")) &&
|
||||||
build_version = `#{path} --version`[/clang-(\d{2,})/, 1]
|
build_version = `#{path} --version`[/clang-(\d{2,})/, 1]
|
||||||
Version.new build_version
|
Version.new build_version
|
||||||
@ -85,11 +86,17 @@ class DevelopmentTools
|
|||||||
Version::NULL
|
Version::NULL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def llvm_clang_build_version
|
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 = 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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@ class Cmd
|
|||||||
/^-O[0-9zs]?$/, "-fast", "-no-cpp-precomp",
|
/^-O[0-9zs]?$/, "-fast", "-no-cpp-precomp",
|
||||||
"-pedantic", "-pedantic-errors", "-Wno-long-double",
|
"-pedantic", "-pedantic-errors", "-Wno-long-double",
|
||||||
"-Wno-unused-but-set-variable"
|
"-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/,
|
"-mno-dynamic-no-pic", "-fearly-inlining", /^-f(?:no-)?inline-functions-called-once/,
|
||||||
/^-finline-limit/, /^-f(?:no-)?check-new/, "-fno-delete-null-pointer-checks",
|
/^-finline-limit/, /^-f(?:no-)?check-new/, "-fno-delete-null-pointer-checks",
|
||||||
"-fcaller-saves", "-fthread-jumps", "-fno-reorder-blocks", "-fcse-skip-blocks",
|
"-fcaller-saves", "-fthread-jumps", "-fno-reorder-blocks", "-fcse-skip-blocks",
|
||||||
@ -165,8 +165,6 @@ class Cmd
|
|||||||
"-fuse-linker-plugin", "-frounding-math"
|
"-fuse-linker-plugin", "-frounding-math"
|
||||||
# clang doesn't support these flags
|
# clang doesn't support these flags
|
||||||
args << arg unless tool =~ /^clang/
|
args << arg unless tool =~ /^clang/
|
||||||
when "-fopenmp", "-lgomp"
|
|
||||||
args << arg if tool =~ /^llvm_clang/
|
|
||||||
when "--fast-math"
|
when "--fast-math"
|
||||||
arg = "-ffast-math" if tool =~ /^clang/
|
arg = "-ffast-math" if tool =~ /^clang/
|
||||||
args << arg
|
args << arg
|
||||||
|
|||||||
@ -34,5 +34,9 @@ class Version
|
|||||||
""
|
""
|
||||||
end
|
end
|
||||||
alias_method :to_str, :to_s
|
alias_method :to_str, :to_s
|
||||||
|
|
||||||
|
def inspect
|
||||||
|
"#<Version::NULL>".freeze
|
||||||
|
end
|
||||||
end.new
|
end.new
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user