(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
This commit is contained in:
Autechre 2021-01-21 08:53:16 +01:00 committed by GitHub
parent 7d56bf2b0a
commit 746101010f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);