Skip to content

Commit 567b8a1

Browse files
committed
Merge branch 'develop'
Signed-off-by: Toralf Wittner <tw@dtex.org>
2 parents fde6e3f + 642416d commit 567b8a1

File tree

5 files changed

+54
-83
lines changed

5 files changed

+54
-83
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
# minicbor
99

10+
## `2.1.2`
11+
12+
- Replaces `build.rs` with `target_has_atomic`. See pull request
13+
[#47](https://github.com/twittner/minicbor/pull/47) by @dtolnay for details.
14+
1015
## `2.1.1`
1116

1217
- Depends on `minicbor-derive-0.18.2`.

minicbor/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
[package]
22
name = "minicbor"
3-
version = "2.1.1"
3+
version = "2.1.2"
44
authors = ["Toralf Wittner <tw@dtex.org>"]
55
license = "BlueOak-1.0.0"
66
edition = "2024"
77
description = "A small CBOR codec suitable for no_std environments."
88
repository = "https://github.com/twittner/minicbor"
99
keywords = ["cbor", "minicbor", "serialization", "encoding", "no_std"]
1010
categories = ["encoding"]
11-
build = "build.rs"
1211

1312
[package.metadata.docs.rs]
1413
features = ["std", "derive", "half"]

minicbor/build.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

minicbor/src/decode.rs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,13 @@ decode_nonzero! {
373373
core::num::NonZeroIsize, "unexpected 0 when decoding a `NonZeroIsize`"
374374
}
375375

376-
#[cfg(any(atomic32, atomic64))]
376+
#[cfg(any(
377+
target_has_atomic = "8",
378+
target_has_atomic = "16",
379+
target_has_atomic = "32",
380+
target_has_atomic = "64",
381+
target_has_atomic = "ptr",
382+
))]
377383
macro_rules! decode_atomic {
378384
($($t:ty)*) => {
379385
$(
@@ -386,31 +392,34 @@ macro_rules! decode_atomic {
386392
}
387393
}
388394

389-
#[cfg(atomic32)]
395+
#[cfg(target_has_atomic = "8")]
390396
decode_atomic! {
391397
core::sync::atomic::AtomicBool
392398
core::sync::atomic::AtomicU8
393-
core::sync::atomic::AtomicU16
394-
core::sync::atomic::AtomicU32
395-
core::sync::atomic::AtomicUsize
396399
core::sync::atomic::AtomicI8
397-
core::sync::atomic::AtomicI16
398-
core::sync::atomic::AtomicI32
399-
core::sync::atomic::AtomicIsize
400400
}
401401

402-
#[cfg(atomic64)]
402+
#[cfg(target_has_atomic = "16")]
403403
decode_atomic! {
404-
core::sync::atomic::AtomicBool
405-
core::sync::atomic::AtomicU8
406404
core::sync::atomic::AtomicU16
407-
core::sync::atomic::AtomicU32
408-
core::sync::atomic::AtomicU64
409-
core::sync::atomic::AtomicUsize
410-
core::sync::atomic::AtomicI8
411405
core::sync::atomic::AtomicI16
406+
}
407+
408+
#[cfg(target_has_atomic = "32")]
409+
decode_atomic! {
410+
core::sync::atomic::AtomicU32
412411
core::sync::atomic::AtomicI32
412+
}
413+
414+
#[cfg(target_has_atomic = "64")]
415+
decode_atomic! {
416+
core::sync::atomic::AtomicU64
413417
core::sync::atomic::AtomicI64
418+
}
419+
420+
#[cfg(target_has_atomic = "ptr")]
421+
decode_atomic! {
422+
core::sync::atomic::AtomicUsize
414423
core::sync::atomic::AtomicIsize
415424
}
416425

minicbor/src/encode.rs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,13 @@ encode_nonzero! {
622622
core::num::NonZeroIsize
623623
}
624624

625-
#[cfg(any(atomic32, atomic64))]
625+
#[cfg(any(
626+
target_has_atomic = "8",
627+
target_has_atomic = "16",
628+
target_has_atomic = "32",
629+
target_has_atomic = "64",
630+
target_has_atomic = "ptr",
631+
))]
626632
macro_rules! encode_atomic {
627633
($($t:ty)*) => {
628634
$(
@@ -642,31 +648,34 @@ macro_rules! encode_atomic {
642648
}
643649
}
644650

645-
#[cfg(atomic32)]
651+
#[cfg(target_has_atomic = "8")]
646652
encode_atomic! {
647653
core::sync::atomic::AtomicBool
648654
core::sync::atomic::AtomicU8
649-
core::sync::atomic::AtomicU16
650-
core::sync::atomic::AtomicU32
651-
core::sync::atomic::AtomicUsize
652655
core::sync::atomic::AtomicI8
653-
core::sync::atomic::AtomicI16
654-
core::sync::atomic::AtomicI32
655-
core::sync::atomic::AtomicIsize
656656
}
657657

658-
#[cfg(atomic64)]
658+
#[cfg(target_has_atomic = "16")]
659659
encode_atomic! {
660-
core::sync::atomic::AtomicBool
661-
core::sync::atomic::AtomicU8
662660
core::sync::atomic::AtomicU16
663-
core::sync::atomic::AtomicU32
664-
core::sync::atomic::AtomicU64
665-
core::sync::atomic::AtomicUsize
666-
core::sync::atomic::AtomicI8
667661
core::sync::atomic::AtomicI16
662+
}
663+
664+
#[cfg(target_has_atomic = "32")]
665+
encode_atomic! {
666+
core::sync::atomic::AtomicU32
668667
core::sync::atomic::AtomicI32
668+
}
669+
670+
#[cfg(target_has_atomic = "64")]
671+
encode_atomic! {
672+
core::sync::atomic::AtomicU64
669673
core::sync::atomic::AtomicI64
674+
}
675+
676+
#[cfg(target_has_atomic = "ptr")]
677+
encode_atomic! {
678+
core::sync::atomic::AtomicUsize
670679
core::sync::atomic::AtomicIsize
671680
}
672681

0 commit comments

Comments
 (0)