[libcxx-commits] [libcxx] d5ab243 - Omit atomic_{, un}signed_lock_free if unsupported

Brian Cain via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 27 14:29:28 PST 2022


Author: Brian Cain
Date: 2022-01-27T14:29:08-08:00
New Revision: d5ab243c6f79f881121a80487f0879d2ab0acc41

URL: https://github.com/llvm/llvm-project/commit/d5ab243c6f79f881121a80487f0879d2ab0acc41
DIFF: https://github.com/llvm/llvm-project/commit/d5ab243c6f79f881121a80487f0879d2ab0acc41.diff

LOG: Omit atomic_{,un}signed_lock_free if unsupported

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

Added: 
    

Modified: 
    libcxx/include/atomic

Removed: 
    


################################################################################
diff  --git a/libcxx/include/atomic b/libcxx/include/atomic
index 02844642fa08d..bd49367a32467 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -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}


        


More information about the libcxx-commits mailing list