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

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 10:13:22 PST 2025


Author: Justin Bogner
Date: 2025-11-26T18:13:17Z
New Revision: 0940f686dc332557f0368290ebc3d9aff1f36714

URL: https://github.com/llvm/llvm-project/commit/0940f686dc332557f0368290ebc3d9aff1f36714
DIFF: https://github.com/llvm/llvm-project/commit/0940f686dc332557f0368290ebc3d9aff1f36714.diff

LOG: Move static test variable into the #if that uses it (#169695)

Fixes -Wunused-variable when compiling without LLVM_ENABLE_THREADS

Added: 
    

Modified: 
    llvm/unittests/Support/JobserverTest.cpp

Removed: 
    


################################################################################
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`.


        


More information about the llvm-commits mailing list