[llvm] [Support] Also check the value for HAVE_PTHREAD_(SETNAME/SET_NAME)_NP (PR #156294)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 01:19:42 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Brad Smith (brad0)

<details>
<summary>Changes</summary>

As was already done for HAVE_PTHREAD_(GETNAME/GET_NAME)_NP

---
Full diff: https://github.com/llvm/llvm-project/pull/156294.diff


1 Files Affected:

- (modified) llvm/lib/Support/Unix/Threading.inc (+2-2) 


``````````diff
diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index 7854d6d229152..f016ed6937524 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -194,9 +194,9 @@ void llvm::set_thread_name(const Twine &Name) {
   if (get_max_thread_name_length() > 0)
     NameStr = NameStr.take_back(get_max_thread_name_length() - 1);
   (void)NameStr;
-#if defined(HAVE_PTHREAD_SET_NAME_NP)
+#if defined(HAVE_PTHREAD_SET_NAME_NP) && HAVE_PTHREAD_SET_NAME_NP
   ::pthread_set_name_np(::pthread_self(), NameStr.data());
-#elif defined(HAVE_PTHREAD_SETNAME_NP)
+#elif defined(HAVE_PTHREAD_SETNAME_NP) && HAVE_PTHREAD_SETNAME_NP
 #if defined(__NetBSD__)
   ::pthread_setname_np(::pthread_self(), "%s",
                        const_cast<char *>(NameStr.data()));

``````````

</details>


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


More information about the llvm-commits mailing list