[llvm] r229904 - Checking if TARGET_OS_IPHONE is defined isn't good enough for 10.7 and earlier.
Chris Bieneman
beanz at apple.com
Thu Feb 19 11:50:52 PST 2015
Author: cbieneman
Date: Thu Feb 19 13:50:52 2015
New Revision: 229904
URL: http://llvm.org/viewvc/llvm-project?rev=229904&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Support/Unix/Program.inc
Modified: llvm/trunk/lib/Support/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Program.inc?rev=229904&r1=229903&r2=229904&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Program.inc (original)
+++ llvm/trunk/lib/Support/Unix/Program.inc Thu Feb 19 13:50:52 2015
@@ -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, Str
}
if (!envp)
-#if !defined(__APPLE__) || defined(TARGET_OS_IPHONE)
+#if !USE_NSGETENVIRON
envp = const_cast<const char **>(environ);
#else
// environ is missing in dylibs.
More information about the llvm-commits
mailing list