diff options
| author | Jack Nagel | 2014-08-01 20:15:58 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-08-01 20:15:58 -0500 | 
| commit | b97d08c335921f8aa5eebb660f5cac2e83ca8ea8 (patch) | |
| tree | bf54a0c6b923902f4311db1aef61c7c5d4828758 /Library/Homebrew/compilers.rb | |
| parent | 954b4d07aae74852d3bb7339377d09faec6f2ec5 (diff) | |
| download | homebrew-b97d08c335921f8aa5eebb660f5cac2e83ca8ea8.tar.bz2 | |
Eagerly create and reuse cxx11 compiler failure objects
Diffstat (limited to 'Library/Homebrew/compilers.rb')
| -rw-r--r-- | Library/Homebrew/compilers.rb | 48 | 
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 | 
