Format cg_gcc with same formatting parameters
This commit is contained in:
parent
f34f3c7e7f
commit
fd56f44836
@ -34,7 +34,7 @@ fn new() -> Result<Option<Self>, String> {
|
|||||||
"--out-path" => match args.next() {
|
"--out-path" => match args.next() {
|
||||||
Some(path) if !path.is_empty() => out_path = Some(path),
|
Some(path) if !path.is_empty() => out_path = Some(path),
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Expected an argument after `--out-path`, found nothing".into())
|
return Err("Expected an argument after `--out-path`, found nothing".into());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"--help" => {
|
"--help" => {
|
||||||
|
@ -54,7 +54,7 @@ pub fn new(config_file: &Path) -> Result<Self, String> {
|
|||||||
config.gcc_path = Some(value.as_str().to_string())
|
config.gcc_path = Some(value.as_str().to_string())
|
||||||
}
|
}
|
||||||
("gcc-path", _) => {
|
("gcc-path", _) => {
|
||||||
return failed_config_parsing(config_file, "Expected a string for `gcc-path`")
|
return failed_config_parsing(config_file, "Expected a string for `gcc-path`");
|
||||||
}
|
}
|
||||||
("download-gccjit", TomlValue::Boolean(value)) => {
|
("download-gccjit", TomlValue::Boolean(value)) => {
|
||||||
config.download_gccjit = Some(*value)
|
config.download_gccjit = Some(*value)
|
||||||
@ -63,7 +63,7 @@ pub fn new(config_file: &Path) -> Result<Self, String> {
|
|||||||
return failed_config_parsing(
|
return failed_config_parsing(
|
||||||
config_file,
|
config_file,
|
||||||
"Expected a boolean for `download-gccjit`",
|
"Expected a boolean for `download-gccjit`",
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
_ => return failed_config_parsing(config_file, &format!("Unknown key `{}`", key)),
|
_ => return failed_config_parsing(config_file, &format!("Unknown key `{}`", key)),
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ pub fn new(config_file: &Path) -> Result<Self, String> {
|
|||||||
return failed_config_parsing(
|
return failed_config_parsing(
|
||||||
config_file,
|
config_file,
|
||||||
"At least one of `gcc-path` or `download-gccjit` value must be set",
|
"At least one of `gcc-path` or `download-gccjit` value must be set",
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
(Some(_), Some(true)) => {
|
(Some(_), Some(true)) => {
|
||||||
println!(
|
println!(
|
||||||
@ -144,7 +144,7 @@ pub fn parse_argument(
|
|||||||
_ => {
|
_ => {
|
||||||
return Err(
|
return Err(
|
||||||
"Expected a value after `--target-triple`, found nothing".to_string()
|
"Expected a value after `--target-triple`, found nothing".to_string()
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"--out-dir" => match args.next() {
|
"--out-dir" => match args.next() {
|
||||||
@ -158,7 +158,7 @@ pub fn parse_argument(
|
|||||||
self.config_file = Some(arg.to_string());
|
self.config_file = Some(arg.to_string());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Expected a value after `--config-file`, found nothing".to_string())
|
return Err("Expected a value after `--config-file`, found nothing".to_string());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"--release-sysroot" => self.sysroot_release_channel = true,
|
"--release-sysroot" => self.sysroot_release_channel = true,
|
||||||
@ -169,7 +169,7 @@ pub fn parse_argument(
|
|||||||
self.cg_gcc_path = Some(arg.into());
|
self.cg_gcc_path = Some(arg.into());
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Expected a value after `--cg_gcc-path`, found nothing".to_string())
|
return Err("Expected a value after `--cg_gcc-path`, found nothing".to_string());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"--use-backend" => match args.next() {
|
"--use-backend" => match args.next() {
|
||||||
@ -277,7 +277,7 @@ pub fn setup_gcc_path(&mut self) -> Result<(), String> {
|
|||||||
self.gcc_path = match gcc_path {
|
self.gcc_path = match gcc_path {
|
||||||
Some(path) => path,
|
Some(path) => path,
|
||||||
None => {
|
None => {
|
||||||
return Err(format!("missing `gcc-path` value from `{}`", config_file.display(),))
|
return Err(format!("missing `gcc-path` value from `{}`", config_file.display(),));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -109,7 +109,7 @@ fn new() -> Result<Option<Self>, String> {
|
|||||||
test_arg.flags.extend_from_slice(&["--features".into(), feature]);
|
test_arg.flags.extend_from_slice(&["--features".into(), feature]);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
return Err("Expected an argument after `--features`, found nothing".into())
|
return Err("Expected an argument after `--features`, found nothing".into());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"--use-system-gcc" => {
|
"--use-system-gcc" => {
|
||||||
@ -458,11 +458,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
|
|||||||
.map_err(|error| format!("Failed to retrieve cargo path: {:?}", error))
|
.map_err(|error| format!("Failed to retrieve cargo path: {:?}", error))
|
||||||
.and_then(|cargo| {
|
.and_then(|cargo| {
|
||||||
let cargo = cargo.trim().to_owned();
|
let cargo = cargo.trim().to_owned();
|
||||||
if cargo.is_empty() {
|
if cargo.is_empty() { Err(format!("`cargo` path is empty")) } else { Ok(cargo) }
|
||||||
Err(format!("`cargo` path is empty"))
|
|
||||||
} else {
|
|
||||||
Ok(cargo)
|
|
||||||
}
|
|
||||||
})?;
|
})?;
|
||||||
let rustc = String::from_utf8(
|
let rustc = String::from_utf8(
|
||||||
run_command_with_env(&[&"rustup", &toolchain, &"which", &"rustc"], rust_dir, Some(env))?
|
run_command_with_env(&[&"rustup", &toolchain, &"which", &"rustc"], rust_dir, Some(env))?
|
||||||
@ -471,11 +467,7 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
|
|||||||
.map_err(|error| format!("Failed to retrieve rustc path: {:?}", error))
|
.map_err(|error| format!("Failed to retrieve rustc path: {:?}", error))
|
||||||
.and_then(|rustc| {
|
.and_then(|rustc| {
|
||||||
let rustc = rustc.trim().to_owned();
|
let rustc = rustc.trim().to_owned();
|
||||||
if rustc.is_empty() {
|
if rustc.is_empty() { Err(format!("`rustc` path is empty")) } else { Ok(rustc) }
|
||||||
Err(format!("`rustc` path is empty"))
|
|
||||||
} else {
|
|
||||||
Ok(rustc)
|
|
||||||
}
|
|
||||||
})?;
|
})?;
|
||||||
let llvm_filecheck = match run_command_with_env(
|
let llvm_filecheck = match run_command_with_env(
|
||||||
&[
|
&[
|
||||||
|
@ -175,11 +175,7 @@ pub fn cargo_install(to_install: &str) -> Result<(), String> {
|
|||||||
pub fn get_os_name() -> Result<String, String> {
|
pub fn get_os_name() -> Result<String, String> {
|
||||||
let output = run_command(&[&"uname"], None)?;
|
let output = run_command(&[&"uname"], None)?;
|
||||||
let name = std::str::from_utf8(&output.stdout).unwrap_or("").trim().to_string();
|
let name = std::str::from_utf8(&output.stdout).unwrap_or("").trim().to_string();
|
||||||
if !name.is_empty() {
|
if !name.is_empty() { Ok(name) } else { Err("Failed to retrieve the OS name".to_string()) }
|
||||||
Ok(name)
|
|
||||||
} else {
|
|
||||||
Err("Failed to retrieve the OS name".to_string())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PartialEq)]
|
#[derive(Default, PartialEq)]
|
||||||
|
@ -26,11 +26,7 @@ fn get_param(&mut self, index: usize) -> Self::Value {
|
|||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
if on_stack {
|
if on_stack { param.to_lvalue().get_address(None) } else { param.to_rvalue() }
|
||||||
param.to_lvalue().get_address(None)
|
|
||||||
} else {
|
|
||||||
param.to_rvalue()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,11 +858,7 @@ fn modifier_to_gcc(
|
|||||||
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg) => modifier,
|
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::reg) => modifier,
|
||||||
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg)
|
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg)
|
||||||
| InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16) => {
|
| InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::vreg_low16) => {
|
||||||
if modifier == Some('v') {
|
if modifier == Some('v') { None } else { modifier }
|
||||||
None
|
|
||||||
} else {
|
|
||||||
modifier
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => {
|
InlineAsmRegClass::AArch64(AArch64InlineAsmRegClass::preg) => {
|
||||||
unreachable!("clobber-only")
|
unreachable!("clobber-only")
|
||||||
|
@ -1030,11 +1030,7 @@ fn scalar_load_metadata<'a, 'gcc, 'tcx>(
|
|||||||
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
|
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
|
||||||
let load = self.load(llty, llptr, align);
|
let load = self.load(llty, llptr, align);
|
||||||
scalar_load_metadata(self, load, scalar);
|
scalar_load_metadata(self, load, scalar);
|
||||||
if scalar.is_bool() {
|
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
|
||||||
self.trunc(load, self.type_i1())
|
|
||||||
} else {
|
|
||||||
load
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
OperandValue::Pair(
|
OperandValue::Pair(
|
||||||
@ -1782,18 +1778,10 @@ fn fptoint_sat(
|
|||||||
// This already happens today with u128::MAX = 2^128 - 1 > f32::MAX.
|
// This already happens today with u128::MAX = 2^128 - 1 > f32::MAX.
|
||||||
let int_max = |signed: bool, int_width: u64| -> u128 {
|
let int_max = |signed: bool, int_width: u64| -> u128 {
|
||||||
let shift_amount = 128 - int_width;
|
let shift_amount = 128 - int_width;
|
||||||
if signed {
|
if signed { i128::MAX as u128 >> shift_amount } else { u128::MAX >> shift_amount }
|
||||||
i128::MAX as u128 >> shift_amount
|
|
||||||
} else {
|
|
||||||
u128::MAX >> shift_amount
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let int_min = |signed: bool, int_width: u64| -> i128 {
|
let int_min = |signed: bool, int_width: u64| -> i128 {
|
||||||
if signed {
|
if signed { i128::MIN >> (128 - int_width) } else { 0 }
|
||||||
i128::MIN >> (128 - int_width)
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let compute_clamp_bounds_single = |signed: bool, int_width: u64| -> (u128, u128) {
|
let compute_clamp_bounds_single = |signed: bool, int_width: u64| -> (u128, u128) {
|
||||||
|
@ -58,11 +58,7 @@ pub fn type_is_pointer(typ: Type<'_>) -> bool {
|
|||||||
|
|
||||||
impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||||
fn const_null(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
fn const_null(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
||||||
if type_is_pointer(typ) {
|
if type_is_pointer(typ) { self.context.new_null(typ) } else { self.const_int(typ, 0) }
|
||||||
self.context.new_null(typ)
|
|
||||||
} else {
|
|
||||||
self.const_int(typ, 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn const_undef(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
fn const_undef(&self, typ: Type<'gcc>) -> RValue<'gcc> {
|
||||||
|
Loading…
Reference in New Issue
Block a user