Skip to content

Commit 909251d

Browse files
bors[bot]James Munns
andauthored
Merge #120
120: Allow for manual opt-out of CAS features r=japaric a=jamesmunns I've been working on a bare metal platform lately that does not have CAS (specifically ARMv4 bare metal), and this is not caught by the CPU detection logic in the build.rs. This PR adds a flag that allows for manual specification to avoid CAS features. Co-authored-by: James Munns <james.munns@ferrous-systems.com>
2 parents fe1e56c + 434b7b5 commit 909251d

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ name = "heapless"
1919
repository = "https://github.com/japaric/heapless"
2020
version = "0.5.1"
2121

22+
[features]
23+
default = ["cas"]
24+
cas = []
25+
# only for tests
26+
__trybuild = []
27+
2228
[target.x86_64-unknown-linux-gnu.dev-dependencies]
2329
scoped_threadpool = "0.1.8"
2430

@@ -31,7 +37,3 @@ hash32 = "0.1.0"
3137
version = "1"
3238
optional = true
3339
default-features = false
34-
35-
[features]
36-
# only for tests
37-
__trybuild = []

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ mod ser;
8989

9090
pub mod binary_heap;
9191
pub mod i;
92-
#[cfg(not(armv6m))]
92+
#[cfg(all(not(armv6m), feature = "cas"))]
9393
pub mod mpmc;
94-
#[cfg(not(armv6m))]
94+
#[cfg(all(not(armv6m), feature = "cas"))]
9595
pub mod pool;
9696
pub mod spsc;
9797

src/pool/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@
154154
//!
155155
//! [1]: https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf
156156
157-
#[cfg(not(armv6m))]
158157
use core::{any::TypeId, mem, sync::atomic::Ordering};
159158
use core::{
160159
cell::UnsafeCell,

0 commit comments

Comments
 (0)