diff options
author | Christian Poveda Ruiz <31802960+pvdrz@users.noreply.github.com> | 2022-11-04 10:19:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 10:19:28 -0500 |
commit | 7c26cd218de85dca14a1c81b86e9d143626ce036 (patch) | |
tree | 8443ad2b0fea6c690aa60e09205b9b09b4cf3878 /bindgen/codegen/mod.rs | |
parent | 9c32b460481903d90c6ac5df277bfa853a0558d8 (diff) |
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.
Diffstat (limited to 'bindgen/codegen/mod.rs')
-rw-r--r-- | bindgen/codegen/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
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; |