From c36fce18c435570760bb0da5162a60a184479bd8 Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Mon, 15 Apr 2024 20:56:51 +1000 Subject: [PATCH] gh-117886: platform_triplet.c: check if TARGET_OS_* defined Older macOS SDKs don't define any of these, and some clang versions will error if you use them without first checking if they are defined. --- Misc/platform_triplet.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 06b03bfa9a266a..361f89eb7c670b 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -246,8 +246,8 @@ PLATFORM_TRIPLET=i386-gnu # endif #elif defined(__APPLE__) # include "TargetConditionals.h" -# if TARGET_OS_IOS -# if TARGET_OS_SIMULATOR +# 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 +256,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