[llvm] Move static test variable into the #if that uses it (PR #169695)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 09:44:08 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Justin Bogner (bogner)

<details>
<summary>Changes</summary>

Fixes -Wunused-variable when compiling without LLVM_ENABLE_THREADS

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


1 Files Affected:

- (modified) llvm/unittests/Support/JobserverTest.cpp (+3-3) 


``````````diff
diff --git a/llvm/unittests/Support/JobserverTest.cpp b/llvm/unittests/Support/JobserverTest.cpp
index 1917145704608..df623463bb309 100644
--- a/llvm/unittests/Support/JobserverTest.cpp
+++ b/llvm/unittests/Support/JobserverTest.cpp
@@ -46,9 +46,6 @@ extern const char *TestMainArgv0;
 
 namespace {
 
-// Unique anchor whose address helps locate the current test binary.
-static int JobserverTestAnchor = 0;
-
 // RAII helper to set an environment variable for the duration of a test.
 class ScopedEnvironment {
   std::string Name;
@@ -225,6 +222,9 @@ TEST_F(JobserverClientTest, UnixClientFifo) {
 }
 
 #if LLVM_ENABLE_THREADS
+// Unique anchor whose address helps locate the current test binary.
+static int JobserverTestAnchor = 0;
+
 // Test fixture for tests that use the jobserver strategy. It creates a
 // temporary FIFO, sets MAKEFLAGS, and provides a helper to pre-load the FIFO
 // with job tokens, simulating `make -jN`.

``````````

</details>


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


More information about the llvm-commits mailing list