From 9c99c16a2dd2d8dc8a0ad316b540f298b933d37e Mon Sep 17 00:00:00 2001
From: Alex Crichton <alex@alexcrichton.com>
Date: Tue, 15 Sep 2015 16:40:08 -0700
Subject: [PATCH] Fix signedness of c_char/c_wchar on ARM linux

---
 src/unix/notbsd/linux/notmips/b32/arm.rs           |  2 ++
 .../notbsd/linux/notmips/{b32.rs => b32/mod.rs}    | 14 ++++++++++++--
 src/unix/notbsd/linux/notmips/b32/x86.rs           |  2 ++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 src/unix/notbsd/linux/notmips/b32/arm.rs
 rename src/unix/notbsd/linux/notmips/{b32.rs => b32/mod.rs} (84%)
 create mode 100644 src/unix/notbsd/linux/notmips/b32/x86.rs

diff --git a/src/unix/notbsd/linux/notmips/b32/arm.rs b/src/unix/notbsd/linux/notmips/b32/arm.rs
new file mode 100644
index 00000000..1a92e3b4
--- /dev/null
+++ b/src/unix/notbsd/linux/notmips/b32/arm.rs
@@ -0,0 +1,2 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
diff --git a/src/unix/notbsd/linux/notmips/b32.rs b/src/unix/notbsd/linux/notmips/b32/mod.rs
similarity index 84%
rename from src/unix/notbsd/linux/notmips/b32.rs
rename to src/unix/notbsd/linux/notmips/b32/mod.rs
index 503ce5e7..6928962c 100644
--- a/src/unix/notbsd/linux/notmips/b32.rs
+++ b/src/unix/notbsd/linux/notmips/b32/mod.rs
@@ -1,6 +1,5 @@
 //! 32-bit specific definitions for linux-like values
 
-pub type c_char = i8;
 pub type c_long = i32;
 pub type c_ulong = u32;
 pub type size_t = u32;
@@ -8,7 +7,6 @@ pub type ptrdiff_t = i32;
 pub type clock_t = i32;
 pub type time_t = i32;
 pub type suseconds_t = i32;
-pub type wchar_t = i32;
 pub type intptr_t = i32;
 pub type uintptr_t = u32;
 pub type ino_t = u32;
@@ -47,3 +45,15 @@ s! {
         __size: [u32; 9]
     }
 }
+
+cfg_if! {
+    if #[cfg(target_arch = "x86")] {
+        mod x86;
+        pub use self::x86::*;
+    } else if #[cfg(target_arch = "arm")] {
+        mod arm;
+        pub use self::arm::*;
+    } else {
+        // ...
+    }
+}
diff --git a/src/unix/notbsd/linux/notmips/b32/x86.rs b/src/unix/notbsd/linux/notmips/b32/x86.rs
new file mode 100644
index 00000000..76ec3ce8
--- /dev/null
+++ b/src/unix/notbsd/linux/notmips/b32/x86.rs
@@ -0,0 +1,2 @@
+pub type c_char = i8;
+pub type wchar_t = i32;
-- 
GitLab