Adjust binding macro
This commit is contained in:
parent
7477bc5b6f
commit
8b05b629ae
37
src/abi.rs
37
src/abi.rs
@ -97,17 +97,24 @@ pub type PersonalityRoutine = unsafe extern "C" fn(
|
|||||||
|
|
||||||
#[cfg(not(feature = "unwinder"))]
|
#[cfg(not(feature = "unwinder"))]
|
||||||
macro_rules! binding {
|
macro_rules! binding {
|
||||||
($(extern $abi: literal $([$t:tt])? fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?;)*) => {
|
() => {};
|
||||||
$(
|
(unsafe extern $abi: literal fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?; $($rest: tt)*) => {
|
||||||
#[allow(non_snake_case)]
|
extern $abi {
|
||||||
#[inline]
|
pub fn $name($($arg: $arg_ty),*) $(-> $ret)?;
|
||||||
pub $($t)? fn $name($($arg: $arg_ty),*) $(-> $ret)? {
|
}
|
||||||
extern $abi {
|
binding!($($rest)*);
|
||||||
fn $name($($arg: $arg_ty),*) $(-> $ret)?;
|
};
|
||||||
}
|
|
||||||
unsafe { $name($($arg),*) }
|
(extern $abi: literal fn $name: ident ($($arg: ident : $arg_ty: ty),*$(,)?) $(-> $ret: ty)?; $($rest: tt)*) => {
|
||||||
|
#[allow(non_snake_case)]
|
||||||
|
#[inline]
|
||||||
|
pub fn $name($($arg: $arg_ty),*) $(-> $ret)? {
|
||||||
|
extern $abi {
|
||||||
|
fn $name($($arg: $arg_ty),*) $(-> $ret)?;
|
||||||
}
|
}
|
||||||
)*
|
unsafe { $name($($arg),*) }
|
||||||
|
}
|
||||||
|
binding!($($rest)*);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,19 +141,19 @@ binding! {
|
|||||||
extern "C" fn _Unwind_GetTextRelBase(unwind_ctx: &UnwindContext<'_>) -> usize;
|
extern "C" fn _Unwind_GetTextRelBase(unwind_ctx: &UnwindContext<'_>) -> usize;
|
||||||
extern "C" fn _Unwind_GetDataRelBase(unwind_ctx: &UnwindContext<'_>) -> usize;
|
extern "C" fn _Unwind_GetDataRelBase(unwind_ctx: &UnwindContext<'_>) -> usize;
|
||||||
extern "C" fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void;
|
extern "C" fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void;
|
||||||
extern "C-unwind" [unsafe] fn _Unwind_RaiseException(
|
unsafe extern "C-unwind" fn _Unwind_RaiseException(
|
||||||
exception: *mut UnwindException,
|
exception: *mut UnwindException,
|
||||||
) -> UnwindReasonCode;
|
) -> UnwindReasonCode;
|
||||||
extern "C-unwind" [unsafe] fn _Unwind_ForcedUnwind(
|
unsafe extern "C-unwind" fn _Unwind_ForcedUnwind(
|
||||||
exception: *mut UnwindException,
|
exception: *mut UnwindException,
|
||||||
stop: UnwindStopFn,
|
stop: UnwindStopFn,
|
||||||
stop_arg: *mut c_void,
|
stop_arg: *mut c_void,
|
||||||
) -> UnwindReasonCode;
|
) -> UnwindReasonCode;
|
||||||
extern "C-unwind" [unsafe] fn _Unwind_Resume(exception: *mut UnwindException) -> !;
|
unsafe extern "C-unwind" fn _Unwind_Resume(exception: *mut UnwindException) -> !;
|
||||||
extern "C-unwind" [unsafe] fn _Unwind_Resume_or_Rethrow(
|
unsafe extern "C-unwind" fn _Unwind_Resume_or_Rethrow(
|
||||||
exception: *mut UnwindException,
|
exception: *mut UnwindException,
|
||||||
) -> UnwindReasonCode;
|
) -> UnwindReasonCode;
|
||||||
extern "C" [unsafe] fn _Unwind_DeleteException(exception: *mut UnwindException);
|
unsafe extern "C" fn _Unwind_DeleteException(exception: *mut UnwindException);
|
||||||
extern "C-unwind" fn _Unwind_Backtrace(
|
extern "C-unwind" fn _Unwind_Backtrace(
|
||||||
trace: UnwindTraceFn,
|
trace: UnwindTraceFn,
|
||||||
trace_argument: *mut c_void,
|
trace_argument: *mut c_void,
|
||||||
|
Loading…
Reference in New Issue
Block a user