Add ABI-compatibility assertion

This commit is contained in:
Gary Guo 2023-08-06 13:27:01 +01:00
parent 8b05b629ae
commit de5dd40a4f

View File

@ -118,7 +118,18 @@ macro_rules! binding {
};
}
#[cfg(not(feature = "unwinder"))]
#[cfg(feature = "unwinder")]
macro_rules! binding {
() => {};
(unsafe extern $abi: literal fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?; $($rest: tt)*) => {
const _: unsafe extern $abi fn($($arg_ty),*) $(-> $ret)? = $name;
};
(extern $abi: literal fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?; $($rest: tt)*) => {
const _: extern $abi fn($($arg_ty),*) $(-> $ret)? = $name;
};
}
binding! {
extern "C" fn _Unwind_GetGR(unwind_ctx: &UnwindContext<'_>, index: c_int) -> usize;
extern "C" fn _Unwind_GetCFA(unwind_ctx: &UnwindContext<'_>) -> usize;