diff options
| author | Richard Diamond <wichard@vitalitystudios.com> | 2015-09-07 00:35:57 -0500 |
|---|---|---|
| committer | Richard Diamond <wichard@vitalitystudios.com> | 2015-09-09 19:16:45 -0500 |
| commit | cdf6cebc0010653aa2fbf315f7f7660983d007da (patch) | |
| tree | cc220be29f5697429ed35ad38703b0f4b3186999 /src/librustc_back | |
| parent | 6f142404d6f9e0b2ea87c4f58806bf763eb42d83 (diff) | |
| download | rust-cdf6cebc0010653aa2fbf315f7f7660983d007da.tar.gz rust-cdf6cebc0010653aa2fbf315f7f7660983d007da.zip | |
Refactor `TargetOptions::data_layout` into an `Option`al value to reflect current usage.
NFC.
Diffstat (limited to 'src/librustc_back')
| -rw-r--r-- | src/librustc_back/target/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 1f3b823d008..56562c8dfdb 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -91,7 +91,7 @@ pub struct Target { #[derive(Clone, Debug)] pub struct TargetOptions { /// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM. - pub data_layout: String, + pub data_layout: Option<String>, /// Linker to invoke. Defaults to "cc". pub linker: String, /// Archive utility to use when managing archives. Defaults to "ar". @@ -186,7 +186,7 @@ impl Default for TargetOptions { /// incomplete, and if used for compilation, will certainly not work. fn default() -> TargetOptions { TargetOptions { - data_layout: String::new(), + data_layout: None, linker: option_env!("CFG_DEFAULT_LINKER").unwrap_or("cc").to_string(), ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(), pre_link_args: Vec::new(), @@ -287,6 +287,14 @@ impl Target { ) ); } ); + ($key_name:ident, optional) => ( { + let name = (stringify!($key_name)).replace("_", "-"); + if let Some(o) = obj.find(&name[..]) { + base.options.$key_name = o + .as_string() + .map(|s| s.to_string() ); + } + } ); } key!(cpu); @@ -300,7 +308,7 @@ impl Target { key!(staticlib_prefix); key!(staticlib_suffix); key!(features); - key!(data_layout); + key!(data_layout, optional); key!(dynamic_linking, bool); key!(executables, bool); key!(disable_redzone, bool); |
