John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 1 | #if __has_feature(objc_arr) |
| 2 | #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) |
| 3 | #else |
| 4 | #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE |
| 5 | #endif |
| 6 | |
Argyrios Kyrtzidis | e0ac745 | 2011-11-04 15:58:08 +0000 | [diff] [blame] | 7 | #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) |
Argyrios Kyrtzidis | 4532b55 | 2011-09-14 18:17:09 +0000 | [diff] [blame] | 8 | #define CF_CONSUMED __attribute__((cf_consumed)) |
| 9 | |
Argyrios Kyrtzidis | e0ac745 | 2011-11-04 15:58:08 +0000 | [diff] [blame] | 10 | #define NS_INLINE static __inline__ __attribute__((always_inline)) |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 11 | #define nil ((void*) 0) |
| 12 | |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 13 | typedef int BOOL; |
| 14 | typedef unsigned NSUInteger; |
| 15 | typedef int int32_t; |
| 16 | typedef unsigned char uint8_t; |
| 17 | typedef int32_t UChar32; |
| 18 | typedef unsigned char UChar; |
| 19 | |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 20 | typedef struct _NSZone NSZone; |
| 21 | |
| 22 | typedef const void * CFTypeRef; |
| 23 | CFTypeRef CFRetain(CFTypeRef cf); |
Argyrios Kyrtzidis | e0ac745 | 2011-11-04 15:58:08 +0000 | [diff] [blame] | 24 | id CFBridgingRelease(CFTypeRef CF_CONSUMED X); |
| 25 | |
| 26 | NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 27 | |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 28 | @protocol NSObject |
| 29 | - (BOOL)isEqual:(id)object; |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 30 | - (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 31 | - (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 32 | - (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 33 | - (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
| 34 | - (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE; |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 35 | @end |
| 36 | |
| 37 | @interface NSObject <NSObject> {} |
| 38 | - (id)init; |
| 39 | |
| 40 | + (id)new; |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 41 | + (id)alloc; |
| 42 | - (void)dealloc; |
| 43 | |
| 44 | - (void)finalize; |
| 45 | |
| 46 | - (id)copy; |
| 47 | - (id)mutableCopy; |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 48 | @end |
| 49 | |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 50 | NS_AUTOMATED_REFCOUNT_UNAVAILABLE |
| 51 | @interface NSAutoreleasePool : NSObject { |
| 52 | @private |
| 53 | void *_token; |
| 54 | void *_reserved3; |
| 55 | void *_reserved2; |
| 56 | void *_reserved; |
| 57 | } |
| 58 | |
| 59 | + (void)addObject:(id)anObject; |
| 60 | |
| 61 | - (void)addObject:(id)anObject; |
| 62 | |
| 63 | - (void)drain; |
| 64 | |
| 65 | @end |
| 66 | |
| 67 | typedef const void* objc_objectptr_t; |
| 68 | extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer); |
| 69 | extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer); |
| 70 | extern objc_objectptr_t objc_unretainedPointer(id object); |
Argyrios Kyrtzidis | 1b8fbd3 | 2012-05-23 21:50:04 +0000 | [diff] [blame] | 71 | |
| 72 | #define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; }) |
| 73 | #define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; }) |
| 74 | #define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; }) |
| 75 | #define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; }) |
| 76 | |
| 77 | typedef id dispatch_object_t; |
| 78 | typedef id xpc_object_t; |
| 79 | |
| 80 | void _dispatch_object_validate(dispatch_object_t object); |
| 81 | void _xpc_object_validate(xpc_object_t object); |