aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/compilers.rb
diff options
context:
space:
mode:
authorJack Nagel2014-08-01 20:15:58 -0500
committerJack Nagel2014-08-01 20:15:58 -0500
commitffc5687fc29159e61c601792c9c8dceaf944fd8f (patch)
tree5b7958438bdebb52f1876426535cd02ec98beccf /Library/Homebrew/compilers.rb
parent525e5f791f992556b9ffbe0b0f4b61c44a94d3b6 (diff)
downloadbrew-ffc5687fc29159e61c601792c9c8dceaf944fd8f.tar.bz2
Eagerly create and reuse cxx11 compiler failure objects
Diffstat (limited to 'Library/Homebrew/compilers.rb')
-rw-r--r--Library/Homebrew/compilers.rb48
1 files changed, 23 insertions, 25 deletions
diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb
index 6f329d380..c1e22f702 100644
--- a/Library/Homebrew/compilers.rb
+++ b/Library/Homebrew/compilers.rb
@@ -19,34 +19,10 @@ class CompilerFailure
# even though `build` and `version` are the same internally
alias_method :build, :version
- MESSAGES = {
- :cxx11 => 'This compiler does not support C++11'
- }
-
- COLLECTIONS = {
- :cxx11 => [
- [:gcc_4_0, proc { cause MESSAGES[:cxx11] }],
- [:gcc, proc { cause MESSAGES[:cxx11] }],
- [:llvm, proc { cause MESSAGES[:cxx11] }],
- [:clang, proc { build 425; cause MESSAGES[:cxx11] }],
- [{:gcc => '4.3'}, proc { cause MESSAGES[:cxx11] }],
- [{:gcc => '4.4'}, proc { cause MESSAGES[:cxx11] }],
- [{:gcc => '4.5'}, proc { cause MESSAGES[:cxx11] }],
- [{:gcc => '4.6'}, proc { cause MESSAGES[:cxx11] }]
- ],
- :openmp => [
- [:clang, proc { cause 'clang does not support OpenMP' }]
- ]
- }
-
def self.for_standard standard
- failures = COLLECTIONS.fetch(standard) do
+ COLLECTIONS.fetch(standard) do
raise ArgumentError, "\"#{standard}\" is not a recognized standard"
end
-
- failures.map do |compiler, block|
- CompilerFailure.new(compiler, &block)
- end
end
def self.create(spec, &block)
@@ -71,6 +47,28 @@ class CompilerFailure
@major_version = major_version
instance_eval(&block) if block_given?
end
+
+ MESSAGES = {
+ :cxx11 => "This compiler does not support C++11"
+ }
+
+ cxx11 = proc { cause MESSAGES[:cxx11] }
+
+ COLLECTIONS = {
+ :cxx11 => [
+ create(:gcc_4_0, &cxx11),
+ create(:gcc, &cxx11),
+ create(:llvm, &cxx11),
+ create(:clang) { build 425; cause MESSAGES[:cxx11] },
+ create(:gcc => "4.3", &cxx11),
+ create(:gcc => "4.4", &cxx11),
+ create(:gcc => "4.5", &cxx11),
+ create(:gcc => "4.6", &cxx11),
+ ],
+ :openmp => [
+ create(:clang) { cause "clang does not support OpenMP" },
+ ]
+ }
end
class CompilerQueue