Skip to content

Commit c051584

Browse files
kelnosMabezDev
authored andcommitted
Teach rust core about Xtensa VaListImpl
1 parent 0e8aacc commit c051584

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

library/core/src/ffi.rs

+25-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl fmt::Debug for c_void {
6161
/// Basic implementation of a `va_list`.
6262
// The name is WIP, using `VaListImpl` for now.
6363
#[cfg(any(
64-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
64+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
6565
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
6666
target_arch = "wasm32",
6767
target_arch = "asmjs",
@@ -84,7 +84,7 @@ pub struct VaListImpl<'f> {
8484
}
8585

8686
#[cfg(any(
87-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
87+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
8888
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
8989
target_arch = "wasm32",
9090
target_arch = "asmjs",
@@ -169,6 +169,24 @@ pub struct VaListImpl<'f> {
169169
_marker: PhantomData<&'f mut &'f c_void>,
170170
}
171171

172+
/// xtensa ABI implementation of a `va_list`.
173+
#[cfg(target_arch = "xtensa")]
174+
#[repr(C)]
175+
#[derive(Debug)]
176+
#[unstable(
177+
feature = "c_variadic",
178+
reason = "the `c_variadic` feature has not been properly tested on \
179+
all supported platforms",
180+
issue = "44930"
181+
)]
182+
#[lang = "va_list"]
183+
pub struct VaListImpl<'f> {
184+
stk: *mut i32,
185+
reg: *mut i32,
186+
ndx: i32,
187+
_marker: PhantomData<&'f mut &'f i32>,
188+
}
189+
172190
/// A wrapper for a `va_list`
173191
#[repr(transparent)]
174192
#[derive(Debug)]
@@ -183,7 +201,8 @@ pub struct VaList<'a, 'f: 'a> {
183201
all(
184202
not(target_arch = "aarch64"),
185203
not(target_arch = "powerpc"),
186-
not(target_arch = "x86_64")
204+
not(target_arch = "x86_64"),
205+
not(target_arch = "xtensa")
187206
),
188207
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
189208
target_arch = "wasm32",
@@ -193,7 +212,7 @@ pub struct VaList<'a, 'f: 'a> {
193212
inner: VaListImpl<'f>,
194213

195214
#[cfg(all(
196-
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
215+
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64", target_arch = "xtensa"),
197216
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
198217
not(target_arch = "wasm32"),
199218
not(target_arch = "asmjs"),
@@ -205,7 +224,7 @@ pub struct VaList<'a, 'f: 'a> {
205224
}
206225

207226
#[cfg(any(
208-
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64")),
227+
all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), not(target_arch = "x86_64"), not(target_arch = "xtensa")),
209228
all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios")),
210229
target_arch = "wasm32",
211230
target_arch = "asmjs",
@@ -226,7 +245,7 @@ impl<'f> VaListImpl<'f> {
226245
}
227246

228247
#[cfg(all(
229-
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"),
248+
any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64", target_arch = "xtensa"),
230249
any(not(target_arch = "aarch64"), not(any(target_os = "macos", target_os = "ios"))),
231250
not(target_arch = "wasm32"),
232251
not(target_arch = "asmjs"),

0 commit comments

Comments
 (0)