Skip to content

Commit

Permalink
Merge pull request #4065 from tgross35/remove-cfg-ptr-addr-of
Browse files Browse the repository at this point in the history
Drop the `ptr_addr_of` conditional
  • Loading branch information
tgross35 authored Nov 16, 2024
2 parents 805ab65 + 85eac5f commit aca5bb0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
5 changes: 0 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
"libc_const_extern_fn_unstable",
"libc_deny_warnings",
"libc_long_array",
"libc_ptr_addr_of",
"libc_thread_local",
"libc_underscore_const_names",
"libc_ctest",
Expand Down Expand Up @@ -87,10 +86,6 @@ fn main() {
set_cfg("libc_long_array");
}

if rustc_minor_ver >= 51 || rustc_dep_of_std {
set_cfg("libc_ptr_addr_of");
}

// Rust >= 1.37.0 allows underscores as anonymous constant names.
if rustc_minor_ver >= 37 || rustc_dep_of_std {
set_cfg("libc_underscore_const_names");
Expand Down
14 changes: 0 additions & 14 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,3 @@ macro_rules! deprecated_mach {
)*
}
}

#[cfg(not(libc_ptr_addr_of))]
macro_rules! ptr_addr_of {
($place:expr) => {
&$place
};
}

#[cfg(libc_ptr_addr_of)]
macro_rules! ptr_addr_of {
($place:expr) => {
::core::ptr::addr_of!($place)
};
}
8 changes: 4 additions & 4 deletions src/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,16 @@ cfg_if! {
// `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
#[allow(unused_unsafe)]
pub static CLOCK_MONOTONIC: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC));
#[allow(unused_unsafe)]
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID));
#[allow(unused_unsafe)]
pub static CLOCK_REALTIME: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) };
clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME));
#[allow(unused_unsafe)]
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID));
}
}

Expand Down

0 comments on commit aca5bb0

Please sign in to comment.