Skip to content

Commit 7cc0708

Browse files
nicholasbishopphip1611
authored andcommitted
xtask: Allow non-efiapi C-variadic function pointers
1 parent 554eb14 commit 7cc0708

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

xtask/src/check_raw.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ fn check_type(ty: &Type, src: &Path) -> Result<(), Error> {
208208

209209
/// Validate a function pointer.
210210
fn check_fn_ptr(f: &TypeBareFn, src: &Path) -> Result<(), Error> {
211-
// Require `extern efiapi`.
212-
if !is_efiapi(f) {
211+
// Require `extern efiapi`, except for c-variadics.
212+
if !is_efiapi(f) && f.variadic.is_none() {
213213
return Err(Error::new(ErrorKind::ForbiddenAbi, src, f));
214214
}
215215

@@ -433,6 +433,15 @@ mod tests {
433433
)
434434
.is_ok());
435435

436+
// Valid fn ptr with c-variadics.
437+
assert!(check_fn_ptr(
438+
&parse_quote! {
439+
unsafe extern "C" fn(usize, ...)
440+
},
441+
src(),
442+
)
443+
.is_ok());
444+
436445
// Not `extern efiapi`.
437446
check_fn_err(
438447
parse_quote! {

0 commit comments

Comments
 (0)