1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

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().

llvm-svn: 180200
This commit is contained in:
Reid Kleckner 2013-04-24 17:50:30 +00:00
parent b2a88cf3ef
commit 466affe6ec

View File

@ -13,9 +13,9 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef __APPLE__ #if defined(__APPLE__)
# include <crt_externs.h> # include <crt_externs.h>
#else #elif !defined(_MSC_VER)
// Forward declare environ in case it's not provided by stdlib.h. // Forward declare environ in case it's not provided by stdlib.h.
extern char **environ; extern char **environ;
#endif #endif
@ -32,8 +32,6 @@ ProgramTestStringArg2("program-test-string-arg2");
static void CopyEnvironment(std::vector<const char *> &out) { static void CopyEnvironment(std::vector<const char *> &out) {
#ifdef __APPLE__ #ifdef __APPLE__
// _NSGetEnviron() only works from the main exe on Mac. Fortunately the test
// should be in the executable.
char **envp = *_NSGetEnviron(); char **envp = *_NSGetEnviron();
#else #else
// environ seems to work for Windows and most other Unices. // environ seems to work for Windows and most other Unices.