Skip to content

Commit 4f2c41a

Browse files
committed
Remove the libc_ctest feature
This was a workaround for the old ctest not being able to parse something related to the `addr_of!` macros in statics referencing statics. This is not needed with the new ctest; thus, remove the config.
1 parent 4894081 commit 4f2c41a

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const ALLOWED_CFGS: &[&str] = &[
1818
// Corresponds to `_TIME_BITS=64` in glibc
1919
"gnu_time_bits64",
2020
"libc_deny_warnings",
21-
"libc_ctest",
2221
// Corresponds to `__USE_TIME_BITS64` in UAPI
2322
"linux_time_bits64",
2423
"musl_v1_2_3",

libc-test/build.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,11 +1694,6 @@ fn test_wasi(target: &str) {
16941694
"wchar.h",
16951695
}
16961696

1697-
// Currently `ctest` doesn't support macros-in-static-expressions and will
1698-
// panic on them. That affects `CLOCK_*` defines in wasi to set this here
1699-
// to omit them.
1700-
cfg.cfg("libc_ctest", None);
1701-
17021697
cfg.rename_struct_ty(move |ty| match ty {
17031698
"FILE" | "fd_set" | "DIR" => Some(ty.to_string()),
17041699
t if t.ends_with("_t") => Some(t.to_string()),

src/wasi/mod.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -361,26 +361,17 @@ pub const _SC_PAGE_SIZE: c_int = _SC_PAGESIZE;
361361
pub const _SC_IOV_MAX: c_int = 60;
362362
pub const _SC_SYMLOOP_MAX: c_int = 173;
363363

364-
cfg_if! {
365-
if #[cfg(libc_ctest)] {
366-
// skip these constants when this is active because `ctest` currently
367-
// panics on parsing the constants below
368-
} else {
369-
// unsafe code here is required in the stable, but not in nightly
370-
#[allow(unused_unsafe)]
371-
pub static CLOCK_MONOTONIC: clockid_t =
372-
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
373-
#[allow(unused_unsafe)]
374-
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
375-
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
376-
#[allow(unused_unsafe)]
377-
pub static CLOCK_REALTIME: clockid_t =
378-
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
379-
#[allow(unused_unsafe)]
380-
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
381-
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
382-
}
383-
}
364+
// unsafe code here is required in the stable, but not in nightly
365+
#[allow(unused_unsafe)]
366+
pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
367+
#[allow(unused_unsafe)]
368+
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
369+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
370+
#[allow(unused_unsafe)]
371+
pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
372+
#[allow(unused_unsafe)]
373+
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
374+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
384375

385376
pub const ABDAY_1: crate::nl_item = 0x20000;
386377
pub const ABDAY_2: crate::nl_item = 0x20001;

0 commit comments

Comments
 (0)