diff options
author | Chris Bieneman <beanz@apple.com> | 2015-02-19 19:50:52 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2015-02-19 19:50:52 +0000 |
commit | a747e5935d64a2ccdb8a68da69b736b5a17604d4 (patch) | |
tree | cb857fc1c3860bad9cd689272fe34077ffbc001f /llvm/lib/Support/Unix/Program.inc | |
parent | 745c4710db21ac63c5f96dc669b7eb7001b6377e (diff) | |
download | bcm5719-llvm-a747e5935d64a2ccdb8a68da69b736b5a17604d4.tar.gz bcm5719-llvm-a747e5935d64a2ccdb8a68da69b736b5a17604d4.zip |
Checking if TARGET_OS_IPHONE is defined isn't good enough for 10.7 and earlier.
Older versions of the TargetConditionals header always defined TARGET_OS_IPHONE to something (0 or 1), so we need to test not only for the existence but also if it is 1.
This resolves PR22631.
llvm-svn: 229904
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Program.inc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc index 2ed5597e4ad..baf2767ad58 100644 --- a/llvm/lib/Support/Unix/Program.inc +++ b/llvm/lib/Support/Unix/Program.inc @@ -42,10 +42,18 @@ #define _RESTRICT_KYWD #endif #include <spawn.h> + #if defined(__APPLE__) #include <TargetConditionals.h> #endif -#if !defined(__APPLE__) || defined(TARGET_OS_IPHONE) + +#if defined(__APPLE__) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) +#define USE_NSGETENVIRON 1 +#else +#define USE_NSGETENVIRON 0 +#endif + +#if !USE_NSGETENVIRON extern char **environ; #else #include <crt_externs.h> // _NSGetEnviron @@ -220,7 +228,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args, } if (!envp) -#if !defined(__APPLE__) || defined(TARGET_OS_IPHONE) +#if !USE_NSGETENVIRON envp = const_cast<const char **>(environ); #else // environ is missing in dylibs. |