diff --git a/src/lib.rs b/src/lib.rs index 99c09cf..b25aa72 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,11 +65,20 @@ extern crate serde; #[macro_use] extern crate bitflags; -#[cfg(all(feature = "serialize", not(any(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), all(target_arch = "x86_64", not(target_env = "sgx"))))))] +#[cfg(all( + feature = "serialize", + not(any( + all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), + all(target_arch = "x86_64", not(target_env = "sgx")) + )) +))] core::compile_error!("Feature `serialize` is not supported on targets that do not have native cpuid. x86 and x86_64 targets with SGX and x86 targets without SSE are consider to not have native cpuid."); /// Uses Rust's `cpuid` function from the `arch` module. -#[cfg(any(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), all(target_arch = "x86_64", not(target_env = "sgx"))))] +#[cfg(any( + all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), + all(target_arch = "x86_64", not(target_env = "sgx")) +))] pub mod native_cpuid { use crate::CpuIdResult; @@ -109,7 +118,10 @@ mod std { /// /// First parameter is cpuid leaf (EAX register value), /// second optional parameter is the subleaf (ECX register value). -#[cfg(any(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), all(target_arch = "x86_64", not(target_env = "sgx"))))] +#[cfg(any( + all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), + all(target_arch = "x86_64", not(target_env = "sgx")) +))] #[macro_export] macro_rules! cpuid { ($eax:expr) => { @@ -180,7 +192,10 @@ impl CpuIdReader { } } -#[cfg(any(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), all(target_arch = "x86_64", not(target_env = "sgx"))))] +#[cfg(any( + all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), + all(target_arch = "x86_64", not(target_env = "sgx")) +))] impl Default for CpuIdReader { fn default() -> Self { Self { @@ -229,7 +244,10 @@ pub struct CpuId { supported_extended_leafs: u32, } -#[cfg(any(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), all(target_arch = "x86_64", not(target_env = "sgx"))))] +#[cfg(any( + all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), + all(target_arch = "x86_64", not(target_env = "sgx")) +))] impl Default for CpuId { fn default() -> CpuId { CpuId::with_cpuid_fn(native_cpuid::cpuid_count) @@ -311,7 +329,10 @@ const EAX_SVM_FEATURES: u32 = 0x8000_000A; impl CpuId { /// Return new CpuId struct. - #[cfg(any(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), all(target_arch = "x86_64", not(target_env = "sgx"))))] + #[cfg(any( + all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"), + all(target_arch = "x86_64", not(target_env = "sgx")) + ))] pub fn new() -> Self { Self::default() }