@@ -49,10 +49,8 @@ impl fmt::Debug for c_void {
49
49
/// Basic implementation of a `va_list`.
50
50
// The name is WIP, using `VaListImpl` for now.
51
51
#[ cfg( any( all( not( target_arch = "aarch64" ) , not( target_arch = "powerpc" ) ,
52
- not( target_arch = "x86_64" ) ) ,
52
+ not( target_arch = "x86_64" ) , not ( target_arch = "asmjs" ) ) ,
53
53
all( target_arch = "aarch64" , target_os = "ios" ) ,
54
- target_arch = "wasm32" ,
55
- target_arch = "asmjs" ,
56
54
windows) ) ]
57
55
#[ repr( transparent) ]
58
56
#[ unstable( feature = "c_variadic" ,
@@ -69,10 +67,8 @@ pub struct VaListImpl<'f> {
69
67
}
70
68
71
69
#[ cfg( any( all( not( target_arch = "aarch64" ) , not( target_arch = "powerpc" ) ,
72
- not( target_arch = "x86_64" ) ) ,
70
+ not( target_arch = "x86_64" ) , not ( target_arch = "asmjs" ) ) ,
73
71
all( target_arch = "aarch64" , target_os = "ios" ) ,
74
- target_arch = "wasm32" ,
75
- target_arch = "asmjs" ,
76
72
windows) ) ]
77
73
#[ unstable( feature = "c_variadic" ,
78
74
reason = "the `c_variadic` feature has not been properly tested on \
@@ -141,6 +137,38 @@ pub struct VaListImpl<'f> {
141
137
_marker : PhantomData < & ' f mut & ' f c_void > ,
142
138
}
143
139
140
+ /// asm.js ABI implementation of a `va_list`.
141
+ // asm.js uses the PNaCl ABI, which specifies that a `va_list` is
142
+ // an array of 4 32-bit integers, according to the old PNaCl docs at
143
+ // https://web.archive.org/web/20130518054430/https://www.chromium.org/nativeclient/pnacl/bitcode-abi#TOC-Derived-Types
144
+ // and clang does the same in `CreatePNaClABIBuiltinVaListDecl` from `lib/AST/ASTContext.cpp`
145
+ #[ cfg( all( target_arch = "asmjs" , not( windows) ) ) ]
146
+ #[ repr( C ) ]
147
+ #[ unstable( feature = "c_variadic" ,
148
+ reason = "the `c_variadic` feature has not been properly tested on \
149
+ all supported platforms",
150
+ issue = "44930" ) ]
151
+ #[ lang = "va_list" ]
152
+ pub struct VaListImpl < ' f > {
153
+ inner : [ crate :: mem:: MaybeUninit < i32 > ; 4 ] ,
154
+ _marker : PhantomData < & ' f mut & ' f c_void > ,
155
+ }
156
+
157
+ #[ cfg( all( target_arch = "asmjs" , not( windows) ) ) ]
158
+ #[ unstable( feature = "c_variadic" ,
159
+ reason = "the `c_variadic` feature has not been properly tested on \
160
+ all supported platforms",
161
+ issue = "44930" ) ]
162
+ impl < ' f > fmt:: Debug for VaListImpl < ' f > {
163
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
164
+ unsafe {
165
+ write ! ( f, "va_list* [{:#x}, {:#x}, {:#x}, {:#x}]" ,
166
+ self . inner[ 0 ] . read( ) , self . inner[ 1 ] . read( ) ,
167
+ self . inner[ 2 ] . read( ) , self . inner[ 3 ] . read( ) )
168
+ }
169
+ }
170
+ }
171
+
144
172
/// A wrapper for a `va_list`
145
173
#[ repr( transparent) ]
146
174
#[ derive( Debug ) ]
@@ -150,29 +178,23 @@ pub struct VaListImpl<'f> {
150
178
issue = "44930" ) ]
151
179
pub struct VaList < ' a , ' f : ' a > {
152
180
#[ cfg( any( all( not( target_arch = "aarch64" ) , not( target_arch = "powerpc" ) ,
153
- not( target_arch = "x86_64" ) ) ,
181
+ not( target_arch = "x86_64" ) , not ( target_arch = "asmjs" ) ) ,
154
182
all( target_arch = "aarch64" , target_os = "ios" ) ,
155
- target_arch = "wasm32" ,
156
- target_arch = "asmjs" ,
157
183
windows) ) ]
158
184
inner : VaListImpl < ' f > ,
159
185
160
186
#[ cfg( all( any( target_arch = "aarch64" , target_arch = "powerpc" ,
161
- target_arch = "x86_64" ) ,
187
+ target_arch = "x86_64" , target_arch = "asmjs" ) ,
162
188
any( not( target_arch = "aarch64" ) , not( target_os = "ios" ) ) ,
163
- not( target_arch = "wasm32" ) ,
164
- not( target_arch = "asmjs" ) ,
165
189
not( windows) ) ) ]
166
190
inner : & ' a mut VaListImpl < ' f > ,
167
191
168
192
_marker : PhantomData < & ' a mut VaListImpl < ' f > > ,
169
193
}
170
194
171
195
#[ cfg( any( all( not( target_arch = "aarch64" ) , not( target_arch = "powerpc" ) ,
172
- not( target_arch = "x86_64" ) ) ,
196
+ not( target_arch = "x86_64" ) , not ( target_arch = "asmjs" ) ) ,
173
197
all( target_arch = "aarch64" , target_os = "ios" ) ,
174
- target_arch = "wasm32" ,
175
- target_arch = "asmjs" ,
176
198
windows) ) ]
177
199
#[ unstable( feature = "c_variadic" ,
178
200
reason = "the `c_variadic` feature has not been properly tested on \
@@ -190,10 +212,8 @@ impl<'f> VaListImpl<'f> {
190
212
}
191
213
192
214
#[ cfg( all( any( target_arch = "aarch64" , target_arch = "powerpc" ,
193
- target_arch = "x86_64" ) ,
215
+ target_arch = "x86_64" , target_arch = "asmjs" ) ,
194
216
any( not( target_arch = "aarch64" ) , not( target_os = "ios" ) ) ,
195
- not( target_arch = "wasm32" ) ,
196
- not( target_arch = "asmjs" ) ,
197
217
not( windows) ) ) ]
198
218
#[ unstable( feature = "c_variadic" ,
199
219
reason = "the `c_variadic` feature has not been properly tested on \
0 commit comments