[llvm] r180200 - Don't forward declare environ on Windows
Reid Kleckner
reid at kleckner.net
Wed Apr 24 10:50:31 PDT 2013
Author: rnk
Date: Wed Apr 24 12:50:30 2013
New Revision: 180200
URL: http://llvm.org/viewvc/llvm-project?rev=180200&view=rev
Log:
Don't forward declare environ on Windows
That seems to interact poorly with the environ and _environ macros
defined in MSVC's <stdlib.h>.
Also remove the incorrect comment about _NSGetEnviron().
Modified:
llvm/trunk/unittests/Support/ProgramTest.cpp
Modified: llvm/trunk/unittests/Support/ProgramTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ProgramTest.cpp?rev=180200&r1=180199&r2=180200&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ProgramTest.cpp (original)
+++ llvm/trunk/unittests/Support/ProgramTest.cpp Wed Apr 24 12:50:30 2013
@@ -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-stri
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.
More information about the llvm-commits
mailing list