|
11 | 11 | #[cfg(test)]
|
12 | 12 | mod tests;
|
13 | 13 |
|
14 |
| -#[doc(include = "char.md")] |
| 14 | +macro_rules! type_alias { |
| 15 | + { $Docfile:tt, $Alias:ident = $Real:ty; $( $Cfg:tt )* } => { |
| 16 | + #[doc(include = $Docfile)] |
| 17 | + $( $Cfg )* |
| 18 | + #[stable(feature = "raw_os", since = "1.1.0")] |
| 19 | + pub type $Alias = $Real; |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +type_alias! { "char.md", c_char = u8; |
15 | 24 | #[cfg(any(
|
16 | 25 | all(
|
17 | 26 | target_os = "linux",
|
@@ -52,10 +61,8 @@ mod tests;
|
52 | 61 | )
|
53 | 62 | ),
|
54 | 63 | all(target_os = "fuchsia", target_arch = "aarch64")
|
55 |
| -))] |
56 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
57 |
| -pub type c_char = u8; |
58 |
| -#[doc(include = "char.md")] |
| 64 | +))]} |
| 65 | +type_alias! { "char.md", c_char = i8; |
59 | 66 | #[cfg(not(any(
|
60 | 67 | all(
|
61 | 68 | target_os = "linux",
|
@@ -96,55 +103,21 @@ pub type c_char = u8;
|
96 | 103 | )
|
97 | 104 | ),
|
98 | 105 | all(target_os = "fuchsia", target_arch = "aarch64")
|
99 |
| -)))] |
100 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
101 |
| -pub type c_char = i8; |
102 |
| -#[doc(include = "schar.md")] |
103 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
104 |
| -pub type c_schar = i8; |
105 |
| -#[doc(include = "uchar.md")] |
106 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
107 |
| -pub type c_uchar = u8; |
108 |
| -#[doc(include = "short.md")] |
109 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
110 |
| -pub type c_short = i16; |
111 |
| -#[doc(include = "ushort.md")] |
112 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
113 |
| -pub type c_ushort = u16; |
114 |
| -#[doc(include = "int.md")] |
115 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
116 |
| -pub type c_int = i32; |
117 |
| -#[doc(include = "uint.md")] |
118 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
119 |
| -pub type c_uint = u32; |
120 |
| -#[doc(include = "long.md")] |
121 |
| -#[cfg(any(target_pointer_width = "32", windows))] |
122 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
123 |
| -pub type c_long = i32; |
124 |
| -#[doc(include = "ulong.md")] |
125 |
| -#[cfg(any(target_pointer_width = "32", windows))] |
126 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
127 |
| -pub type c_ulong = u32; |
128 |
| -#[doc(include = "long.md")] |
129 |
| -#[cfg(all(target_pointer_width = "64", not(windows)))] |
130 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
131 |
| -pub type c_long = i64; |
132 |
| -#[doc(include = "ulong.md")] |
133 |
| -#[cfg(all(target_pointer_width = "64", not(windows)))] |
134 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
135 |
| -pub type c_ulong = u64; |
136 |
| -#[doc(include = "longlong.md")] |
137 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
138 |
| -pub type c_longlong = i64; |
139 |
| -#[doc(include = "ulonglong.md")] |
140 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
141 |
| -pub type c_ulonglong = u64; |
142 |
| -#[doc(include = "float.md")] |
143 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
144 |
| -pub type c_float = f32; |
145 |
| -#[doc(include = "double.md")] |
146 |
| -#[stable(feature = "raw_os", since = "1.1.0")] |
147 |
| -pub type c_double = f64; |
| 106 | +)))]} |
| 107 | +type_alias! { "schar.md", c_schar = i8; } |
| 108 | +type_alias! { "uchar.md", c_uchar = u8; } |
| 109 | +type_alias! { "short.md", c_short = i16; } |
| 110 | +type_alias! { "ushort.md", c_ushort = u16; } |
| 111 | +type_alias! { "int.md", c_int = i32; } |
| 112 | +type_alias! { "uint.md", c_uint = u32; } |
| 113 | +type_alias! { "long.md", c_long = i32; #[cfg(any(target_pointer_width = "32", windows))] } |
| 114 | +type_alias! { "ulong.md", c_ulong = u32; #[cfg(any(target_pointer_width = "32", windows))] } |
| 115 | +type_alias! { "long.md", c_long = i64; #[cfg(all(target_pointer_width = "64", not(windows)))] } |
| 116 | +type_alias! { "ulong.md", c_ulong = u64; #[cfg(all(target_pointer_width = "64", not(windows)))] } |
| 117 | +type_alias! { "longlong.md", c_longlong = i64; } |
| 118 | +type_alias! { "ulonglong.md", c_ulonglong = u64; } |
| 119 | +type_alias! { "float.md", c_float = f32; } |
| 120 | +type_alias! { "double.md", c_double = f64; } |
148 | 121 |
|
149 | 122 | #[stable(feature = "raw_os", since = "1.1.0")]
|
150 | 123 | #[doc(no_inline)]
|
|
0 commit comments