[compiler-rt] [compiler-rt][builtins] Switch libatomic locks to pthread_mutex_t. (PR #94374)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 09:26:13 PDT 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 335fb9467172683d1b9418ee17120598d0d0a1af 1f8739f26bd4789d562e0116bc1e499985201fca -- compiler-rt/lib/builtins/atomic.c
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/lib/builtins/atomic.c b/compiler-rt/lib/builtins/atomic.c
index aaba648e4a..6b1cb37ce9 100644
--- a/compiler-rt/lib/builtins/atomic.c
+++ b/compiler-rt/lib/builtins/atomic.c
@@ -97,14 +97,10 @@ _Static_assert(__atomic_always_lock_free(sizeof(uintptr_t), 0),
 #include <pthread.h>
 typedef pthread_mutex_t Lock;
 /// Unlock a lock.  This is a release operation.
-__inline static void unlock(Lock *l) {
-  pthread_mutex_unlock(l);
-}
+__inline static void unlock(Lock *l) { pthread_mutex_unlock(l); }
 /// Locks a lock.  In the current implementation, this is potentially
 /// unbounded in the contended case.
-__inline static void lock(Lock *l) {
-  pthread_mutex_lock(l);
-}
+__inline static void lock(Lock *l) { pthread_mutex_lock(l); }
 /// locks for atomic operations
 static Lock locks[SPINLOCK_COUNT];
 #endif

``````````

</details>


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


More information about the llvm-commits mailing list