From 174888fd56e75c628ba8fa8664c6e73de55c419f Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Mon, 6 Aug 2018 12:15:45 -0500 Subject: [PATCH 1/2] NetBSD: correct c_char signedness on arm and powerpc --- .../netbsd/{other/b32/mod.rs => arm.rs} | 1 + src/unix/bsd/netbsdlike/netbsd/mod.rs | 23 ++++++++++++++++--- src/unix/bsd/netbsdlike/netbsd/other/mod.rs | 14 ----------- src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 3 +++ .../netbsd/{other/b64/mod.rs => sparc64.rs} | 1 + src/unix/bsd/netbsdlike/netbsd/x86.rs | 3 +++ src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 3 +++ 7 files changed, 31 insertions(+), 17 deletions(-) rename src/unix/bsd/netbsdlike/netbsd/{other/b32/mod.rs => arm.rs} (68%) delete mode 100644 src/unix/bsd/netbsdlike/netbsd/other/mod.rs create mode 100644 src/unix/bsd/netbsdlike/netbsd/powerpc.rs rename src/unix/bsd/netbsdlike/netbsd/{other/b64/mod.rs => sparc64.rs} (68%) create mode 100644 src/unix/bsd/netbsdlike/netbsd/x86.rs create mode 100644 src/unix/bsd/netbsdlike/netbsd/x86_64.rs diff --git a/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs b/src/unix/bsd/netbsdlike/netbsd/arm.rs similarity index 68% rename from src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs rename to src/unix/bsd/netbsdlike/netbsd/arm.rs index 9b0b338b91e5b..377e05be07e17 100644 --- a/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -1,2 +1,3 @@ pub type c_long = i32; pub type c_ulong = u32; +pub type c_char = u8; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 065f6bd36a221..27695fc6c4035 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1,6 +1,5 @@ use dox::mem; -pub type c_char = i8; pub type clock_t = ::c_uint; pub type suseconds_t = ::c_int; pub type dev_t = u64; @@ -1110,5 +1109,23 @@ extern { result: *mut *mut ::group) -> ::c_int; } -mod other; -pub use self::other::*; +cfg_if! { + if #[cfg(target_arch = "arm")] + mod arm; + pub use self::arm::*; + } else if #[cfg(target_arch = "powerpc")] { + mod powerpc; + pub use self::powerpc::*; + } else if #[cfg(target_arch = "sparc64")] { + mod sparc64; + pub use self::sparc64::*; + } else if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } else if #[cfg(target_arch = "x86")] { + mod x86; + pub use self::x86::*; + } else { + // Unknown target_arch + } +} diff --git a/src/unix/bsd/netbsdlike/netbsd/other/mod.rs b/src/unix/bsd/netbsdlike/netbsd/other/mod.rs deleted file mode 100644 index 3a9bf0866c0bc..0000000000000 --- a/src/unix/bsd/netbsdlike/netbsd/other/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -cfg_if! { - if #[cfg(any(target_arch = "sparc64", - target_arch = "x86_64"))] { - mod b64; - pub use self::b64::*; - } else if #[cfg(any(target_arch = "arm", - target_arch = "powerpc", - target_arch = "x86"))] { - mod b32; - pub use self::b32::*; - } else { - // Unknown target_arch - } -} diff --git a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs new file mode 100644 index 0000000000000..377e05be07e17 --- /dev/null +++ b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs @@ -0,0 +1,3 @@ +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = u8; diff --git a/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs b/src/unix/bsd/netbsdlike/netbsd/sparc64.rs similarity index 68% rename from src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs rename to src/unix/bsd/netbsdlike/netbsd/sparc64.rs index b07c476aa49d9..27b94126688fb 100644 --- a/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/sparc64.rs @@ -1,2 +1,3 @@ pub type c_long = i64; pub type c_ulong = u64; +pub type c_char = i8; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86.rs b/src/unix/bsd/netbsdlike/netbsd/x86.rs new file mode 100644 index 0000000000000..a00e3337ef58f --- /dev/null +++ b/src/unix/bsd/netbsdlike/netbsd/x86.rs @@ -0,0 +1,3 @@ +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = i8; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs new file mode 100644 index 0000000000000..27b94126688fb --- /dev/null +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -0,0 +1,3 @@ +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = i8; From 80f2d7d999a78aad0477e53fa04b0fe4f359da35 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Kollasch" Date: Mon, 6 Aug 2018 13:41:04 -0500 Subject: [PATCH 2/2] fix syntax error in previous --- src/unix/bsd/netbsdlike/netbsd/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 27695fc6c4035..b0cf20f65e1cb 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1110,7 +1110,7 @@ extern { } cfg_if! { - if #[cfg(target_arch = "arm")] + if #[cfg(target_arch = "arm")] { mod arm; pub use self::arm::*; } else if #[cfg(target_arch = "powerpc")] {