From 4040e6182ea89032f258f9c8cacc3578bbc27495 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 17 Nov 2024 02:52:22 -0500 Subject: [PATCH] Apply small fixes to sync `main` and `libc-0.2` build and test Just check out a few hunks of these files from `main` now that we aren't limited by the old MSRV. --- build.rs | 30 ++++++++---------------------- libc-test/build.rs | 3 ++- libc-test/semver/android.txt | 3 --- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/build.rs b/build.rs index d76a24a9feccd..40bb2a9492029 100644 --- a/build.rs +++ b/build.rs @@ -138,7 +138,7 @@ fn rustc_version_cmd(is_clippy_driver: bool) -> Output { cmd.arg("--version"); - let output = cmd.output().ok().expect("Failed to get rustc version"); + let output = cmd.output().expect("Failed to get rustc version"); if !output.status.success() { panic!( @@ -193,20 +193,14 @@ fn rustc_minor_nightly() -> (u32, bool) { } fn which_freebsd() -> Option { - let output = std::process::Command::new("freebsd-version").output().ok(); - if output.is_none() { - return None; - } - let output = output.unwrap(); + let output = std::process::Command::new("freebsd-version") + .output() + .ok()?; if !output.status.success() { return None; } - let stdout = String::from_utf8(output.stdout).ok(); - if stdout.is_none() { - return None; - } - let stdout = stdout.unwrap(); + let stdout = String::from_utf8(output.stdout).ok()?; match &stdout { s if s.starts_with("10") => Some(10), @@ -223,24 +217,16 @@ fn emcc_version_code() -> Option { let output = std::process::Command::new("emcc") .arg("-dumpversion") .output() - .ok(); - if output.is_none() { - return None; - } - let output = output.unwrap(); + .ok()?; if !output.status.success() { return None; } - let stdout = String::from_utf8(output.stdout).ok(); - if stdout.is_none() { - return None; - } - let version = stdout.unwrap(); + let version = String::from_utf8(output.stdout).ok()?; // Some Emscripten versions come with `-git` attached, so split the // version string also on the `-` char. - let mut pieces = version.trim().split(|c| c == '.' || c == '-'); + let mut pieces = version.trim().split(['.', '-']); let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0); let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0); diff --git a/libc-test/build.rs b/libc-test/build.rs index ce2f75eb312aa..8a06298741c52 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1858,6 +1858,7 @@ fn test_android(target: &str) { // These are tested in the `linux_elf.rs` file. "Elf64_Phdr" | "Elf32_Phdr" => true, + // These are intended to be opaque "posix_spawn_file_actions_t" => true, "posix_spawnattr_t" => true, @@ -2463,7 +2464,7 @@ fn test_freebsd(target: &str) { true } - // Added in in FreeBSD 13.0 (r367776 and r367287) + // Added in FreeBSD 13.0 (r367776 and r367287) "SCM_CREDS2" | "LOCAL_CREDS_PERSISTENT" if Some(13) > freebsd_ver => true, // Added in FreeBSD 14 diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index b679acdcf28ed..b863ef50906b6 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1,6 +1,3 @@ - - - ABS_CNT ABS_MAX ADDR_COMPAT_LAYOUT