@@ -58,29 +58,25 @@ type_alias! { "c_char.md", c_char = c_char_definition::c_char, NonZero_c_char =
5858// is fixed.
5959#[ cfg( all( ) ) ]
6060#[ doc( cfg( all( ) ) ) ] }
61+
6162type_alias ! { "c_schar.md" , c_schar = i8 , NonZero_c_schar = NonZeroI8 ; }
6263type_alias ! { "c_uchar.md" , c_uchar = u8 , NonZero_c_uchar = NonZeroU8 ; }
6364type_alias ! { "c_short.md" , c_short = i16 , NonZero_c_short = NonZeroI16 ; }
6465type_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+
8277type_alias ! { "c_longlong.md" , c_longlong = i64 , NonZero_c_longlong = NonZeroI64 ; }
8378type_alias ! { "c_ulonglong.md" , c_ulonglong = u64 , NonZero_c_ulonglong = NonZeroU64 ; }
79+
8480type_alias_no_nz ! { "c_float.md" , c_float = f32 ; }
8581type_alias_no_nz ! { "c_double.md" , c_double = f64 ; }
8682
@@ -159,6 +155,39 @@ mod c_char_definition {
159155 }
160156}
161157
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 the C standard is 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+
162191// N.B., for LLVM to recognize the void pointer type and by extension
163192// functions like malloc(), we need to have it represented as i8* in
164193// LLVM bitcode. The enum used here ensures this and prevents misuse
0 commit comments