rustc_target: Move target_vendor
from Target
to TargetOptions
This commit is contained in:
parent
d5fd31197f
commit
b294cc71a2
161 changed files with 28 additions and 163 deletions
|
@ -668,8 +668,6 @@ pub struct Target {
|
|||
pub llvm_target: String,
|
||||
/// Number of bits in a pointer. Influences the `target_pointer_width` `cfg` variable.
|
||||
pub pointer_width: u32,
|
||||
/// Vendor name to use for conditional compilation.
|
||||
pub target_vendor: String,
|
||||
/// Architecture to use for ABI considerations. Valid options include: "x86",
|
||||
/// "x86_64", "arm", "aarch64", "mips", "powerpc", "powerpc64", and others.
|
||||
pub arch: String,
|
||||
|
@ -709,6 +707,8 @@ pub struct TargetOptions {
|
|||
pub target_os: String,
|
||||
/// Environment name to use for conditional compilation. Defaults to "".
|
||||
pub target_env: String,
|
||||
/// Vendor name to use for conditional compilation. Defaults to "unknown".
|
||||
pub target_vendor: String,
|
||||
|
||||
/// Linker to invoke
|
||||
pub linker: Option<String>,
|
||||
|
@ -992,6 +992,7 @@ impl Default for TargetOptions {
|
|||
target_c_int_width: "32".to_string(),
|
||||
target_os: "none".to_string(),
|
||||
target_env: String::new(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
|
||||
lld_flavor: LldFlavor::Ld,
|
||||
pre_link_args: LinkArgs::new(),
|
||||
|
@ -1153,13 +1154,6 @@ impl Target {
|
|||
.ok_or_else(|| format!("Field {} in target specification is required", name))
|
||||
};
|
||||
|
||||
let get_opt_field = |name: &str, default: &str| {
|
||||
obj.find(name)
|
||||
.and_then(|s| s.as_string())
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_else(|| default.to_string())
|
||||
};
|
||||
|
||||
let mut base = Target {
|
||||
llvm_target: get_req_field("llvm-target")?,
|
||||
pointer_width: get_req_field("target-pointer-width")?
|
||||
|
@ -1167,7 +1161,6 @@ impl Target {
|
|||
.map_err(|_| "target-pointer-width must be an integer".to_string())?,
|
||||
data_layout: get_req_field("data-layout")?,
|
||||
arch: get_req_field("arch")?,
|
||||
target_vendor: get_opt_field("vendor", "unknown"),
|
||||
linker_flavor: LinkerFlavor::from_str(&*get_req_field("linker-flavor")?)
|
||||
.ok_or_else(|| format!("linker flavor must be {}", LinkerFlavor::one_of()))?,
|
||||
options: Default::default(),
|
||||
|
@ -1416,6 +1409,7 @@ impl Target {
|
|||
key!(target_c_int_width);
|
||||
key!(target_os = "os");
|
||||
key!(target_env = "env");
|
||||
key!(target_vendor = "vendor");
|
||||
key!(linker, optional);
|
||||
key!(lld_flavor, LldFlavor)?;
|
||||
key!(pre_link_objects, link_objects);
|
||||
|
@ -1645,7 +1639,6 @@ impl ToJson for Target {
|
|||
target_val!(llvm_target);
|
||||
d.insert("target-pointer-width".to_string(), self.pointer_width.to_string().to_json());
|
||||
target_val!(arch);
|
||||
target_val!(target_vendor, "vendor");
|
||||
target_val!(data_layout);
|
||||
target_val!(linker_flavor);
|
||||
|
||||
|
@ -1654,6 +1647,7 @@ impl ToJson for Target {
|
|||
target_option_val!(target_c_int_width);
|
||||
target_option_val!(target_os, "os");
|
||||
target_option_val!(target_env, "env");
|
||||
target_option_val!(target_vendor, "vendor");
|
||||
target_option_val!(linker);
|
||||
target_option_val!(lld_flavor);
|
||||
target_option_val!(pre_link_objects);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue