#[macro_use]
extern crate cfg_if;
cfg_if! {
if #[cfg(any(
feature = "force_global_jemalloc",
target_os = "linux",
target_os = "macos",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd"
))] {
#[global_allocator]
pub static JEMALLOC: linera_jemallocator::Jemalloc = linera_jemallocator::Jemalloc;
}
}
#[cfg(test)]
mod tests {
macro_rules! check {
() => {
#[test]
fn foo() {
let _ = super::JEMALLOC;
}
};
($os_name:tt) => {
#[cfg(target_os = $os_name)]
check!();
};
($($os_name:tt),*) => {
$(check!($os_name);)*
}
}
#[cfg(feature = "force_global_jemalloc")]
check!();
#[cfg(not(feature = "force_global_jemalloc"))]
check!("linux", "android", "macos", "ios", "freebsd", "netbsd", "openbsd");
}