[llvm] 1956288 - [Support][test] Unconditionally use setenv macro when compiling on Windows

Markus Böck via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 10:53:29 PST 2021


Author: Markus Böck
Date: 2021-03-09T19:53:22+01:00
New Revision: 1956288fbbafc5a7e879fe133f28c11490591f36

URL: https://github.com/llvm/llvm-project/commit/1956288fbbafc5a7e879fe133f28c11490591f36
DIFF: https://github.com/llvm/llvm-project/commit/1956288fbbafc5a7e879fe133f28c11490591f36.diff

LOG: [Support][test] Unconditionally use setenv macro when compiling on Windows

This test currently fails to compile when using a MinGW toolchain as setenv is not defined. This function is a POSIX function Windows does not implement.

This patch enables the setenv macro used in the unit test for all of Windows, making the test compile and run successfully.

Differential Revision: https://reviews.llvm.org/D98271

Added: 
    

Modified: 
    llvm/unittests/Support/ThreadPool.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/ThreadPool.cpp b/llvm/unittests/Support/ThreadPool.cpp
index 12a2b76036c0..6cc62f37d2d5 100644
--- a/llvm/unittests/Support/ThreadPool.cpp
+++ b/llvm/unittests/Support/ThreadPool.cpp
@@ -240,7 +240,7 @@ extern const char *TestMainArgv0;
 // Just a reachable symbol to ease resolving of the executable's path.
 static cl::opt<std::string> ThreadPoolTestStringArg1("thread-pool-string-arg1");
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 #define setenv(name, var, ignore) _putenv_s(name, var)
 #endif
 


        


More information about the llvm-commits mailing list