use libffi_sys::{ffi_abi_FFI_SYSV, ffi_abi_FFI_VFP};
#[cfg(not(docsrs))]
use super::Abi;
#[cfg(docsrs)]
pub struct Abi(libffi_sys::ffi_abi);
impl Abi {
pub const SYSV: Self = Abi(ffi_abi_FFI_SYSV);
pub const VFP: Self = Abi(ffi_abi_FFI_VFP);
#[cfg(test)]
#[doc(hidden)]
pub const ABIS: [Self; 2] = [Self::SYSV, Self::VFP];
}
impl Default for Abi {
fn default() -> Self {
#[cfg(not(any(target_abi = "eabihf", windows)))]
return Self::SYSV;
#[cfg(any(target_abi = "eabihf", windows))]
return Self::VFP;
}
}
#[cfg(test)]
mod tests {
use super::super::test_utils::test_create_closure_and_call_with_abi;
use super::Abi;
#[test]
#[cfg_attr(miri, ignore)]
fn test_sysv_abi_closure_call() {
test_create_closure_and_call_with_abi(Abi::SYSV);
}
#[test]
#[cfg_attr(miri, ignore)]
fn test_vfp_abi_closure_call() {
test_create_closure_and_call_with_abi(Abi::VFP);
}
}