Skip to content

Commit

Permalink
cpu: Assert correctness of Apple Aarch64 static detection at compile …
Browse files Browse the repository at this point in the history
…time.
  • Loading branch information
briansmith committed Oct 29, 2022
1 parent d3ffadc commit fa25bf3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cpu/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ macro_rules! features {
#[cfg(not(all(target_arch = "aarch64", target_vendor = "apple")))]
const ARMCAP_STATIC: u32 = 0;

const _ALL_FEATURES_MASK: u32 = 0
$( | $name.mask
)+;

#[cfg(all(test, any(target_arch = "arm", target_arch = "aarch64")))]
const ALL_FEATURES: [Feature; 4] = [
$(
Expand Down Expand Up @@ -262,6 +266,11 @@ prefixed_export! {
static mut OPENSSL_armcap_P: u32 = ARMCAP_STATIC;
}

const _APPLE_TARGETS_HAVE_ALL_FEATURES: () = assert!(
(ARMCAP_STATIC == _ALL_FEATURES_MASK)
|| !cfg!(all(target_arch = "aarch64", target_vendor = "apple"))
);

#[cfg(all(test, any(target_arch = "arm", target_arch = "aarch64")))]
mod tests {
use super::*;
Expand Down

0 comments on commit fa25bf3

Please sign in to comment.