summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mijalkovic <marko.mijalkovic97@gmail.com>2020-05-06 14:59:48 -0400
committerMarko Mijalkovic <marko.mijalkovic97@gmail.com>2020-05-07 13:42:21 -0400
commit5dfe01320f4a6e88f3a5cafa489c8f5fa1080a00 (patch)
treeb0fe82db1f1a65d05c60ab5e872c54b830421d56
parentbb734e321f3813ce6880115fb53142c2d61da947 (diff)
downloadrust-libc-5dfe01320f4a6e88f3a5cafa489c8f5fa1080a00.tar.gz
Add c typedefs for the Sony PSP
-rw-r--r--src/lib.rs6
-rw-r--r--src/psp.rs47
2 files changed, 53 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 171591ebf5..8c4f6b1d34 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -115,6 +115,12 @@ cfg_if! {
mod switch;
pub use switch::*;
+ } else if #[cfg(target_os = "psp")] {
+ mod fixed_width_ints;
+ pub use fixed_width_ints::*;
+
+ mod psp;
+ pub use psp::*;
} else if #[cfg(target_os = "vxworks")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
diff --git a/src/psp.rs b/src/psp.rs
new file mode 100644
index 0000000000..4b3ec9bd94
--- /dev/null
+++ b/src/psp.rs
@@ -0,0 +1,47 @@
+//! PSP C type definitions
+
+pub type c_schar = i8;
+pub type c_uchar = u8;
+pub type c_short = i16;
+pub type c_ushort = u16;
+pub type c_int = i32;
+pub type c_uint = u32;
+pub type c_float = f32;
+pub type c_double = f64;
+pub type c_longlong = i64;
+pub type c_ulonglong = u64;
+pub type intmax_t = i64;
+pub type uintmax_t = u64;
+
+pub type size_t = usize;
+pub type ptrdiff_t = isize;
+pub type intptr_t = isize;
+pub type uintptr_t = usize;
+pub type ssize_t = isize;
+
+pub type c_char = u8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+
+pub const INT_MIN: c_int = -2147483648;
+pub const INT_MAX: c_int = 2147483647;
+
+cfg_if! {
+ if #[cfg(libc_core_cvoid)] {
+ pub use ::ffi::c_void;
+ } else {
+ // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
+ // enable more optimization opportunities around it recognizing things
+ // like malloc/free.
+ #[repr(u8)]
+ #[allow(missing_copy_implementations)]
+ #[allow(missing_debug_implementations)]
+ pub enum c_void {
+ // Two dummy variants so the #[repr] attribute can be used.
+ #[doc(hidden)]
+ __variant1,
+ #[doc(hidden)]
+ __variant2,
+ }
+ }
+}