Skip to content

Commit ab99438

Browse files
authored
gh-114099: Modify preprocessor symbol usage to support older macOS SDKs (GH-118073)
Co-authored-by: Joshua Root [email protected]
1 parent 2aa11cc commit ab99438

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
iOS preprocessor symbol usage was made compatible with older macOS SDKs.

Misc/platform_triplet.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ PLATFORM_TRIPLET=i386-gnu
246246
# endif
247247
#elif defined(__APPLE__)
248248
# include "TargetConditionals.h"
249-
# if TARGET_OS_IOS
250-
# if TARGET_OS_SIMULATOR
249+
// Older macOS SDKs do not define TARGET_OS_*
250+
# if defined(TARGET_OS_IOS) && TARGET_OS_IOS
251+
# if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
251252
# if __x86_64__
252253
PLATFORM_TRIPLET=x86_64-iphonesimulator
253254
# else
@@ -256,7 +257,8 @@ PLATFORM_TRIPLET=arm64-iphonesimulator
256257
# else
257258
PLATFORM_TRIPLET=arm64-iphoneos
258259
# endif
259-
# elif TARGET_OS_OSX
260+
// Older macOS SDKs do not define TARGET_OS_OSX
261+
# elif !defined(TARGET_OS_OSX) || TARGET_OS_OSX
260262
PLATFORM_TRIPLET=darwin
261263
# else
262264
# error unknown Apple platform

Modules/_testexternalinspection.c

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
#if defined(__APPLE__)
1919
# include <TargetConditionals.h>
20+
// Older macOS SDKs do not define TARGET_OS_OSX
21+
# if !defined(TARGET_OS_OSX)
22+
# define TARGET_OS_OSX 1
23+
# endif
2024
# if TARGET_OS_OSX
2125
# include <libproc.h>
2226
# include <mach-o/fat.h>

Python/marshal.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ module marshal
4242
#elif defined(__wasi__)
4343
# define MAX_MARSHAL_STACK_DEPTH 1500
4444
// TARGET_OS_IPHONE covers any non-macOS Apple platform.
45-
#elif defined(__APPLE__) && TARGET_OS_IPHONE
45+
// It won't be defined on older macOS SDKs
46+
#elif defined(__APPLE__) && defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
4647
# define MAX_MARSHAL_STACK_DEPTH 1500
4748
#else
4849
# define MAX_MARSHAL_STACK_DEPTH 2000

0 commit comments

Comments
 (0)