From 746101010fd50a4b6ba6f77d9498d35b30a983a2 Mon Sep 17 00:00:00 2001 From: Autechre Date: Thu, 21 Jan 2021 08:53:16 +0100 Subject: [PATCH] (Apple/Clang/ARC) ARC (Automatic Reference Counting) only available (#11920) since Clang. PowerPC Mac is stuck with GCC and predates the use of ARC, __has_feature() also is a Clang extension, so wrap around this with a conditional so that GCC PowerPC on Mac can still work --- ui/drivers/cocoa/cocoa_common.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ui/drivers/cocoa/cocoa_common.h b/ui/drivers/cocoa/cocoa_common.h index 7d3ba53318..63af13f812 100644 --- a/ui/drivers/cocoa/cocoa_common.h +++ b/ui/drivers/cocoa/cocoa_common.h @@ -85,6 +85,8 @@ extern apple_frontend_settings_t apple_frontend_settings; #define BOXUINT(x) [NSNumber numberWithUnsignedInt:x] #define BOXFLOAT(x) [NSNumber numberWithDouble:x] +#if defined(__clang__) +/* ARC is only available for Clang */ #if __has_feature(objc_arc) #define RELEASE(x) x = nil #define BRIDGE __bridge @@ -95,6 +97,14 @@ extern apple_frontend_settings_t apple_frontend_settings; #define BRIDGE #define UNSAFE_UNRETAINED #endif +#else +/* On compilers other than Clang (e.g. GCC), assume ARC + is going to be unavailable */ +#define RELEASE(x) [x release]; \ + x = nil +#define BRIDGE +#define UNSAFE_UNRETAINED +#endif void *nsview_get_ptr(void);