Support older clang versions

This commit is contained in:
Ariel Abreu 2021-06-24 23:19:57 -04:00
parent b32a584e88
commit 9840e980d5
No known key found for this signature in database
GPG Key ID: D67AE16CCEA85B70
2 changed files with 50 additions and 0 deletions

View File

@ -1978,6 +1978,16 @@ void arr_init(void)
_objc_associations_init();
}
#ifdef DARLING
// see libdispatch
#if __has_attribute(objc_nonlazy_class)
#define NONLAZY_CLASS __attribute__((objc_nonlazy_class))
#define NONLAZY_CLASS_LOAD
#else
#define NONLAZY_CLASS
#define NONLAZY_CLASS_LOAD + (void)load {}
#endif
#endif
#if SUPPORT_TAGGED_POINTERS
@ -1987,8 +1997,15 @@ void arr_init(void)
@interface __NSUnrecognizedTaggedPointer : NSObject
@end
#ifdef DARLING
NONLAZY_CLASS
#else
__attribute__((objc_nonlazy_class))
#endif
@implementation __NSUnrecognizedTaggedPointer
#ifdef DARLING
NONLAZY_CLASS_LOAD
#endif
-(id) retain { return self; }
-(oneway void) release { }
-(id) autorelease { return self; }
@ -1996,8 +2013,15 @@ __attribute__((objc_nonlazy_class))
#endif
#ifdef DARLING
NONLAZY_CLASS
#else
__attribute__((objc_nonlazy_class))
#endif
@implementation NSObject
#ifdef DARLING
NONLAZY_CLASS_LOAD
#endif
+ (void)initialize {
}

View File

@ -45,21 +45,47 @@
// by CF, so __IncompleteProtocol would be left without an R/R implementation
// otherwise, which would break ARC.
#ifdef DARLING
// see libdispatch
#if __has_attribute(objc_nonlazy_class)
#define NONLAZY_CLASS __attribute__((objc_nonlazy_class))
#define NONLAZY_CLASS_LOAD
#else
#define NONLAZY_CLASS
#define NONLAZY_CLASS_LOAD + (void)load {}
#endif
#endif
@interface __IncompleteProtocol : NSObject
@end
#if __OBJC2__
#ifdef DARLING
NONLAZY_CLASS
#else
__attribute__((objc_nonlazy_class))
#endif
#endif
@implementation __IncompleteProtocol
#ifdef DARLING
NONLAZY_CLASS_LOAD
#endif
@end
#if __OBJC2__
#ifdef DARLING
NONLAZY_CLASS
#else
__attribute__((objc_nonlazy_class))
#endif
#endif
@implementation Protocol
#ifdef DARLING
NONLAZY_CLASS_LOAD
#endif
- (BOOL) conformsTo: (Protocol *)aProtocolObj
{
return protocol_conformsToProtocol(self, aProtocolObj);