From dfee17f1ff58db3f9b682554bd479de4363efac6 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sun, 15 Apr 2018 14:50:00 +0200 Subject: [PATCH] fix this for stdbuild only --- libc-test/build.rs | 5 +++++ src/lib.rs | 2 +- src/unix/bsd/apple/mod.rs | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 9805ef0e..74a0b4b1 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -416,6 +416,11 @@ fn main() { // which is absent in glibc, has to be defined. "__timeval" if linux => true, + // Fixed on stdbuild with repr(packed(4)) + // Once repr_packed stabilizes we can fix this unconditionally + // and remove this check. + "kevent" | "shmid_ds" if apple && x86_64 => true, + // This is actually a union, not a struct "sigval" => true, diff --git a/src/lib.rs b/src/lib.rs index 25554806..877e87dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,7 +87,7 @@ // Attributes needed when building as part of the standard library #![cfg_attr(feature = "stdbuild", feature(no_std, staged_api, custom_attribute, cfg_target_vendor))] -#![cfg_attr(feature = "stdbuild", feature(link_cfg))] +#![cfg_attr(feature = "stdbuild", feature(link_cfg, repr_packed))] #![cfg_attr(feature = "stdbuild", no_std)] #![cfg_attr(feature = "stdbuild", staged_api)] #![cfg_attr(feature = "stdbuild", allow(warnings))] diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 00110e13..8fb1a125 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -245,7 +245,7 @@ s! { pub f_reserved: [::uint32_t; 8], } - #[repr(packed(4))] + #[cfg_attr(feature = "stdbuild", repr(packed(4)))] pub struct kevent { pub ident: ::uintptr_t, pub filter: ::int16_t, @@ -524,7 +524,7 @@ s! { pub _key: ::key_t, } - #[repr(packed(4))] + #[cfg_attr(feature = "stdbuild", repr(packed(4)))] pub struct shmid_ds { pub shm_perm: ipc_perm, pub shm_segsz: ::size_t,