From 96ddd4d34b062785da8da25c66e48076f1f6e73d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 1 May 2019 12:35:12 +0900 Subject: [PATCH] Support non-atomic targets Refs: https://github.com/rust-lang/rust/pull/51953 --- .travis.yml | 4 ++++ ci/crossbeam-epoch.sh | 2 ++ ci/crossbeam-skiplist.sh | 2 ++ ci/crossbeam-utils.sh | 2 ++ ci/crossbeam.sh | 2 ++ crossbeam-epoch/src/lib.rs | 5 +++++ crossbeam-skiplist/src/lib.rs | 5 +++++ crossbeam-utils/src/lib.rs | 4 ++++ src/lib.rs | 4 ++++ 9 files changed, 30 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6b582c20b..c8d5312d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,7 @@ matrix: script: ./ci/crossbeam.sh install: - rustup target add thumbv7m-none-eabi + - rustup target add thumbv6m-none-eabi - rust: nightly name: "crossbeam-channel on nightly" script: ./ci/crossbeam-channel.sh @@ -52,6 +53,7 @@ matrix: script: ./ci/crossbeam-epoch.sh install: - rustup target add thumbv7m-none-eabi + - rustup target add thumbv6m-none-eabi addons: apt: sources: @@ -71,11 +73,13 @@ matrix: script: ./ci/crossbeam-skiplist.sh install: - rustup target add thumbv7m-none-eabi + - rustup target add thumbv6m-none-eabi - rust: nightly name: "crossbeam-utils on nightly" script: ./ci/crossbeam-utils.sh install: - rustup target add thumbv7m-none-eabi + - rustup target add thumbv6m-none-eabi # Check for duplicate dependencies. - rust: nightly diff --git a/ci/crossbeam-epoch.sh b/ci/crossbeam-epoch.sh index 00fb386ae..3f18e3148 100755 --- a/ci/crossbeam-epoch.sh +++ b/ci/crossbeam-epoch.sh @@ -25,4 +25,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then cargo check --target thumbv7m-none-eabi --no-default-features cargo check --target thumbv7m-none-eabi --no-default-features --features alloc cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly fi diff --git a/ci/crossbeam-skiplist.sh b/ci/crossbeam-skiplist.sh index 0e6a3c4cd..3232a1f14 100755 --- a/ci/crossbeam-skiplist.sh +++ b/ci/crossbeam-skiplist.sh @@ -17,4 +17,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then cargo check --target thumbv7m-none-eabi --no-default-features cargo check --target thumbv7m-none-eabi --no-default-features --features alloc cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly fi diff --git a/ci/crossbeam-utils.sh b/ci/crossbeam-utils.sh index 949337155..3095ea9e5 100755 --- a/ci/crossbeam-utils.sh +++ b/ci/crossbeam-utils.sh @@ -17,4 +17,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then cargo check --target thumbv7m-none-eabi --no-default-features cargo check --target thumbv7m-none-eabi --no-default-features --features alloc cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly fi diff --git a/ci/crossbeam.sh b/ci/crossbeam.sh index b937a711a..24e1739c8 100755 --- a/ci/crossbeam.sh +++ b/ci/crossbeam.sh @@ -17,4 +17,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then cargo check --target thumbv7m-none-eabi --no-default-features cargo check --target thumbv7m-none-eabi --no-default-features --features alloc cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features nightly + cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly fi diff --git a/crossbeam-epoch/src/lib.rs b/crossbeam-epoch/src/lib.rs index 7abda3639..8ff4bfd30 100644 --- a/crossbeam-epoch/src/lib.rs +++ b/crossbeam-epoch/src/lib.rs @@ -58,6 +58,7 @@ #![warn(missing_debug_implementations)] #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "nightly", feature(const_fn))] +#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))] #[macro_use] extern crate cfg_if; @@ -72,6 +73,10 @@ cfg_if! { } } +#[cfg_attr( + feature = "nightly", + cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) +)] cfg_if! { if #[cfg(any(feature = "alloc", feature = "std"))] { extern crate arrayvec; diff --git a/crossbeam-skiplist/src/lib.rs b/crossbeam-skiplist/src/lib.rs index 1ac1cd7d2..942b0a9d8 100644 --- a/crossbeam-skiplist/src/lib.rs +++ b/crossbeam-skiplist/src/lib.rs @@ -3,6 +3,7 @@ #![warn(missing_docs)] #![warn(missing_debug_implementations)] #![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))] #[macro_use] extern crate cfg_if; @@ -17,6 +18,10 @@ cfg_if! { } } +#[cfg_attr( + feature = "nightly", + cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) +)] cfg_if! { if #[cfg(any(feature = "alloc", feature = "std"))] { extern crate crossbeam_epoch as epoch; diff --git a/crossbeam-utils/src/lib.rs b/crossbeam-utils/src/lib.rs index 9f258c68b..4df2ac8a4 100644 --- a/crossbeam-utils/src/lib.rs +++ b/crossbeam-utils/src/lib.rs @@ -44,6 +44,10 @@ cfg_if! { } } +#[cfg_attr( + feature = "nightly", + cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) +)] pub mod atomic; mod cache_padded; diff --git a/src/lib.rs b/src/lib.rs index fd53a1421..ecff332ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,6 +68,10 @@ pub use _epoch::crossbeam_epoch as epoch; extern crate crossbeam_utils; +#[cfg_attr( + feature = "nightly", + cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr")) +)] pub use crossbeam_utils::atomic; /// Miscellaneous utilities.