xref: /third_party/rust/crates/libc/src/switch.rs (revision 2add0d91)
1//! Switch C type definitions
2
3pub type c_schar = i8;
4pub type c_uchar = u8;
5pub type c_short = i16;
6pub type c_ushort = u16;
7pub type c_int = i32;
8pub type c_uint = u32;
9pub type c_float = f32;
10pub type c_double = f64;
11pub type c_longlong = i64;
12pub type c_ulonglong = u64;
13pub type intmax_t = i64;
14pub type uintmax_t = u64;
15
16pub type size_t = usize;
17pub type ptrdiff_t = isize;
18pub type intptr_t = isize;
19pub type uintptr_t = usize;
20pub type ssize_t = isize;
21
22pub type off_t = i64;
23pub type c_char = u8;
24pub type c_long = i64;
25pub type c_ulong = u64;
26pub type wchar_t = u32;
27
28pub const INT_MIN: c_int = -2147483648;
29pub const INT_MAX: c_int = 2147483647;
30
31cfg_if! {
32    if #[cfg(libc_core_cvoid)] {
33        pub use ::ffi::c_void;
34    } else {
35        // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
36        // enable more optimization opportunities around it recognizing things
37        // like malloc/free.
38        #[repr(u8)]
39        #[allow(missing_copy_implementations)]
40        #[allow(missing_debug_implementations)]
41        pub enum c_void {
42            // Two dummy variants so the #[repr] attribute can be used.
43            #[doc(hidden)]
44            __variant1,
45            #[doc(hidden)]
46            __variant2,
47        }
48    }
49}
50