From d19e43324aa66e616a46b4a8889f58390eb7be86 Mon Sep 17 00:00:00 2001 From: Artyom Pavlov Date: Tue, 14 Jul 2020 15:44:53 +0300 Subject: [PATCH] cpuid-bool: fix SGX support (take 2) (#68) --- cpuid-bool/CHANGELOG.md | 4 ++-- cpuid-bool/src/lib.rs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cpuid-bool/CHANGELOG.md b/cpuid-bool/CHANGELOG.md index 3506aa6a..bba6d211 100644 --- a/cpuid-bool/CHANGELOG.md +++ b/cpuid-bool/CHANGELOG.md @@ -7,9 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.1.0 (2020-07-14) ### Fixed -- SGX target support ([#67]) +- SGX target support ([#68]) -[#67]: https://github.com/RustCrypto/utils/pull/67 +[#68]: https://github.com/RustCrypto/utils/pull/68 ## 0.1.0 (2020-06-11) - Initial release \ No newline at end of file diff --git a/cpuid-bool/src/lib.rs b/cpuid-bool/src/lib.rs index d406efcc..557539a7 100644 --- a/cpuid-bool/src/lib.rs +++ b/cpuid-bool/src/lib.rs @@ -93,7 +93,7 @@ expand_check_macro! { macro_rules! cpuid_bool { ($($tf:tt),+ $(,)? ) => {{ // CPUID is not available on SGX targets - #[cfg(not(all(not(target_env = "sgx"), $(target_feature=$tf, )*)))] + #[cfg(all(not(target_env = "sgx"), not(all($(target_feature=$tf, )*))))] let res = { #[cfg(target_arch = "x86")] use core::arch::x86::{__cpuid, __cpuid_count}; @@ -111,6 +111,8 @@ macro_rules! cpuid_bool { }) }; + #[cfg(all(target_env = "sgx", not(all($(target_feature=$tf, )*))))] + let res = false; #[cfg(all($(target_feature=$tf, )*))] let res = true;