aboutsummaryrefslogtreecommitdiff
path: root/unittests/Support/ProgramTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Support/ProgramTest.cpp')
-rwxr-xr-xunittests/Support/ProgramTest.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/unittests/Support/ProgramTest.cpp b/unittests/Support/ProgramTest.cpp
index 80b0334c67..279e2e8d0f 100755
--- a/unittests/Support/ProgramTest.cpp
+++ b/unittests/Support/ProgramTest.cpp
@@ -13,9 +13,9 @@
#include "gtest/gtest.h"
#include <stdlib.h>
-#ifdef __APPLE__
+#if defined(__APPLE__)
# include <crt_externs.h>
-#else
+#elif !defined(_MSC_VER)
// Forward declare environ in case it's not provided by stdlib.h.
extern char **environ;
#endif
@@ -32,8 +32,6 @@ ProgramTestStringArg2("program-test-string-arg2");
static void CopyEnvironment(std::vector<const char *> &out) {
#ifdef __APPLE__
- // _NSGetEnviron() only works from the main exe on Mac. Fortunately the test
- // should be in the executable.
char **envp = *_NSGetEnviron();
#else
// environ seems to work for Windows and most other Unices.