[libcxx-commits] [PATCH] D118391: Omit atomic_{, un}signed_lock_free if unsupported

Brian Cain via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 27 09:20:10 PST 2022


bcain created this revision.
bcain added reviewers: ldionne, libc++.
bcain requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

  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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118391

Files:
  libcxx/include/atomic


Index: libcxx/include/atomic
===================================================================
--- libcxx/include/atomic
+++ libcxx/include/atomic
@@ -2692,10 +2692,13 @@
 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}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118391.403698.patch
Type: text/x-patch
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220127/896d9b4f/attachment.bin>


More information about the libcxx-commits mailing list