Skip to content

Commit

Permalink
Add ABI-compatibility assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Aug 6, 2023
1 parent 64e71ee commit ec3d9b0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ec3d9b0

Please sign in to comment.