From 7c26cd218de85dca14a1c81b86e9d143626ce036 Mon Sep 17 00:00:00 2001 From: Christian Poveda Ruiz <31802960+pvdrz@users.noreply.github.com> Date: Fri, 4 Nov 2022 10:19:28 -0500 Subject: Add support for the `"C-unwind"` ABI (#2334) * Add support for the `"C-unwind"` ABI This allows using `"C-unwind"` as an ABI override if the rust target is nightly. --- bindgen/codegen/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bindgen/codegen/mod.rs') diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index 4e90102d..d0c19136 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -2483,6 +2483,9 @@ impl MethodCodegen for Method { ClangAbi::Known(Abi::Vectorcall) => { ctx.options().rust_features().vectorcall_abi } + ClangAbi::Known(Abi::CUnwind) => { + ctx.options().rust_features().c_unwind_abi + } _ => true, }; @@ -4009,6 +4012,12 @@ impl TryToRustTy for FunctionSig { warn!("Skipping function with vectorcall ABI that isn't supported by the configured Rust target"); Ok(proc_macro2::TokenStream::new()) } + ClangAbi::Known(Abi::CUnwind) + if !ctx.options().rust_features().c_unwind_abi => + { + warn!("Skipping function with C-unwind ABI that isn't supported by the configured Rust target"); + Ok(proc_macro2::TokenStream::new()) + } _ => Ok(quote! { unsafe extern #abi fn ( #( #arguments ),* ) #ret }), @@ -4120,6 +4129,12 @@ impl CodeGenerator for Function { warn!("Skipping function with vectorcall ABI that isn't supported by the configured Rust target"); return None; } + ClangAbi::Known(Abi::CUnwind) + if !ctx.options().rust_features().c_unwind_abi => + { + warn!("Skipping function with C-unwind ABI that isn't supported by the configured Rust target"); + return None; + } ClangAbi::Known(Abi::Win64) if signature.is_variadic() => { warn!("Skipping variadic function with Win64 ABI that isn't supported"); return None; -- cgit v1.2.3