Class: CompilerFailure

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/compilers.rb

Constant Summary collapse

COLLECTIONS =
{
  cxx11: [
    create(:gcc_4_0),
    create(:gcc_4_2),
    create(:clang) { build 425 },
    create(gcc: "4.3"),
    create(gcc: "4.4"),
    create(gcc: "4.5"),
    create(gcc: "4.6"),
  ],
  cxx14: [
    create(:clang) { build 600 },
    create(:gcc_4_0),
    create(:gcc_4_2),
    create(gcc: "4.3"),
    create(gcc: "4.4"),
    create(gcc: "4.5"),
    create(gcc: "4.6"),
    create(gcc: "4.7"),
    create(gcc: "4.8"),
  ],
  openmp: [
    create(:clang),
  ],
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, &block) ⇒ CompilerFailure

Returns a new instance of CompilerFailure



54
55
56
57
58
# File 'Library/Homebrew/compilers.rb', line 54

def initialize(name, version, &block)
  @name = name
  @version = Version.parse(version.to_s)
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



17
18
19
# File 'Library/Homebrew/compilers.rb', line 17

def name
  @name
end

Class Method Details

.create(spec, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'Library/Homebrew/compilers.rb', line 40

def self.create(spec, &block)
  # Non-Apple compilers are in the format fails_with compiler => version
  if spec.is_a?(Hash)
    _, major_version = spec.first
    name = "gcc-#{major_version}"
    # so fails_with :gcc => '4.8' simply marks all 4.8 releases incompatible
    version = "#{major_version}.999"
  else
    name = spec
    version = 9999
  end
  new(name, version, &block)
end

.for_standard(standard) ⇒ Object



34
35
36
37
38
# File 'Library/Homebrew/compilers.rb', line 34

def self.for_standard(standard)
  COLLECTIONS.fetch(standard) do
    raise ArgumentError, "\"#{standard}\" is not a recognized standard"
  end
end

Instance Method Details

#cause(_) ⇒ Object

The cause is no longer used so we need not hold a reference to the string



32
# File 'Library/Homebrew/compilers.rb', line 32

def cause(_); end

#fails_with?(compiler) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'Library/Homebrew/compilers.rb', line 60

def fails_with?(compiler)
  name == compiler.name && version >= compiler.version
end

#inspectObject



64
65
66
# File 'Library/Homebrew/compilers.rb', line 64

def inspect
  "#<#{self.class.name}: #{name} #{version}>"
end

#version(val = nil) ⇒ Object Also known as: build



19
20
21
22
23
24
25
# File 'Library/Homebrew/compilers.rb', line 19

def version(val = nil)
  if val
    @version = Version.parse(val.to_s)
  else
    @version
  end
end