Skip to content

Commit

Permalink
Correctly handle some consts declaration on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jun 9, 2022
1 parent 576f778 commit 4a84f34
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4682,6 +4682,16 @@ cfg_if! {
const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
}
} else {
fn __DARWIN_ALIGN32(p: usize) -> usize {
let __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
}
}
}

cfg_if! {
if #[cfg(libc_const_size_of)] {
pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t =
(::mem::size_of::<thread_extended_policy_data_t>() / ::mem::size_of::<integer_t>())
as mach_msg_type_number_t;
Expand Down Expand Up @@ -4722,10 +4732,6 @@ cfg_if! {
(::mem::size_of::<vm_statistics64_data_t>() / ::mem::size_of::<integer_t>())
as mach_msg_type_number_t;
} else {
fn __DARWIN_ALIGN32(p: usize) -> usize {
let __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
}
pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t = 1;
pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t = 4;
pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t = 1;
Expand Down

0 comments on commit 4a84f34

Please sign in to comment.