diff options
| author | Sebastian Wicki <gandro@gmx.net> | 2015-09-24 01:20:43 +0200 |
|---|---|---|
| committer | Sebastian Wicki <gandro@gmx.net> | 2015-09-24 01:44:55 +0200 |
| commit | af68cdfea1e7a9121122d89d2baa70d64f340d54 (patch) | |
| tree | 0cfbd9d3470149015281c104663933f23332507d /src/libsyntax | |
| parent | afae2ff723393b3ab4ccffef6ac7c6d1809e2da0 (diff) | |
| download | rust-af68cdfea1e7a9121122d89d2baa70d64f340d54.tar.gz rust-af68cdfea1e7a9121122d89d2baa70d64f340d54.zip | |
rustc: Add target_vendor for target triples
This adds a new target property, `target_vendor` which can be used as a matcher for conditional compilation. The vendor is part of the autoconf target triple: <arch><sub>-<vendor>-<os>-<env> The default value for `target_vendor` is "unknown". Matching against the `target_vendor` with `#[cfg]` is currently feature gated as `cfg_target_vendor`.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index be95b58bf88..ce3c4a15e1e 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -203,6 +203,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status // allow `#[omit_gdb_pretty_printer_section]` ("omit_gdb_pretty_printer_section", "1.5.0", None, Active), + + // Allows cfg(target_vendor = "..."). + ("cfg_target_vendor", "1.5.0", None, Active), ]; // (changing above list without updating src/doc/reference.md makes @cmr sad) @@ -377,6 +380,7 @@ macro_rules! cfg_fn { const GATED_CFGS: &'static [(&'static str, &'static str, fn(&Features) -> bool)] = &[ // (name in cfg, feature, function to check if the feature is enabled) ("target_feature", "cfg_target_feature", cfg_fn!(|x| x.cfg_target_feature)), + ("target_vendor", "cfg_target_vendor", cfg_fn!(|x| x.cfg_target_vendor)), ]; #[derive(Debug, Eq, PartialEq)] @@ -471,6 +475,7 @@ pub struct Features { pub default_type_parameter_fallback: bool, pub type_macros: bool, pub cfg_target_feature: bool, + pub cfg_target_vendor: bool, pub augmented_assignments: bool, } @@ -500,6 +505,7 @@ impl Features { default_type_parameter_fallback: false, type_macros: false, cfg_target_feature: false, + cfg_target_vendor: false, augmented_assignments: false, } } @@ -1069,6 +1075,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &SpanHandler, default_type_parameter_fallback: cx.has_feature("default_type_parameter_fallback"), type_macros: cx.has_feature("type_macros"), cfg_target_feature: cx.has_feature("cfg_target_feature"), + cfg_target_vendor: cx.has_feature("cfg_target_vendor"), augmented_assignments: cx.has_feature("augmented_assignments"), } } |
