|
6 | 6 | //!
|
7 | 7 | //! The fixed-width integer aliases are deprecated: use the Rust types instead.
|
8 | 8 |
|
9 |
| -pub type c_schar = i8; |
10 |
| -pub type c_uchar = u8; |
11 |
| -pub type c_short = i16; |
12 |
| -pub type c_ushort = u16; |
13 |
| - |
14 |
| -pub type c_longlong = i64; |
15 |
| -pub type c_ulonglong = u64; |
16 |
| - |
17 |
| -pub type c_float = f32; |
18 |
| -pub type c_double = f64; |
19 |
| - |
20 |
| -cfg_if! { |
21 |
| - if #[cfg(all( |
22 |
| - not(windows), |
23 |
| - // FIXME(ctest): just use `target_vendor` = "apple"` once `ctest` supports it |
24 |
| - not(any( |
25 |
| - target_os = "macos", |
26 |
| - target_os = "ios", |
27 |
| - target_os = "tvos", |
28 |
| - target_os = "watchos", |
29 |
| - target_os = "visionos", |
30 |
| - )), |
31 |
| - not(target_os = "vita"), |
32 |
| - any( |
33 |
| - target_arch = "aarch64", |
34 |
| - target_arch = "arm", |
35 |
| - target_arch = "csky", |
36 |
| - target_arch = "hexagon", |
37 |
| - target_arch = "msp430", |
38 |
| - target_arch = "powerpc", |
39 |
| - target_arch = "powerpc64", |
40 |
| - target_arch = "riscv32", |
41 |
| - target_arch = "riscv64", |
42 |
| - target_arch = "s390x", |
43 |
| - target_arch = "xtensa", |
44 |
| - ) |
45 |
| - ))] { |
46 |
| - pub type c_char = u8; |
47 |
| - } else { |
48 |
| - // On every other target, c_char is signed. |
49 |
| - pub type c_char = i8; |
50 |
| - } |
51 |
| -} |
52 |
| - |
53 |
| -cfg_if! { |
54 |
| - if #[cfg(any(target_arch = "avr", target_arch = "msp430"))] { |
55 |
| - pub type c_int = i16; |
56 |
| - pub type c_uint = u16; |
57 |
| - } else { |
58 |
| - pub type c_int = i32; |
59 |
| - pub type c_uint = u32; |
60 |
| - } |
61 |
| -} |
62 |
| - |
63 |
| -cfg_if! { |
64 |
| - if #[cfg(all(target_pointer_width = "64", not(windows)))] { |
65 |
| - pub type c_long = i64; |
66 |
| - pub type c_ulong = u64; |
67 |
| - } else { |
68 |
| - // The minimal size of `long` in the C standard is 32 bits |
69 |
| - pub type c_long = i32; |
70 |
| - pub type c_ulong = u32; |
71 |
| - } |
72 |
| -} |
| 9 | +// pub type c_schar = i8; |
| 10 | +// pub type c_uchar = u8; |
| 11 | +// pub type c_short = i16; |
| 12 | +// pub type c_ushort = u16; |
| 13 | +// |
| 14 | +// pub type c_longlong = i64; |
| 15 | +// pub type c_ulonglong = u64; |
| 16 | +// |
| 17 | +// pub type c_float = f32; |
| 18 | +// pub type c_double = f64; |
| 19 | +// |
| 20 | +// cfg_if! { |
| 21 | +// if #[cfg(all( |
| 22 | +// not(windows), |
| 23 | +// // FIXME(ctest): just use `target_vendor` = "apple"` once `ctest` supports it |
| 24 | +// not(any( |
| 25 | +// target_os = "macos", |
| 26 | +// target_os = "ios", |
| 27 | +// target_os = "tvos", |
| 28 | +// target_os = "watchos", |
| 29 | +// target_os = "visionos", |
| 30 | +// )), |
| 31 | +// not(target_os = "vita"), |
| 32 | +// any( |
| 33 | +// target_arch = "aarch64", |
| 34 | +// target_arch = "arm", |
| 35 | +// target_arch = "csky", |
| 36 | +// target_arch = "hexagon", |
| 37 | +// target_arch = "msp430", |
| 38 | +// target_arch = "powerpc", |
| 39 | +// target_arch = "powerpc64", |
| 40 | +// target_arch = "riscv32", |
| 41 | +// target_arch = "riscv64", |
| 42 | +// target_arch = "s390x", |
| 43 | +// target_arch = "xtensa", |
| 44 | +// ) |
| 45 | +// ))] { |
| 46 | +// pub type c_char = u8; |
| 47 | +// } else { |
| 48 | +// // On every other target, c_char is signed. |
| 49 | +// pub type c_char = i8; |
| 50 | +// } |
| 51 | +// } |
| 52 | +// |
| 53 | +// cfg_if! { |
| 54 | +// if #[cfg(any(target_arch = "avr", target_arch = "msp430"))] { |
| 55 | +// pub type c_int = i16; |
| 56 | +// pub type c_uint = u16; |
| 57 | +// } else { |
| 58 | +// pub type c_int = i32; |
| 59 | +// pub type c_uint = u32; |
| 60 | +// } |
| 61 | +// } |
| 62 | +// |
| 63 | +// cfg_if! { |
| 64 | +// if #[cfg(all(target_pointer_width = "64", not(windows)))] { |
| 65 | +// pub type c_long = i64; |
| 66 | +// pub type c_ulong = u64; |
| 67 | +// } else { |
| 68 | +// // The minimal size of `long` in the C standard is 32 bits |
| 69 | +// pub type c_long = i32; |
| 70 | +// pub type c_ulong = u32; |
| 71 | +// } |
| 72 | +// } |
73 | 73 |
|
74 | 74 | #[deprecated(since = "0.2.55", note = "Use i8 instead.")]
|
75 | 75 | pub type int8_t = i8;
|
@@ -186,3 +186,10 @@ cfg_if! {
|
186 | 186 | pub type __uint128_t = u128;
|
187 | 187 | }
|
188 | 188 | }
|
| 189 | + |
| 190 | +// Re-export rust core::ffi c perimitive types |
| 191 | +#[allow(unused_imports)] |
| 192 | +pub use core::ffi::{ |
| 193 | + c_char, c_double, c_float, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, |
| 194 | + c_ulong, c_ulonglong, c_ushort, |
| 195 | +}; |
0 commit comments