Skip to content

Commit 0bfa976

Browse files
kelnosMabezDev
authored andcommitted
Teach rust core about Xtensa VaListImpl
1 parent dc9c364 commit 0bfa976

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

library/core/src/ffi/mod.rs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl fmt::Debug for c_void {
227227
/// Basic implementation of a `va_list`.
228228
// The name is WIP, using `VaListImpl` for now.
229229
#[cfg(any(
230-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
230+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
231231
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
232232
target_family = "wasm",
233233
target_arch = "asmjs",
@@ -250,7 +250,7 @@ pub struct VaListImpl<'f> {
250250
}
251251

252252
#[cfg(any(
253-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
253+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
254254
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
255255
target_family = "wasm",
256256
target_arch = "asmjs",
@@ -335,6 +335,24 @@ pub struct VaListImpl<'f> {
335335
_marker: PhantomData<&'f mut &'f c_void>,
336336
}
337337

338+
/// xtensa ABI implementation of a `va_list`.
339+
#[cfg(target_arch = "xtensa")]
340+
#[repr(C)]
341+
#[derive(Debug)]
342+
#[unstable(
343+
feature = "c_variadic",
344+
reason = "the `c_variadic` feature has not been properly tested on \
345+
all supported platforms",
346+
issue = "44930"
347+
)]
348+
#[lang = "va_list"]
349+
pub struct VaListImpl<'f> {
350+
stk: *mut i32,
351+
reg: *mut i32,
352+
ndx: i32,
353+
_marker: PhantomData<&'f mut &'f i32>,
354+
}
355+
338356
/// A wrapper for a `va_list`
339357
#[repr(transparent)]
340358
#[derive(Debug)]
@@ -349,7 +367,8 @@ pub struct VaList<'a, 'f: 'a> {
349367
all(
350368
not(target_arch = "aarch64"),
351369
not(target_arch = "powerpc"),
352-
not(target_arch = "x86_64")
370+
not(target_arch = "x86_64"),
371+
not(target_arch = "xtensa")
353372
),
354373
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
355374
target_family = "wasm",
@@ -359,7 +378,7 @@ pub struct VaList<'a, 'f: 'a> {
359378
inner: VaListImpl<'f>,
360379

361380
#[cfg(all(
362-
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
381+
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64", target_arch = "xtensa"),
363382
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
364383
not(target_family = "wasm"),
365384
not(target_arch = "asmjs"),
@@ -371,7 +390,7 @@ pub struct VaList<'a, 'f: 'a> {
371390
}
372391

373392
#[cfg(any(
374-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
393+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
375394
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
376395
target_family = "wasm",
377396
target_arch = "asmjs",
@@ -392,7 +411,7 @@ impl<'f> VaListImpl<'f> {
392411
}
393412

394413
#[cfg(all(
395-
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
414+
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64", target_arch = "xtensa"),
396415
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
397416
not(target_family = "wasm"),
398417
not(target_arch = "asmjs"),

0 commit comments

Comments
 (0)