aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2020-08-31 16:55:48 -0400
committerJack O'Connor <[email protected]>2020-08-31 18:25:38 -0400
commita79fec7e392b93b1571bf835570249848be66a16 (patch)
tree75cb136255295a976f170e1c4f2f6b1f95130915
parent8610ebda6a25b73dbebf656285725e3b1d255731 (diff)
fix a build break on x86 targets without guaranteed SSE2 support
This is quite hard to trigger, because SSE2 has been guaranteed for a long time. But you could trigger it this way: rustup target add i686-unknown-linux-musl RUSTFLAGS="-C target-cpu=i386" cargo build --target i686-unknown-linux-musl Note a relevant gotcha though: The `cross` tool will not forward environment variables like RUSTFLAGS to the container by default, so if you're testing with `cross` you'll need to use the `rustc` command to explicitly pass the flag, as I've done here in ci.yml. (Or you could create a `Cross.toml` file, but I don't want to commit one of those if I can avoid it.)
-rw-r--r--.github/workflows/ci.yml3
-rw-r--r--src/platform.rs2
2 files changed, 5 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 04029e4..5ffea8d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -135,6 +135,9 @@ jobs:
- run: cargo install cross
# Test the portable implementation on everything.
- run: cross test --target ${{ matrix.arch }}
+ # Test building for ancient i386 processors without guaranteed SSE2 support.
+ - run: cross rustc --target ${{ matrix.arch }} -- -C target-cpu=i386
+ if: startsWith(matrix.arch, 'i686-')
# Test the NEON implementation on ARM targets.
- run: cross test --target ${{ matrix.arch }} --features=neon
if: startsWith(matrix.arch, 'armv7-') || startsWith(matrix.arch, 'aarch64-')
diff --git a/src/platform.rs b/src/platform.rs
index c0eb21d..ee9c349 100644
--- a/src/platform.rs
+++ b/src/platform.rs
@@ -403,6 +403,8 @@ pub fn sse2_detected() -> bool {
{
return true;
}
+ #[allow(unreachable_code)]
+ false
}
#[inline(always)]