[llvm] [LLVM] Check of LLVM_ON_UNIX is Defined (PR #166827)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 6 11:05:15 PST 2025
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/166827
This is canonical in the rest of the repository and otherwise we can end
up with warnings when compiling with clang-cl on Windows that look like
the following:
```
2025-11-06T17:55:25.2412502Z C:\_work\llvm-project\llvm-project\llvm\include\llvm/Support/thread.h(37,5): warning: 'LLVM_ON_UNIX' is not defined, evaluates to 0 [-Wundef]
2025-11-06T17:55:25.2413436Z 37 | #if LLVM_ON_UNIX || _WIN32
2025-11-06T17:55:25.2413791Z | ^
2025-11-06T17:55:25.2414625Z C:\_work\llvm-project\llvm-project\llvm\include\llvm/Support/thread.h(52,5): warning: 'LLVM_ON_UNIX' is not defined, evaluates to 0 [-Wundef]
2025-11-06T17:55:25.2415585Z 52 | #if LLVM_ON_UNIX
2025-11-06T17:55:25.2415901Z | ^
2025-11-06T17:55:25.2416169Z 2 warnings generated.
```
>From 68feec1f8b93c14decbbecbe985b939bda807dc7 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Thu, 6 Nov 2025 19:05:03 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
llvm/include/llvm/Support/thread.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/Support/thread.h b/llvm/include/llvm/Support/thread.h
index ecde62d8368e7..51873e7d529bf 100644
--- a/llvm/include/llvm/Support/thread.h
+++ b/llvm/include/llvm/Support/thread.h
@@ -34,7 +34,7 @@ typedef PVOID HANDLE;
namespace llvm {
-#if LLVM_ON_UNIX || _WIN32
+#if defined(LLVM_ON_UNIX) || defined(_WIN32)
/// LLVM thread following std::thread interface with added constructor to
/// specify stack size.
@@ -49,7 +49,7 @@ class thread {
}
public:
-#if LLVM_ON_UNIX
+#ifdef LLVM_ON_UNIX
using native_handle_type = pthread_t;
using id = pthread_t;
using start_routine_type = void *(*)(void *);
More information about the llvm-commits
mailing list