Skip to content

Commit e5fd4ee

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 cac66e6 commit e5fd4ee

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const ALLOWED_CFGS: &[&str] = &[
2020
// FIXME(ctest): this config shouldn't be needed but ctest can't parse `const extern fn`
2121
"libc_const_extern_fn",
2222
"libc_deny_warnings",
23-
"libc_ctest",
2423
// Corresponds to `__USE_TIME_BITS64` in UAPI
2524
"linux_time_bits64",
2625
"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: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -361,26 +361,19 @@ 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 =
367+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
368+
#[allow(unused_unsafe)]
369+
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
370+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
371+
#[allow(unused_unsafe)]
372+
pub static CLOCK_REALTIME: clockid_t =
373+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
374+
#[allow(unused_unsafe)]
375+
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
376+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
384377

385378
pub const ABDAY_1: crate::nl_item = 0x20000;
386379
pub const ABDAY_2: crate::nl_item = 0x20001;

0 commit comments

Comments
 (0)