[libcxx-commits] [libcxx] [libcxxabi] [llvm] [libc++] Implement library support for MCF thread model (PR #116550)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Nov 17 09:19:03 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 5c8c90d8212d8720fd8630aecc634bdff6261ad6 689470df2a7aed3efcc739f172a66e6893725d24 --extensions ,h,cpp -- libcxx/include/__config libcxx/include/__thread/support.h libcxxabi/src/cxa_guard_impl.h libcxxabi/src/cxa_thread_atexit.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 5bee6efdc0..4ca457cf7e 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -898,8 +898,7 @@ typedef __char32_t char32_t;
 //
 // TODO(EricWF): This is potentially true for some pthread implementations
 // as well.
-#  if (_LIBCPP_HAS_THREAD_API_C11 && defined(__Fuchsia__)) ||                                                          \
-      _LIBCPP_HAS_THREAD_API_WIN32 || _LIBCPP_HAS_THREAD_API_MCF
+#  if (_LIBCPP_HAS_THREAD_API_C11 && defined(__Fuchsia__)) || _LIBCPP_HAS_THREAD_API_WIN32 || _LIBCPP_HAS_THREAD_API_MCF
 #    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 1
 #  else
 #    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 0
diff --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h
index 78d4fa5e1f..f32de3825d 100644
--- a/libcxxabi/src/cxa_guard_impl.h
+++ b/libcxxabi/src/cxa_guard_impl.h
@@ -625,23 +625,16 @@ private:
   int64_t* guard_ptr;
 
 public:
-  explicit GuardObject_MCF(uint64_t* raw_guard_object)
-      : guard_ptr(reinterpret_cast<int64_t*>(raw_guard_object)) { }
+  explicit GuardObject_MCF(uint64_t* raw_guard_object) : guard_ptr(reinterpret_cast<int64_t*>(raw_guard_object)) {}
 
   /// Implements __cxa_guard_acquire.
-  AcquireResult cxa_guard_acquire() {
-    return static_cast<AcquireResult>(__MCF_cxa_guard_acquire(guard_ptr));
-  }
+  AcquireResult cxa_guard_acquire() { return static_cast<AcquireResult>(__MCF_cxa_guard_acquire(guard_ptr)); }
 
   /// Implements __cxa_guard_release.
-  void cxa_guard_release() {
-    __MCF_cxa_guard_release(guard_ptr);
-  }
+  void cxa_guard_release() { __MCF_cxa_guard_release(guard_ptr); }
 
   /// Implements __cxa_guard_abort.
-  void cxa_guard_abort() {
-    __MCF_cxa_guard_abort(guard_ptr);
-  }
+  void cxa_guard_abort() { __MCF_cxa_guard_abort(guard_ptr); }
 };
 
 //===----------------------------------------------------------------------===//
diff --git a/libcxxabi/src/cxa_thread_atexit.cpp b/libcxxabi/src/cxa_thread_atexit.cpp
index 445eeb41aa..41ea88b6aa 100644
--- a/libcxxabi/src/cxa_thread_atexit.cpp
+++ b/libcxxabi/src/cxa_thread_atexit.cpp
@@ -26,15 +26,16 @@ namespace __cxxabiv1 {
 
   extern "C"
 #if !defined(HAVE___CXA_THREAD_ATEXIT_IMPL)
-  // A weak symbol is used to detect this function's presence in the C library
-  // at runtime, even if libc++ is built against an older libc
-  _LIBCXXABI_WEAK
+      // A weak symbol is used to detect this function's presence in the C library
+      // at runtime, even if libc++ is built against an older libc
+      _LIBCXXABI_WEAK
 #endif
-  int __cxa_thread_atexit_impl(Dtor, void*, void*);
+      int
+      __cxa_thread_atexit_impl(Dtor, void*, void*);
 
 #if !(_LIBCPP_HAS_THREAD_API_MCF || defined(HAVE___CXA_THREAD_ATEXIT_IMPL))
 
-namespace {
+  namespace {
   // This implementation is used if the C library does not provide
   // __cxa_thread_atexit_impl() for us.  It has a number of limitations that are
   // difficult to impossible to address without ..._impl():

``````````

</details>


https://github.com/llvm/llvm-project/pull/116550


More information about the libcxx-commits mailing list