Skip to content

Commit 35a4eac

Browse files
committed
HACK: xcode clang++16 does not support C++20 std::atomic_ref.
1 parent 28ae277 commit 35a4eac

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

include/bitcoin/database/impl/primitives/arrayhead.ipp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ Link CLASS::at(size_t key) const NOEXCEPT
134134
{
135135
// Reads full padded word.
136136
const auto raw = ptr->data();
137-
const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
137+
// xcode clang++16 does not support C++20 std::atomic_ref.
138+
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
139+
const auto& head = *pointer_cast<std::atomic<integer>>(raw);
138140
return head.load(std::memory_order_acquire);
139141
}
140142
else
@@ -162,7 +164,9 @@ bool CLASS::push(const Link& link, const Link& index) NOEXCEPT
162164
{
163165
// Writes full padded word (0x00 fill).
164166
const auto raw = ptr->data();
165-
const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
167+
// xcode clang++16 does not support C++20 std::atomic_ref.
168+
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
169+
auto& head = *pointer_cast<std::atomic<integer>>(raw);
166170
head.store(link, std::memory_order_acq_rel);
167171
}
168172
else

include/bitcoin/database/impl/primitives/hashhead.ipp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ inline Link CLASS::top(const Link& index) const NOEXCEPT
132132
if constexpr (Align)
133133
{
134134
// Reads full padded word.
135-
const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
135+
// xcode clang++16 does not support C++20 std::atomic_ref.
136+
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
137+
const auto& head =* pointer_cast<std::atomic<integer>>(raw);
136138
return head.load(std::memory_order_acquire);
137139
}
138140
else
@@ -164,7 +166,9 @@ inline bool CLASS::push(const Link& current, bytes& next,
164166
if constexpr (Align)
165167
{
166168
// Writes full padded word (0x00 fill).
167-
const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
169+
// xcode clang++16 does not support C++20 std::atomic_ref.
170+
////const std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
171+
auto& head = *pointer_cast<std::atomic<integer>>(raw);
168172
next = Link(head.exchange(current, std::memory_order_acq_rel));
169173
}
170174
else

0 commit comments

Comments
 (0)