Skip to content

Commit e40df6d

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. (backport <rust-lang#4713>) (cherry picked from commit 4f2c41a)
1 parent 0a99954 commit e40df6d

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
@@ -19,7 +19,6 @@ const ALLOWED_CFGS: &[&str] = &[
1919
"gnu_time_bits64",
2020
"libc_deny_warnings",
2121
"libc_thread_local",
22-
"libc_ctest",
2322
// Corresponds to `__USE_TIME_BITS64` in UAPI
2423
"linux_time_bits64",
2524
"musl_v1_2_3",

libc-test/build.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,11 +1795,6 @@ fn test_wasi(target: &str) {
17951795
"wchar.h",
17961796
}
17971797

1798-
// Currently `ctest2` doesn't support macros-in-static-expressions and will
1799-
// panic on them. That affects `CLOCK_*` defines in wasi to set this here
1800-
// to omit them.
1801-
cfg.cfg("libc_ctest", None);
1802-
18031798
cfg.rename_struct_ty(move |ty| match ty {
18041799
"FILE" | "fd_set" | "DIR" => Some(ty.to_string()),
18051800
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-
// `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
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+
// FIXME(msrv): `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
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)