Skip to content

Commit

Permalink
allow(unreachable_code) in all the *_detected functions
Browse files Browse the repository at this point in the history
Previously we only disabled these warnings for SSE2, which is assumed
enabled on x86-64, but it looks like new nightly compilers are also
assuming SSE4.1 on macOS. Disabling these warnings across all the
detection functions accounts for that, and it also gets rid of some
warnings that you'd see if you used RUSTFLAGS='-C target-cpu=native'.
  • Loading branch information
oconnor663 committed Oct 2, 2023
1 parent 5aa53f0 commit 3d921ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ impl Platform {
#[cfg(blake3_avx512_ffi)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[inline(always)]
#[allow(unreachable_code)]
pub fn avx512_detected() -> bool {
// A testing-only short-circuit.
if cfg!(feature = "no_avx512") {
Expand All @@ -349,6 +350,7 @@ pub fn avx512_detected() -> bool {

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[inline(always)]
#[allow(unreachable_code)]
pub fn avx2_detected() -> bool {
// A testing-only short-circuit.
if cfg!(feature = "no_avx2") {
Expand All @@ -371,6 +373,7 @@ pub fn avx2_detected() -> bool {

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[inline(always)]
#[allow(unreachable_code)]
pub fn sse41_detected() -> bool {
// A testing-only short-circuit.
if cfg!(feature = "no_sse41") {
Expand Down

0 comments on commit 3d921ae

Please sign in to comment.