Skip to content

Commit

Permalink
Omit atomic_{,un}signed_lock_free if unsupported
Browse files Browse the repository at this point in the history
On targets that have limited atomic support, e.g. ones that define
ATOMIC_*_LOCK_FREE to '1' ("sometimes lock free"), we would end up
referencing yet-undefined __libcpp_{,un}signed_lock_free.

This commit adds a guard to prevent these references for such
targets.

Differential Revision: https://reviews.llvm.org/D118391
  • Loading branch information
androm3da committed Jan 27, 2022
1 parent e900f05 commit d5ab243
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libcxx/include/atomic
Expand Up @@ -2692,10 +2692,13 @@ typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>::typ
typedef conditional<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>::type __libcpp_unsigned_lock_free;
#else
// No signed/unsigned lock-free types
#define _LIBCPP_NO_LOCK_FREE_TYPES
#endif

#if !defined(_LIBCPP_NO_LOCK_FREE_TYPES)
typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free;
typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free;
#endif

#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v}
Expand Down

0 comments on commit d5ab243

Please sign in to comment.