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

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 10:49:32 PST 2021


zero9178 created this revision.
zero9178 added reviewers: rnk, mstorsjo, aganea.
zero9178 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98271

Files:
  llvm/unittests/Support/ThreadPool.cpp


Index: llvm/unittests/Support/ThreadPool.cpp
===================================================================
--- llvm/unittests/Support/ThreadPool.cpp
+++ llvm/unittests/Support/ThreadPool.cpp
@@ -240,7 +240,7 @@
 // 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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98271.329387.patch
Type: text/x-patch
Size: 471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210309/40f2fbee/attachment.bin>


More information about the llvm-commits mailing list