]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114099: Modify preprocessor symbol usage to support older macOS SDKs (GH-118073)
authorRussell Keith-Magee <russell@keith-magee.com>
Fri, 19 Apr 2024 18:56:33 +0000 (02:56 +0800)
committerGitHub <noreply@github.com>
Fri, 19 Apr 2024 18:56:33 +0000 (14:56 -0400)
Co-authored-by: Joshua Root jmr@macports.org
Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst [new file with mode: 0644]
Misc/platform_triplet.c
Modules/_testexternalinspection.c
Python/marshal.c

diff --git a/Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst b/Misc/NEWS.d/next/macOS/2024-04-19-08-40-00.gh-issue-114099._iDfrQ.rst
new file mode 100644 (file)
index 0000000..f9af062
--- /dev/null
@@ -0,0 +1 @@
+iOS preprocessor symbol usage was made compatible with older macOS SDKs.
index 06b03bfa9a266a319b8d5b6ba2eafc6a85b8365b..ec0857a4a998c0bbd4f705488307ca958b466115 100644 (file)
@@ -246,8 +246,9 @@ PLATFORM_TRIPLET=i386-gnu
 # endif
 #elif defined(__APPLE__)
 #  include "TargetConditionals.h"
-#  if TARGET_OS_IOS
-#    if TARGET_OS_SIMULATOR
+// Older macOS SDKs do not define TARGET_OS_*
+#  if defined(TARGET_OS_IOS) && TARGET_OS_IOS
+#    if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
 #      if __x86_64__
 PLATFORM_TRIPLET=x86_64-iphonesimulator
 #      else
@@ -256,7 +257,8 @@ PLATFORM_TRIPLET=arm64-iphonesimulator
 #    else
 PLATFORM_TRIPLET=arm64-iphoneos
 #    endif
-#  elif TARGET_OS_OSX
+// Older macOS SDKs do not define TARGET_OS_OSX
+#  elif !defined(TARGET_OS_OSX) || TARGET_OS_OSX
 PLATFORM_TRIPLET=darwin
 #  else
 #    error unknown Apple platform
index bd77f0cd0f1fc793ac9185528aad34219a5f461c..e2f96cdad5c58ef0430d59902d0447ed3907c051 100644 (file)
 
 #if defined(__APPLE__)
 #  include <TargetConditionals.h>
+// Older macOS SDKs do not define TARGET_OS_OSX
+#  if !defined(TARGET_OS_OSX)
+#     define TARGET_OS_OSX 1
+#  endif
 #  if TARGET_OS_OSX
 #    include <libproc.h>
 #    include <mach-o/fat.h>
index 4274f90206b2405d24112c2738c4d4867ba09bb0..4bd8bb1d3a9308fa5ae2337a954e58ca90e1783c 100644 (file)
@@ -42,7 +42,8 @@ module marshal
 #elif defined(__wasi__)
 #  define MAX_MARSHAL_STACK_DEPTH 1500
 // TARGET_OS_IPHONE covers any non-macOS Apple platform.
-#elif defined(__APPLE__) && TARGET_OS_IPHONE
+// It won't be defined on older macOS SDKs
+#elif defined(__APPLE__) && defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
 #  define MAX_MARSHAL_STACK_DEPTH 1500
 #else
 #  define MAX_MARSHAL_STACK_DEPTH 2000