Common.h revision 1b8fbd3601e009803565e74d2ec54abecb5cbf73
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
7#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
8#define CF_CONSUMED __attribute__((cf_consumed))
9
10#define NS_INLINE static __inline__ __attribute__((always_inline))
11#define nil ((void*) 0)
12
13typedef int BOOL;
14typedef unsigned NSUInteger;
15typedef int int32_t;
16typedef unsigned char uint8_t;
17typedef int32_t UChar32;
18typedef unsigned char UChar;
19
20typedef struct _NSZone NSZone;
21
22typedef const void * CFTypeRef;
23CFTypeRef CFRetain(CFTypeRef cf);
24id CFBridgingRelease(CFTypeRef CF_CONSUMED X);
25
26NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
27
28@protocol NSObject
29- (BOOL)isEqual:(id)object;
30- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
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;
35@end
36
37@interface NSObject <NSObject> {}
38- (id)init;
39
40+ (id)new;
41+ (id)alloc;
42- (void)dealloc;
43
44- (void)finalize;
45
46- (id)copy;
47- (id)mutableCopy;
48@end
49
50NS_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
67typedef const void* objc_objectptr_t;
68extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer);
69extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer);
70extern objc_objectptr_t objc_unretainedPointer(id object);
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
77typedef id dispatch_object_t;
78typedef id xpc_object_t;
79
80void _dispatch_object_validate(dispatch_object_t object);
81void _xpc_object_validate(xpc_object_t object);
82