@@ -58,29 +58,25 @@ type_alias! { "c_char.md", c_char = c_char_definition::c_char, NonZero_c_char =
58
58
// is fixed.
59
59
#[ cfg( all( ) ) ]
60
60
#[ doc( cfg( all( ) ) ) ] }
61
+
61
62
type_alias ! { "c_schar.md" , c_schar = i8 , NonZero_c_schar = NonZeroI8 ; }
62
63
type_alias ! { "c_uchar.md" , c_uchar = u8 , NonZero_c_uchar = NonZeroU8 ; }
63
64
type_alias ! { "c_short.md" , c_short = i16 , NonZero_c_short = NonZeroI16 ; }
64
65
type_alias ! { "c_ushort.md" , c_ushort = u16 , NonZero_c_ushort = NonZeroU16 ; }
65
- #[ cfg( any( target_arch = "avr" , target_arch = "msp430" ) ) ]
66
- type_alias ! { "c_int.md" , c_int = i16 , NonZero_c_int = NonZeroI16 ; }
67
- #[ cfg( not( any( target_arch = "avr" , target_arch = "msp430" ) ) ) ]
68
- type_alias ! { "c_int.md" , c_int = i32 , NonZero_c_int = NonZeroI32 ; }
69
- type_alias ! { "c_uint.md" , c_uint = u32 , NonZero_c_uint = NonZeroU32 ; }
70
- type_alias ! { "c_long.md" , c_long = i32 , NonZero_c_long = NonZeroI32 ;
71
- #[ doc( cfg( all( ) ) ) ]
72
- #[ cfg( any( target_pointer_width = "32" , windows) ) ] }
73
- type_alias ! { "c_ulong.md" , c_ulong = u32 , NonZero_c_ulong = NonZeroU32 ;
74
- #[ doc( cfg( all( ) ) ) ]
75
- #[ cfg( any( target_pointer_width = "32" , windows) ) ] }
76
- type_alias ! { "c_long.md" , c_long = i64 , NonZero_c_long = NonZeroI64 ;
77
- #[ doc( cfg( all( ) ) ) ]
78
- #[ cfg( all( target_pointer_width = "64" , not( windows) ) ) ] }
79
- type_alias ! { "c_ulong.md" , c_ulong = u64 , NonZero_c_ulong = NonZeroU64 ;
80
- #[ doc( cfg( all( ) ) ) ]
81
- #[ cfg( all( target_pointer_width = "64" , not( windows) ) ) ] }
66
+
67
+ type_alias ! { "c_int.md" , c_int = c_int_definition:: c_int, NonZero_c_int = c_int_definition:: NonZero_c_int ;
68
+ #[ doc( cfg( all( ) ) ) ] }
69
+ type_alias ! { "c_uint.md" , c_uint = c_int_definition:: c_uint, NonZero_c_uint = c_int_definition:: NonZero_c_uint ;
70
+ #[ doc( cfg( all( ) ) ) ] }
71
+
72
+ type_alias ! { "c_long.md" , c_long = c_long_definition:: c_long, NonZero_c_long = c_long_definition:: NonZero_c_long ;
73
+ #[ doc( cfg( all( ) ) ) ] }
74
+ type_alias ! { "c_ulong.md" , c_ulong = c_long_definition:: c_ulong, NonZero_c_ulong = c_long_definition:: NonZero_c_ulong ;
75
+ #[ doc( cfg( all( ) ) ) ] }
76
+
82
77
type_alias ! { "c_longlong.md" , c_longlong = i64 , NonZero_c_longlong = NonZeroI64 ; }
83
78
type_alias ! { "c_ulonglong.md" , c_ulonglong = u64 , NonZero_c_ulonglong = NonZeroU64 ; }
79
+
84
80
type_alias_no_nz ! { "c_float.md" , c_float = f32 ; }
85
81
type_alias_no_nz ! { "c_double.md" , c_double = f64 ; }
86
82
@@ -159,6 +155,39 @@ mod c_char_definition {
159
155
}
160
156
}
161
157
158
+ mod c_int_definition {
159
+ cfg_if ! {
160
+ if #[ cfg( any( target_arch = "avr" , target_arch = "msp430" ) ) ] {
161
+ pub type c_int = i16 ;
162
+ pub type NonZero_c_int = crate :: num:: NonZeroI16 ;
163
+ pub type c_uint = u16 ;
164
+ pub type NonZero_c_uint = crate :: num:: NonZeroU16 ;
165
+ } else {
166
+ pub type c_int = i32 ;
167
+ pub type NonZero_c_int = crate :: num:: NonZeroI32 ;
168
+ pub type c_uint = u32 ;
169
+ pub type NonZero_c_uint = crate :: num:: NonZeroU32 ;
170
+ }
171
+ }
172
+ }
173
+
174
+ mod c_long_definition {
175
+ cfg_if ! {
176
+ if #[ cfg( all( target_pointer_width = "64" , not( windows) ) ) ] {
177
+ pub type c_long = i64 ;
178
+ pub type NonZero_c_long = crate :: num:: NonZeroI64 ;
179
+ pub type c_ulong = u64 ;
180
+ pub type NonZero_c_ulong = crate :: num:: NonZeroU64 ;
181
+ } else {
182
+ // The minimal size of `long` in c standard are 32 bits
183
+ pub type c_long = i32 ;
184
+ pub type NonZero_c_long = crate :: num:: NonZeroI32 ;
185
+ pub type c_ulong = u32 ;
186
+ pub type NonZero_c_ulong = crate :: num:: NonZeroU32 ;
187
+ }
188
+ }
189
+ }
190
+
162
191
// N.B., for LLVM to recognize the void pointer type and by extension
163
192
// functions like malloc(), we need to have it represented as i8* in
164
193
// LLVM bitcode. The enum used here ensures this and prevents misuse
0 commit comments