diff options
Diffstat (limited to 'src/codegen')
-rw-r--r-- | src/codegen/mod.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 94a62b97..6d8e8a9d 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1959,6 +1959,10 @@ impl MethodCodegen for Method { _ => panic!("How in the world?"), }; + if let (Abi::ThisCall, false) = (signature.abi(), ctx.options().rust_features().thiscall_abi()) { + return; + } + // Do not generate variadic methods, since rust does not allow // implementing them, and we don't do a good job at it anyway. if signature.is_variadic() { @@ -3072,9 +3076,17 @@ impl TryToRustTy for FunctionSig { let arguments = utils::fnsig_arguments(ctx, &self); let abi = self.abi(); - Ok(quote! { - unsafe extern #abi fn ( #( #arguments ),* ) #ret - }) + match abi { + Abi::ThisCall if !ctx.options().rust_features().thiscall_abi() => { + warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target"); + Ok(quote::Tokens::new()) + } + _ => { + Ok(quote! { + unsafe extern #abi fn ( #( #arguments ),* ) #ret + }) + } + } } } @@ -3146,6 +3158,10 @@ impl CodeGenerator for Function { } let abi = match signature.abi() { + Abi::ThisCall if !ctx.options().rust_features().thiscall_abi() => { + warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target"); + return; + } Abi::Unknown(unknown_abi) => { panic!( "Invalid or unknown abi {:?} for function {:?} ({:?})", |