File tree Expand file tree Collapse file tree 2 files changed +22
-36
lines changed Expand file tree Collapse file tree 2 files changed +22
-36
lines changed Original file line number Diff line number Diff line change @@ -101,31 +101,35 @@ extern crate std as core;
101101#[ macro_use] mod macros;
102102mod dox;
103103
104+ /*
105+ * `c_void` should be defined for all targets except wasm.
106+ */
107+ #[ cfg( not( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ) ]
108+ cfg_if ! {
109+ if #[ cfg( core_cvoid) ] {
110+ pub use core:: ffi:: c_void;
111+ } else {
112+ // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
113+ // more optimization opportunities around it recognizing things like
114+ // malloc/free.
115+ #[ repr( u8 ) ]
116+ pub enum c_void {
117+ // Two dummy variants so the #[repr] attribute can be used.
118+ #[ doc( hidden) ]
119+ __variant1,
120+ #[ doc( hidden) ]
121+ __variant2,
122+ }
123+ }
124+ }
125+
104126cfg_if ! {
105127 if #[ cfg( all( target_arch = "wasm32" , not( target_os = "emscripten" ) ) ) ] {
106128 // empty ...
107129 } else if #[ cfg( target_os = "switch" ) ] {
108130 // On the Switch, we only define some useful universal types for
109131 // convenience. Those can be found in the switch.rs file.
110132 } else {
111- cfg_if! {
112- if #[ cfg( core_cvoid) ] {
113- pub use core:: ffi:: c_void;
114- } else {
115- // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
116- // more optimization opportunities around it recognizing things like
117- // malloc/free.
118- #[ repr( u8 ) ]
119- pub enum c_void {
120- // Two dummy variants so the #[repr] attribute can be used.
121- #[ doc( hidden) ]
122- __variant1,
123- #[ doc( hidden) ]
124- __variant2,
125- }
126- }
127- }
128-
129133 pub type int8_t = i8 ;
130134 pub type int16_t = i16 ;
131135 pub type int32_t = i32 ;
Original file line number Diff line number Diff line change @@ -34,21 +34,3 @@ pub type c_char = u8;
3434pub type c_long = i64 ;
3535pub type c_ulong = u64 ;
3636pub type wchar_t = u32 ;
37-
38- cfg_if ! {
39- if #[ cfg( core_cvoid) ] {
40- pub use core:: ffi:: c_void;
41- } else {
42- // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
43- // enable more optimization opportunities around it recognizing things
44- // like malloc/free.
45- #[ repr( u8 ) ]
46- pub enum c_void {
47- // Two dummy variants so the #[repr] attribute can be used.
48- #[ doc( hidden) ]
49- __variant1,
50- #[ doc( hidden) ]
51- __variant2,
52- }
53- }
54- }
You can’t perform that action at this time.
0 commit comments