HomeFreeBSD

[libcxx] Guard C++20 atomic type aliases

Description

[libcxx] Guard C++20 atomic type aliases

Apply abandoned llvm review https://reviews.llvm.org/D75183 anyway:

The std::atomic_signed_lock_free and std::atomic_unsigned_lock_free
typedefs are a C++20 feature and should be guarded with an #if, so that
they don't get defined in C++17 and prior versions.

Also with the current implementation inclusion of the <atomic> header
will fail the compilation for targets that don't have lock-free atomic
integers (e.g. Armv6-M) because libcpp_signed_lock_free and
libcpp_unsigned_lock_free will not get defined. We should not try to
define std::atomic_signed_lock_free and std::atomic_unsigned_lock_free
in this case as well (according to [atomics.alias]/2 these typedefs are
optional in freestanding implementations).

Details

Provenance
dimAuthored on Dec 17 2021, 10:10 PM
Parents
rG8ae4c8aadfbd: [libcxx] Fix atomic type for arm (pre v6) to work w/out needing libatomic
Branches
Unknown
Tags
Unknown