Skip to content

Commit

Permalink
Support non-atomic targets
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 11, 2019
1 parent cafe143 commit 96ddd4d
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ci/crossbeam-epoch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions ci/crossbeam-skiplist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions ci/crossbeam-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions ci/crossbeam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions crossbeam-epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions crossbeam-skiplist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions crossbeam-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 96ddd4d

Please sign in to comment.