Auto merge of #28612 - gandro:targetvendor, r=alexcrichton

This adds a new target property, `target_vendor`. It is to be be used as a matcher for conditional compilation. The vendor is part of the [autoconf target triple](http://llvm.org/docs/doxygen/html/classllvm_1_1Triple.html#details): `<arch><sub>-<vendor>-<os>-<env>`. `arch`, `target_os` and `target_env` are already supported by Rust.

This change was suggested in PR #28593. It enables conditional compilation based on the vendor. This is needed for the rumprun target, which needs to match against both, target_os and target_vendor.

The default value for `target_vendor` is "unknown", "apple" and "pc" are other common values.

Matching against the `target_vendor` is introduced behind the feature gate `#![feature(cfg_target_vendor)]`.

This is the first time I messed around with rustc internals. I just added the my code where I found the existing `target_*` variables, hopefully I haven't missed anything. Please review with care. :)

r? @alexcrichton
This commit is contained in:
bors 2015-09-26 00:14:39 +00:00
commit 78ce46ffdd
36 changed files with 95 additions and 3 deletions

View file

@ -2093,6 +2093,8 @@ The following configurations must be defined by the implementation:
* `target_pointer_width = "..."` - Target pointer width in bits. This is set
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
64-bit pointers.
* `target_vendor = "..."` - Vendor of the target, for example `apple`, `pc`, or
simply `"unknown"`.
* `test` - Enabled when compiling the test harness (using the `--test` flag).
* `unix` - See `target_family`.
* `windows` - See `target_family`.
@ -2269,7 +2271,7 @@ The currently implemented features of the reference compiler are:
* `advanced_slice_patterns` - See the [match expressions](#match-expressions)
section for discussion; the exact semantics of
slice patterns are subject to change, so some types
are still unstable.
are still unstable.
* `slice_patterns` - OK, actually, slice patterns are just scary and
completely unstable.
@ -2290,6 +2292,9 @@ The currently implemented features of the reference compiler are:
* `box_syntax` - Allows use of `box` expressions, the exact semantics of which
is subject to change.
* `cfg_target_vendor` - Allows conditional compilation using the `target_vendor`
matcher which is subject to change.
* `concat_idents` - Allows use of the `concat_idents` macro, which is in many
ways insufficient for concatenating identifiers, and may be
removed entirely for something more wholesome.