Skip to content

Commit

Permalink
Require rust >= 1.26 and drop libc_int128 conditional
Browse files Browse the repository at this point in the history
[ resolve conflicts and add test skips that seem to be needed now -
  Trevor ]
  • Loading branch information
joshtriplett authored and tgross35 committed Nov 16, 2024
1 parent 67b2944 commit 23a0d01
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 68 deletions.
6 changes: 0 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
"libc_const_extern_fn_unstable",
"libc_core_cvoid",
"libc_deny_warnings",
"libc_int128",
"libc_long_array",
"libc_non_exhaustive",
"libc_packedN",
Expand Down Expand Up @@ -87,11 +86,6 @@ fn main() {
set_cfg("libc_deny_warnings");
}

// Rust >= 1.26 supports i128 and u128:
if rustc_minor_ver >= 26 || rustc_dep_of_std {
set_cfg("libc_int128");
}

// Rust >= 1.30 supports `core::ffi::c_void`, so libc can just re-export it.
// Otherwise, it defines an incompatible type to retaining
// backwards-compatibility.
Expand Down
10 changes: 10 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ fn test_apple(target: &str) {
// FIXME: Requires the macOS 14.4 SDK.
"os_sync_wake_by_address_flags_t" | "os_sync_wait_on_address_flags_t" => true,

// FIXME: "'__uint128' undeclared" in C
"__uint128" => true,

_ => false,
}
});
Expand Down Expand Up @@ -1858,6 +1861,10 @@ fn test_android(target: &str) {
// These are intended to be opaque
"posix_spawn_file_actions_t" => true,
"posix_spawnattr_t" => true,

// FIXME: "'__uint128' undeclared" in C
"__uint128" => true,

_ => false,
}
});
Expand Down Expand Up @@ -3702,6 +3709,9 @@ fn test_linux(target: &str) {
"priority_t" if musl => true,
"name_t" if musl => true,

// FIXME: "'__uint128' undeclared" in C
"__uint128" => true,

t => {
if musl {
// LFS64 types have been removed in musl 1.2.4+
Expand Down
2 changes: 1 addition & 1 deletion src/fixed_width_ints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type uint32_t = u32;
pub type uint64_t = u64;

cfg_if! {
if #[cfg(all(libc_int128, target_arch = "aarch64", not(target_os = "windows")))] {
if #[cfg(all(target_arch = "aarch64", not(target_os = "windows")))] {
// This introduces partial support for FFI with __int128 and
// equivalent types on platforms where Rust's definition is validated
// to match the standard C ABI of that platform.
Expand Down
8 changes: 0 additions & 8 deletions src/unix/bsd/apple/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,8 @@ s! {
pub __pad: u32,
}

// This type natively uses a uint128, but for a while we hacked
// it in with repr(align) and `[u64; 2]`. uint128 isn't available
// all the way back to our earliest supported versions so we
// preserver the old shim.
#[cfg_attr(not(libc_int128), repr(align(16)))]
pub struct __darwin_arm_neon_state64 {
#[cfg(libc_int128)]
pub __v: [::__uint128_t; 32],
#[cfg(not(libc_int128))]
pub __v: [[u64; 2]; 32],
pub __fpsr: u32,
pub __fpcr: u32,
}
Expand Down
7 changes: 0 additions & 7 deletions src/unix/linux_like/android/b64/aarch64/int128.rs

This file was deleted.

13 changes: 6 additions & 7 deletions src/unix/linux_like/android/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ s! {
// auto-derive traits like Debug
__reserved: [[u64; 32]; 16],
}

pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -448,10 +454,3 @@ pub const PROT_MTE: ::c_int = 0x20;
// From NDK's asm/auxvec.h
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 2;

cfg_if! {
if #[cfg(libc_int128)] {
mod int128;
pub use self::int128::*;
}
}
8 changes: 0 additions & 8 deletions src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs

This file was deleted.

7 changes: 0 additions & 7 deletions src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs

This file was deleted.

16 changes: 6 additions & 10 deletions src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ s! {
__reserved: [[u64; 32]; 16],
}
pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: ::c_uint,
pub fpcr: ::c_uint,
}
#[repr(align(8))]
pub struct clone_args {
pub flags: ::c_ulonglong,
Expand Down Expand Up @@ -964,13 +970,3 @@ cfg_if! {
pub use self::lp64::*;
}
}

cfg_if! {
if #[cfg(libc_int128)] {
mod int128;
pub use self::int128::*;
} else {
mod fallback;
pub use self::fallback::*;
}
}
7 changes: 0 additions & 7 deletions src/unix/linux_like/linux/musl/b64/aarch64/int128.rs

This file was deleted.

13 changes: 6 additions & 7 deletions src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ s! {
pub set_tid_size: ::c_ulonglong,
pub cgroup: ::c_ulonglong,
}

pub struct user_fpsimd_struct {
pub vregs: [::__uint128_t; 32],
pub fpsr: u32,
pub fpcr: u32,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -684,10 +690,3 @@ pub const VMIN: usize = 6;
pub const IEXTEN: ::tcflag_t = 0x00008000;
pub const TOSTOP: ::tcflag_t = 0x00000100;
pub const FLUSHO: ::tcflag_t = 0x00001000;

cfg_if! {
if #[cfg(libc_int128)] {
mod int128;
pub use self::int128::*;
}
}

0 comments on commit 23a0d01

Please sign in to comment.