Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`.
We have two automated tests running on
[GitHub Actions](https://github.com/rust-lang/libc/actions):

1. [`libc-test`](https://github.com/gnzlbg/ctest)
1. `libc-test`
- `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const ALLOWED_CFGS: &[&str] = &[
// FIXME(ctest): this config shouldn't be needed but ctest can't parse `const extern fn`
"libc_const_extern_fn",
"libc_deny_warnings",
"libc_ctest",
// Corresponds to `__USE_TIME_BITS64` in UAPI
"linux_time_bits64",
"musl_v1_2_3",
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ case "$target" in
esac

case "$target" in
# garando_errors only compiles on `cfg(any(unix, windows))`
# crash in std::env::tmp_dir (no filesystem on wasm).
*wasm*) cmd="$cmd --exclude ctest --exclude ctest-test --exclude ctest-next" ;;
# https://github.com/bytecodealliance/rustix/issues/1496
*loongarch*) cmd="$cmd --exclude ctest --exclude ctest-test --exclude ctest-next" ;;
Expand Down
5 changes: 0 additions & 5 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1694,11 +1694,6 @@ fn test_wasi(target: &str) {
"wchar.h",
}

// Currently `ctest` doesn't support macros-in-static-expressions and will
// panic on them. That affects `CLOCK_*` defines in wasi to set this here
// to omit them.
cfg.cfg("libc_ctest", None);

cfg.rename_struct_ty(move |ty| match ty {
"FILE" | "fd_set" | "DIR" => Some(ty.to_string()),
t if t.ends_with("_t") => Some(t.to_string()),
Expand Down
27 changes: 3 additions & 24 deletions src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ pub type c_double = f64;
cfg_if! {
if #[cfg(all(
not(windows),
// FIXME(ctest): just use `target_vendor` = "apple"` once `ctest` supports it
not(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
)),
not(target_vendor = "apple"),
not(target_os = "vita"),
any(
target_arch = "aarch64",
Expand Down Expand Up @@ -91,13 +84,7 @@ pub type uint64_t = u64;
cfg_if! {
if #[cfg(all(
target_arch = "aarch64",
not(any(
target_os = "windows",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos"
))
not(any(target_os = "windows", target_vendor = "apple"))
))] {
/// C `__int128` (a GCC extension that's part of many ABIs)
pub type __int128 = i128;
Expand All @@ -107,15 +94,7 @@ cfg_if! {
pub type __int128_t = i128;
/// C __uint128_t (alternate name for [__uint128][])
pub type __uint128_t = u128;
} else if #[cfg(all(
target_arch = "aarch64",
any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos"
)
))] {
} else if #[cfg(all(target_arch = "aarch64", target_vendor = "apple"))] {
/// C `__int128_t`
pub type __int128_t = i128;
/// C `__uint128_t`
Expand Down
6 changes: 1 addition & 5 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,7 @@ s_no_extra_traits! {
pub aio_offset: off_t,
__next: *mut c_void,
__prev: *mut c_void,
// FIXME(ctest): length should be `32 - 2 * size_of::<*const ()>()`
#[cfg(target_pointer_width = "32")]
__dummy4: [c_char; 24],
#[cfg(target_pointer_width = "64")]
__dummy4: [c_char; 16],
__dummy4: [c_char; 32 - 2 * size_of::<*const ()>()],
}

pub struct sysinfo {
Expand Down
31 changes: 11 additions & 20 deletions src/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,26 +361,17 @@ pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
pub const _SC_IOV_MAX: c_int = 60;
pub const _SC_SYMLOOP_MAX: c_int = 173;

cfg_if! {
if #[cfg(libc_ctest)] {
// skip these constants when this is active because `ctest` currently
// panics on parsing the constants below
} else {
// unsafe code here is required in the stable, but not in nightly
#[allow(unused_unsafe)]
pub static CLOCK_MONOTONIC: clockid_t =
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
#[allow(unused_unsafe)]
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
#[allow(unused_unsafe)]
pub static CLOCK_REALTIME: clockid_t =
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
#[allow(unused_unsafe)]
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
}
}
// unsafe code here is required in the stable, but not in nightly
#[allow(unused_unsafe)]
pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
#[allow(unused_unsafe)]
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
#[allow(unused_unsafe)]
pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
#[allow(unused_unsafe)]
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };

pub const ABDAY_1: crate::nl_item = 0x20000;
pub const ABDAY_2: crate::nl_item = 0x20001;
Expand Down
Loading