• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // libc port for HermitCore (https://hermitcore.org)
2 //
3 // Ported by Colin Fink <colin.finck@rwth-aachen.de>
4 //       and Stefan Lankes <slankes@eonerc.rwth-aachen.de>
5 
6 pub type c_schar = i8;
7 pub type c_uchar = u8;
8 pub type c_short = i16;
9 pub type c_ushort = u16;
10 pub type c_int = i32;
11 pub type c_uint = u32;
12 pub type c_float = f32;
13 pub type c_double = f64;
14 pub type c_longlong = i64;
15 pub type c_ulonglong = u64;
16 pub type intmax_t = i64;
17 pub type uintmax_t = u64;
18 
19 pub type size_t = usize;
20 pub type ptrdiff_t = isize;
21 pub type intptr_t = isize;
22 pub type uintptr_t = usize;
23 pub type ssize_t = isize;
24 
25 pub type c_long = i64;
26 pub type c_ulong = u64;
27 
28 pub type wint_t = u32;
29 pub type wctype_t = i64;
30 
31 pub type regoff_t = size_t;
32 pub type off_t = c_long;
33 
34 cfg_if! {
35     if #[cfg(target_arch = "aarch64")] {
36         mod aarch64;
37         pub use self::aarch64::*;
38     } else if #[cfg(target_arch = "x86_64")] {
39         mod x86_64;
40         pub use self::x86_64::*;
41     } else {
42         // Unknown target_arch
43     }
44 }
45 
46 cfg_if! {
47     if #[cfg(libc_core_cvoid)] {
48         pub use ::ffi::c_void;
49     } else {
50         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
51         // enable more optimization opportunities around it recognizing things
52         // like malloc/free.
53         #[repr(u8)]
54         #[allow(missing_copy_implementations)]
55         #[allow(missing_debug_implementations)]
56         pub enum c_void {
57             // Two dummy variants so the #[repr] attribute can be used.
58             #[doc(hidden)]
59             __variant1,
60             #[doc(hidden)]
61             __variant2,
62         }
63     }
64 }
65