[libc-commits] [libc] [libc] Reset thread-specific key value before invoking destructor (PR #226134)

via libc-commits libc-commits at lists.llvm.org
Thu Sep 24 05:00:14 PDT 2026


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 origin/main HEAD --extensions cpp,h -- libc/include/llvm-libc-macros/common-threads-macros.h libc/include/llvm-libc-macros/threads-macros.h libc/include/llvm-libc-macros/limits-macros.h libc/include/llvm-libc-macros/linux/unistd-macros.h libc/src/__support/threads/thread.cpp libc/src/unistd/linux/sysconf.cpp libc/test/integration/src/pthread/pthread_tss_test.cpp libc/test/integration/src/threads/tss_test.cpp libc/test/src/unistd/sysconf_test.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/libc/src/__support/threads/thread.cpp b/libc/src/__support/threads/thread.cpp
index b03903be4..5175576a5 100644
--- a/libc/src/__support/threads/thread.cpp
+++ b/libc/src/__support/threads/thread.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/__support/threads/thread.h"
-#include "hdr/types/struct___pthread_cleanup_frame.h"
 #include "hdr/limits_macros.h"
+#include "hdr/types/struct___pthread_cleanup_frame.h"
 #include "src/__support/CPP/array.h"
 #include "src/__support/CPP/mutex.h" // lock_guard
 #include "src/__support/CPP/optional.h"
diff --git a/libc/test/integration/src/pthread/pthread_tss_test.cpp b/libc/test/integration/src/pthread/pthread_tss_test.cpp
index 86b615f62..b5c4d638f 100644
--- a/libc/test/integration/src/pthread/pthread_tss_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_tss_test.cpp
@@ -91,13 +91,12 @@ static void *func_getspecific_nullptr(void *) {
 static void getspecific_nullptr_in_dtor_test() {
   pthread_t th;
   dtor_getspecific_val = &dtor_getspecific_val;
-  ASSERT_EQ(
-      LIBC_NAMESPACE::pthread_key_create(&key, &dtor_verify_getspecific_nullptr),
-      0);
-  ASSERT_EQ(
-      LIBC_NAMESPACE::pthread_create(&th, nullptr, &func_getspecific_nullptr,
-                                     nullptr),
-      0);
+  ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(
+                &key, &dtor_verify_getspecific_nullptr),
+            0);
+  ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr,
+                                           &func_getspecific_nullptr, nullptr),
+            0);
   ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, nullptr), 0);
   ASSERT_EQ(dtor_getspecific_val, nullptr);
   ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0);

``````````

</details>


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


More information about the libc-commits mailing list