53 Commits

Author SHA1 Message Date
Jack Nagel
3de77e4e1a Stop recording the fails_with cause internally
The string passed as the cause is currently unused, so we don't need to
actually store it.
2014-09-21 00:57:32 -05:00
Jack Nagel
c5f2f6b539 Make --cc override the compiler selector 2014-09-18 15:50:54 -05:00
Jack Nagel
04dae13ae7 Replace CompilerQueue with predetermined priority lists 2014-09-18 15:50:54 -05:00
Jack Nagel
288c7974dc Move Compiler struct into CompilerSelector namespace 2014-09-18 15:50:54 -05:00
Jack Nagel
ae88549797 Remove fails_with? from the formula instance 2014-09-18 15:50:54 -05:00
Jack Nagel
1eecf1ac0b Don't use Hash#first
Fixes Homebrew/homebrew#31360.
2014-08-06 09:56:09 -05:00
Jack Nagel
9aac71045c Add inspect to CompilerFailure 2014-08-03 15:28:51 -05:00
Jack Nagel
eb528fd7cd Eliminate a nil check 2014-08-03 13:14:50 -05:00
Jack Nagel
d54bce6a1a Remove dead code 2014-08-03 13:13:23 -05:00
Jack Nagel
b6e9600b9f Eliminate consideration of major_version
The major version is implicit in the compiler name. Since the name is
used when matching failures to compilers, we don't need to consider the
major version separately.
2014-08-03 11:15:39 -05:00
Jack Nagel
4580d86809 Use a separate class for GNU compiler failures
major_version is now only used internally by the failure object
2014-08-03 10:47:47 -05:00
Jack Nagel
8e8b9acc01 Move compiler failure matching logic into failure object 2014-08-03 10:47:47 -05:00
Jack Nagel
e5d6247ae7 Rename compiler attribute to name 2014-08-03 10:47:47 -05:00
Jack Nagel
2fedd5b09a Don't pass nil to fails_with? 2014-08-03 10:47:47 -05:00
Jack Nagel
ffc5687fc2 Eagerly create and reuse cxx11 compiler failure objects 2014-08-01 20:15:58 -05:00
Jack Nagel
525e5f791f Remove knowledge of DSL implementation from initialize 2014-08-01 20:15:57 -05:00
Misty De Meo
e18faa7557 --cc=: make GNU_GCC checks stricter
Fixes Homebrew/homebrew#30668
2014-07-29 19:31:07 -07:00
Jack Nagel
32d84377d5 Move constants so we don't have to load all of ENV to get them 2014-07-02 21:58:43 -05:00
Jack Nagel
9d030f8397 Combine conditionals 2014-06-16 16:58:13 -05:00
Jack Nagel
be1822dd72 Place alias adjacent to aliased method 2014-06-16 16:40:09 -05:00
Jack Nagel
ff2d8fece3 Remove unused method alias
Unlike CompilerFailure, the interface of Compiler is entirely internal,
so we don't need to maintain compatibility with anything.
2014-06-16 16:39:07 -05:00
Jack Nagel
6eb7e0c27f Eliminate an uninitialized ivar warning 2014-06-11 21:34:09 -05:00
Jack Nagel
c319eb1f01 Decouple CompilerSelector from MacOS, clean up tests 2014-06-11 21:23:05 -05:00
Jack Nagel
290db72bd5 Pass the version into the Compiler constructor, eliminate a type check 2014-06-11 21:21:50 -05:00
Misty De Meo
621bb0049f CompilerFailure: llvm can't build C++11 either 2014-04-14 13:40:55 -07:00
Misty De Meo
63d6f054c4 CompilerFailure: don't mutate compiler hashes
Fixes Homebrew/homebrew#28357.
2014-04-12 11:28:24 -07:00
Misty De Meo
9af3917ebf Formula: provide compiler failure collections
`needs` allows formulae to specify dependencies on cross-compiler
dependencies, allowing multiple failures to be specified in a single
statement. For instance, `needs :cxx11` adds seven compiler failures.

Closes Homebrew/homebrew#22912.
2014-04-12 10:36:00 -07:00
Jack Nagel
1aadc83e70 Put positive case first, drop redundant is_a? check 2013-12-12 14:53:53 -06:00
Misty De Meo
5537abbe51 Adjust fails_with syntax for non-Apple compilers
The old version worked like this:

fails_with :gcc => '4.8.1'

That wasn't really flexible enough, and made it harder to distinguish
different releases in the same GCC series. Since no one was really
using it yet, this adjusts the syntax to be more similar to the
Apple compilers:

fails_with :gcc => '4.8' do
  release '4.8.1'
end

Like with Apple compilers, omitting `release` blacklists the entire
series.

This also unifies the `build` and `version` attributes and accessors,
and exposes them under both names.
2013-12-03 22:42:49 -08:00
Jack Nagel
65a00e213b Make CompilerSelectionError an InstallationError
Fixes Homebrew/homebrew#19962.
2013-12-03 22:16:37 -06:00
Misty De Meo
55004d81b6 Compiler priority: fix llvm-gcc priority
llvm-gcc should still get priority over non-Apple GCCs.

Fixes Homebrew/homebrew#22424.
2013-09-10 08:17:28 -07:00
Misty De Meo
e92fa147b3 Remove attr_rw for CompilerFailure version attribute
This reverts commit 7db9ef9650a44ef8155bf66efd88703e580057b0.
2013-09-01 22:37:03 -07:00
Misty De Meo
ca3ed1e5ff CompilerFailure: specify attr_rw for version 2013-09-01 21:26:30 -07:00
Misty De Meo
ef1d9c0cd0 Implement fails_with for non-Apple compilers
This adds support for non-Apple GCC compilers in the fails_with code.
A fails_with block for a non-Apple compiler looks like:

fails_with :gcc => '4.8.1' do
  cause 'Foo'
end

Non-Apple compilers don't have build numbers, so compiler failures are
based on version strings instead.

Internally non-Apple compilers can be distinguished because they are
passed around as strings instead of symbols.

In addition, this alters the priority list for compilers, with the
following changes:

* Apple GCC 4.2 and LLVM-GCC swap positions, with GCC now taking
  priority. (Maybe LLVM-GCC should just go away.)
* Non-Apple GCC compilers are ranked below GCC 4.2 but above LLVM-GCC
  and Apple GCC 4.0.
2013-09-01 13:19:13 -07:00
Jack Nagel
0f314f9808 Remove unused variable 2013-06-12 17:25:29 -05:00
Jack Nagel
b97b013fce Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239.
2013-06-04 11:06:18 -05:00
Misty De Meo
6e3cb9f735 Add gcc 4.0 to CompilerSelector compiler queue 2013-05-20 23:25:15 -05:00
Misty De Meo
4fdbb2d685 CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.

Fixes Homebrew/homebrew#19170.
Fixes mistydemeo/tigerbrew#45.
2013-05-20 23:25:15 -05:00
Misty De Meo
4312f94013 Add gcc-4.0 to fails_with 2013-05-08 09:38:15 -05:00
Jack Nagel
2f49fd07b1 Isolate compiler selector tests 2013-04-02 13:19:04 -05:00
Jack Nagel
c679e557ba CompilerSelector: don't use non-existent compilers 2013-04-02 13:19:04 -05:00
Jack Nagel
c61c1fb813 Bump useable clang version to 318
Build 211 can build most things, but I've seen intermittent
miscompilation and slower code. Also it comes from Xcode 4.2, so most
people don't have it anyway. Let's use 218 as the minimum viable
version.
2013-04-02 13:19:04 -05:00
Jack Nagel
a55fa2c359 Decouple CompilerSelector from ENV 2013-03-16 13:05:02 -05:00
Jack Nagel
f8b4959742 Use a priority queue to select compilers
The existing case-statement with nested if-statements is gross and hard
to extend. Replacing it with a priority queue simplifies the logic and
makes it very easy to add new compilers to the fails_with system, which
we will likely want to do in the future.
2013-03-16 13:05:02 -05:00
Jack Nagel
7104e20bde Replace custom collection with Set
The original constraints that led to using a custom collection rather
than Array or Set here no longer exist, so let's avoid the pointless
abstraction here.
2013-03-16 13:05:02 -05:00
Jack Nagel
cc08d08d74 Switch compilers when no build is specified
Given the current state of OS X compilers, the original fails_with
behavior is becoming less useful, mostly resulting in build failures
each time the compiler is updated. So make the following changes:

When a build is specified, we retain the old behavior: switch compilers
if the available compiler is <= the build, don't switch if it is > the
build.

When no build is specified, unconditionally switch compilers, and don't
output the advice message. This allows us to mark formulae as
perpetually failing, avoiding the need to update formulae each time a
new compiler build is made available.

As a bonus, this makes the logic much easier to reason about.

Closes Homebrew/homebrew#18175.
2013-03-12 13:55:15 -05:00
Mike McQuaid
b65aa8a2f3 Only fails_with compiler version for developers.
Actually works properly now.

This reverts commit a0e56345ea55f7ee3c41d6bf13f9cfb3af635323.
2013-02-21 21:40:15 +00:00
Mike McQuaid
041cc45a61 Revert "Only fails_with compiler version for developers."
This reverts commit c98d50495275ff4951dd126bb88a55e568b64092.
2013-02-20 16:39:04 +00:00
Mike McQuaid
ada5033e0d Only fails_with compiler version for developers.
Closes Homebrew/homebrew#17618.
Closes Homebrew/homebrew#17813.
2013-02-18 19:37:44 +00:00
Jack Nagel
f037be5148 Don't shadow outer local variables 2013-02-18 12:13:36 -06:00