Skip to content

Commit

Permalink
cpufeatures: fix cfg for freestanding x86 targets (#1137)
Browse files Browse the repository at this point in the history
Previously we were using an empty string for `target_os` to indicate
freestanding targets which is incorrect. We should use `none` instead.
  • Loading branch information
newpavlov authored Nov 21, 2024
1 parent e74e578 commit 21105ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cpufeatures/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## UNRELEASED
### Fixed
- `cfg` for freestanding x86 targets ([#1137])

[#1137]: https://github.com/RustCrypto/utils/pull/1137

## 0.2.15 (2024-11-11)
### Fixed
- Relax XSAVE checks ([#1130])
Expand Down
4 changes: 2 additions & 2 deletions cpufeatures/src/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ macro_rules! __unless_target_features {
($($tf:tt),+ => $body:expr ) => {{
#[cfg(not(all($(target_feature=$tf,)*)))]
{
#[cfg(not(any(target_env = "sgx", target_os = "", target_os = "uefi")))]
#[cfg(not(any(target_env = "sgx", target_os = "none", target_os = "uefi")))]
$body

// CPUID is not available on SGX. Freestanding and UEFI targets
// do not support SIMD features with default compilation flags.
#[cfg(any(target_env = "sgx", target_os = "", target_os = "uefi"))]
#[cfg(any(target_env = "sgx", target_os = "none", target_os = "uefi"))]
false
}

Expand Down

0 comments on commit 21105ea

Please sign in to comment.