From d015f0160cfeb3097c8d2321c0bfc648c0885047 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Tue, 12 Feb 2019 09:20:35 +0000 Subject: [PATCH] Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. --- NSBlocks.m | 8 +- alias.h | 2 +- alias_table.c | 4 +- arc.m | 48 ++++----- associate.m | 4 +- blocks_runtime.m | 14 +-- caps.c | 2 +- dtable.h | 4 +- loader.c | 4 +- objc/blocks_runtime.h | 14 +-- objc/capabilities.h | 2 +- objc/hooks.h | 4 +- objc/message.h | 6 +- objc/objc-arc.h | 50 ++++----- objc/objc-visibility.h | 6 +- objc/runtime.h | 224 ++++++++++++++++++++--------------------- objc/slot.h | 2 +- properties.m | 40 ++++---- visibility.h | 2 +- 19 files changed, 220 insertions(+), 220 deletions(-) diff --git a/NSBlocks.m b/NSBlocks.m index c72b3d3..31bf3d1 100644 --- a/NSBlocks.m +++ b/NSBlocks.m @@ -6,9 +6,9 @@ #include "dtable.h" #include -PUBLIC struct objc_class _NSConcreteGlobalBlock; -PUBLIC struct objc_class _NSConcreteStackBlock; -PUBLIC struct objc_class _NSConcreteMallocBlock; +OBJC_PUBLIC struct objc_class _NSConcreteGlobalBlock; +OBJC_PUBLIC struct objc_class _NSConcreteStackBlock; +OBJC_PUBLIC struct objc_class _NSConcreteMallocBlock; static struct objc_class _NSConcreteGlobalBlockMeta; static struct objc_class _NSConcreteStackBlockMeta; @@ -40,7 +40,7 @@ static void createNSBlockSubclass(Class superclass, Class newClass, #define NEW_CLASS(super, sub) \ createNSBlockSubclass(super, &sub, &sub ## Meta, #sub) -PUBLIC +OBJC_PUBLIC BOOL objc_create_block_classes_as_subclasses_of(Class super) { if (_NSBlock.super_class != NULL) { return NO; } diff --git a/alias.h b/alias.h index 4a918fa..fbd4d94 100644 --- a/alias.h +++ b/alias.h @@ -24,4 +24,4 @@ */ #include "objc/runtime.h" -PUBLIC Class alias_getClass(const char *alias_name); +OBJC_PUBLIC Class alias_getClass(const char *alias_name); diff --git a/alias_table.c b/alias_table.c index b1e661c..e6d1071 100644 --- a/alias_table.c +++ b/alias_table.c @@ -77,7 +77,7 @@ static Alias alias_table_get_safe(const char *alias_name) } -PUBLIC Class alias_getClass(const char *alias_name) +OBJC_PUBLIC Class alias_getClass(const char *alias_name) { if (NULL == alias_name) { @@ -99,7 +99,7 @@ PRIVATE void alias_table_insert(Alias alias) alias_table_internal_insert(alias_table, alias); } -PUBLIC BOOL class_registerAlias_np(Class class, const char *alias) +OBJC_PUBLIC BOOL class_registerAlias_np(Class class, const char *alias) { if ((NULL == alias) || (NULL == class)) { diff --git a/arc.m b/arc.m index ea79cf2..bade806 100644 --- a/arc.m +++ b/arc.m @@ -213,14 +213,14 @@ static const long weak_mask = ((size_t)1)<<((sizeof(size_t)*8)-refcount_shift); */ static const long refcount_mask = ~weak_mask; -PUBLIC size_t object_getRetainCount_np(id obj) +OBJC_PUBLIC size_t object_getRetainCount_np(id obj) { uintptr_t *refCount = ((uintptr_t*)obj) - 1; uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0); return (((size_t)refCountVal) & refcount_mask) + 1; } -PUBLIC id objc_retain_fast_np(id obj) +OBJC_PUBLIC id objc_retain_fast_np(id obj) { uintptr_t *refCount = ((uintptr_t*)obj) - 1; uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0); @@ -293,7 +293,7 @@ static inline id retain(id obj) return [obj retain]; } -PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) +OBJC_PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) { uintptr_t *refCount = ((uintptr_t*)obj) - 1; uintptr_t refCountVal = __sync_fetch_and_add(refCount, 0); @@ -331,7 +331,7 @@ PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) return NO; } -PUBLIC void objc_release_fast_np(id obj) +OBJC_PUBLIC void objc_release_fast_np(id obj) { if (objc_release_fast_no_destroy_np(obj)) { @@ -421,7 +421,7 @@ static inline id autorelease(id obj) return [obj autorelease]; } -PUBLIC unsigned long objc_arc_autorelease_count_np(void) +OBJC_PUBLIC unsigned long objc_arc_autorelease_count_np(void) { struct arc_tls* tls = getARCThreadData(); unsigned long count = 0; @@ -435,7 +435,7 @@ PUBLIC unsigned long objc_arc_autorelease_count_np(void) } return count; } -PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj) +OBJC_PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id obj) { struct arc_tls* tls = getARCThreadData(); unsigned long count = 0; @@ -489,7 +489,7 @@ void *objc_autoreleasePoolPush(void) if (0 == NewAutoreleasePool) { return NULL; } return NewAutoreleasePool(AutoreleasePool, SELECTOR(new)); } -PUBLIC void objc_autoreleasePoolPop(void *pool) +OBJC_PUBLIC void objc_autoreleasePoolPop(void *pool) { if (useARCAutoreleasePool) { @@ -512,7 +512,7 @@ PUBLIC void objc_autoreleasePoolPop(void *pool) } } -PUBLIC id objc_autorelease(id obj) +OBJC_PUBLIC id objc_autorelease(id obj) { if (nil != obj) { @@ -521,7 +521,7 @@ PUBLIC id objc_autorelease(id obj) return obj; } -PUBLIC id objc_autoreleaseReturnValue(id obj) +OBJC_PUBLIC id objc_autoreleaseReturnValue(id obj) { if (!useARCAutoreleasePool) { @@ -536,7 +536,7 @@ PUBLIC id objc_autoreleaseReturnValue(id obj) return objc_autorelease(obj); } -PUBLIC id objc_retainAutoreleasedReturnValue(id obj) +OBJC_PUBLIC id objc_retainAutoreleasedReturnValue(id obj) { // If the previous object was released with objc_autoreleaseReturnValue() // just before return, then it will not have actually been autoreleased. @@ -568,36 +568,36 @@ PUBLIC id objc_retainAutoreleasedReturnValue(id obj) return objc_retain(obj); } -PUBLIC id objc_retain(id obj) +OBJC_PUBLIC id objc_retain(id obj) { if (nil == obj) { return nil; } return retain(obj); } -PUBLIC id objc_retainAutorelease(id obj) +OBJC_PUBLIC id objc_retainAutorelease(id obj) { return objc_autorelease(objc_retain(obj)); } -PUBLIC id objc_retainAutoreleaseReturnValue(id obj) +OBJC_PUBLIC id objc_retainAutoreleaseReturnValue(id obj) { if (nil == obj) { return obj; } return objc_autoreleaseReturnValue(retain(obj)); } -PUBLIC id objc_retainBlock(id b) +OBJC_PUBLIC id objc_retainBlock(id b) { return _Block_copy(b); } -PUBLIC void objc_release(id obj) +OBJC_PUBLIC void objc_release(id obj) { if (nil == obj) { return; } release(obj); } -PUBLIC id objc_storeStrong(id *addr, id value) +OBJC_PUBLIC id objc_storeStrong(id *addr, id value) { value = objc_retain(value); id oldValue = *addr; @@ -698,7 +698,7 @@ static inline BOOL weakRefRelease(WeakRef *ref) void* block_load_weak(void *block); -PUBLIC id objc_storeWeak(id *addr, id obj) +OBJC_PUBLIC id objc_storeWeak(id *addr, id obj) { LOCK_FOR_SCOPE(&weakRefLock); WeakRef *oldRef; @@ -789,7 +789,7 @@ PUBLIC id objc_storeWeak(id *addr, id obj) return obj; } -PUBLIC BOOL objc_delete_weak_refs(id obj) +OBJC_PUBLIC BOOL objc_delete_weak_refs(id obj) { LOCK_FOR_SCOPE(&weakRefLock); if (objc_test_class_flag(classForObject(obj), objc_class_flag_fast_arc)) @@ -827,7 +827,7 @@ PUBLIC BOOL objc_delete_weak_refs(id obj) return YES; } -PUBLIC id objc_loadWeakRetained(id* addr) +OBJC_PUBLIC id objc_loadWeakRetained(id* addr) { LOCK_FOR_SCOPE(&weakRefLock); id obj; @@ -865,12 +865,12 @@ PUBLIC id objc_loadWeakRetained(id* addr) return objc_retain(obj); } -PUBLIC id objc_loadWeak(id* object) +OBJC_PUBLIC id objc_loadWeak(id* object) { return objc_autorelease(objc_loadWeakRetained(object)); } -PUBLIC void objc_copyWeak(id *dest, id *src) +OBJC_PUBLIC void objc_copyWeak(id *dest, id *src) { // Don't retain or release. While the weak ref lock is held, we know that // the object can't be deallocated, so we just move the value and update @@ -892,7 +892,7 @@ PUBLIC void objc_copyWeak(id *dest, id *src) } } -PUBLIC void objc_moveWeak(id *dest, id *src) +OBJC_PUBLIC void objc_moveWeak(id *dest, id *src) { // Don't retain or release. While the weak ref lock is held, we know that // the object can't be deallocated, so we just move the value and update @@ -910,12 +910,12 @@ PUBLIC void objc_moveWeak(id *dest, id *src) } } -PUBLIC void objc_destroyWeak(id* obj) +OBJC_PUBLIC void objc_destroyWeak(id* obj) { objc_storeWeak(obj, nil); } -PUBLIC id objc_initWeak(id *object, id value) +OBJC_PUBLIC id objc_initWeak(id *object, id value) { *object = nil; return objc_storeWeak(object, value); diff --git a/associate.m b/associate.m index c895b55..cf8865d 100644 --- a/associate.m +++ b/associate.m @@ -388,7 +388,7 @@ PRIVATE void gc_setTypeForClass(Class cls, void *type) list->gc_type = type; } -PUBLIC +OBJC_PUBLIC int objc_sync_enter(id object) { if ((object == 0) || isSmallObject(object)) { return 0; } @@ -397,7 +397,7 @@ int objc_sync_enter(id object) return 0; } -PUBLIC +OBJC_PUBLIC int objc_sync_exit(id object) { if ((object == 0) || isSmallObject(object)) { return 0; } diff --git a/blocks_runtime.m b/blocks_runtime.m index 233f3e0..3a78461 100644 --- a/blocks_runtime.m +++ b/blocks_runtime.m @@ -39,7 +39,7 @@ static void *_HeapBlockByRef = (void*)1; -PUBLIC _Bool _Block_has_signature(id b) +OBJC_PUBLIC _Bool _Block_has_signature(id b) { const struct Block_layout *block = (struct Block_layout*)b; return ((NULL != block) && (block->flags & BLOCK_HAS_SIGNATURE)); @@ -47,7 +47,7 @@ PUBLIC _Bool _Block_has_signature(id b) /** * Returns the Objective-C type encoding for the block. */ -PUBLIC const char * _Block_signature(id b) +OBJC_PUBLIC const char * _Block_signature(id b) { const struct Block_layout *block = (struct Block_layout*)b; if ((NULL == block) || !(block->flags & BLOCK_HAS_SIGNATURE)) @@ -60,7 +60,7 @@ PUBLIC const char * _Block_signature(id b) } return block->descriptor->encoding; } -PUBLIC const char *block_getType_np(const void *b) +OBJC_PUBLIC const char *block_getType_np(const void *b) { return _Block_signature(b); } @@ -120,7 +120,7 @@ static int cas(void *ptr, void *old, void *new) * the other choices which are mutually exclusive. Only in a Block copy helper * will one see BLOCK_FIELD_IS_BYREF. */ -PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int flags) +OBJC_PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int flags) { //printf("Copying %x to %x with flags %x\n", object, destAddr, flags); // FIXME: Needs to be implemented @@ -199,7 +199,7 @@ PUBLIC void _Block_object_assign(void *destAddr, const void *object, const int f * The same flags used in the copy helper should be used for each call * generated to this function: */ -PUBLIC void _Block_object_dispose(const void *object, const int flags) +OBJC_PUBLIC void _Block_object_dispose(const void *object, const int flags) { // FIXME: Needs to be implemented //if(flags & BLOCK_FIELD_IS_WEAK) @@ -244,7 +244,7 @@ PUBLIC void _Block_object_dispose(const void *object, const int flags) // Copy a block to the heap if it's still on the stack or increments its retain count. -PUBLIC void *_Block_copy(const void *src) +OBJC_PUBLIC void *_Block_copy(const void *src) { if (NULL == src) { return NULL; } struct Block_layout *self = (struct Block_layout*)src; @@ -278,7 +278,7 @@ PUBLIC void *_Block_copy(const void *src) } // Release a block and frees the memory when the retain count hits zero. -PUBLIC void _Block_release(const void *src) +OBJC_PUBLIC void _Block_release(const void *src) { if (NULL == src) { return; } struct Block_layout *self = (struct Block_layout*)src; diff --git a/caps.c b/caps.c index e54ee6e..96a6c1b 100644 --- a/caps.c +++ b/caps.c @@ -34,7 +34,7 @@ static const int32_t caps = #endif 0; -PUBLIC int objc_test_capability(int x) +OBJC_PUBLIC int objc_test_capability(int x) { if (x >= 32) { return 0; } if (caps & (1<dtable != uninstalled_dtable); } -PUBLIC +OBJC_PUBLIC int objc_sync_enter(id object); -PUBLIC +OBJC_PUBLIC int objc_sync_exit(id object); /** * Returns the dtable for a given class. If we are currently in an +initialize diff --git a/loader.c b/loader.c index 29e95d2..7022469 100644 --- a/loader.c +++ b/loader.c @@ -178,7 +178,7 @@ static enum { void registerProtocol(Protocol *proto); -PUBLIC void __objc_load(struct objc_init *init) +OBJC_PUBLIC void __objc_load(struct objc_init *init) { init_runtime(); #ifdef DEBUG_LOADING @@ -313,7 +313,7 @@ PUBLIC void __objc_load(struct objc_init *init) } #ifdef OLDABI_COMPAT -PUBLIC void __objc_exec_class(struct objc_module_abi_8 *module) +OBJC_PUBLIC void __objc_exec_class(struct objc_module_abi_8 *module) { init_runtime(); diff --git a/objc/blocks_runtime.h b/objc/blocks_runtime.h index 5dd762e..030c5c1 100644 --- a/objc/blocks_runtime.h +++ b/objc/blocks_runtime.h @@ -13,15 +13,15 @@ #define BLOCKS_EXPORT extern #endif -PUBLIC BLOCKS_EXPORT void *_Block_copy(const void *); -PUBLIC BLOCKS_EXPORT void _Block_release(const void *); -PUBLIC BLOCKS_EXPORT const char *block_getType_np(const void *b) OBJC_NONPORTABLE; +OBJC_PUBLIC BLOCKS_EXPORT void *_Block_copy(const void *); +OBJC_PUBLIC BLOCKS_EXPORT void _Block_release(const void *); +OBJC_PUBLIC BLOCKS_EXPORT const char *block_getType_np(const void *b) OBJC_NONPORTABLE; #ifdef __OBJC__ -PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(id); -PUBLIC BLOCKS_EXPORT const char * _Block_signature(id); +OBJC_PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(id); +OBJC_PUBLIC BLOCKS_EXPORT const char * _Block_signature(id); #else -PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(void *); -PUBLIC BLOCKS_EXPORT const char * _Block_signature(void *); +OBJC_PUBLIC BLOCKS_EXPORT _Bool _Block_has_signature(void *); +OBJC_PUBLIC BLOCKS_EXPORT const char * _Block_signature(void *); #endif #define Block_copy(x) ((__typeof(x))_Block_copy((const void *)(x))) diff --git a/objc/capabilities.h b/objc/capabilities.h index d09cb9d..97b54d1 100644 --- a/objc/capabilities.h +++ b/objc/capabilities.h @@ -136,7 +136,7 @@ extern "C" { * Run time feature test. This function returns 1 if the runtime supports the * specified feature or 0 if it does not. */ -PUBLIC +OBJC_PUBLIC int objc_test_capability(int x) OBJC_NONPORTABLE; #ifdef __cplusplus } diff --git a/objc/hooks.h b/objc/hooks.h index 8b56a1d..6c6ad33 100644 --- a/objc/hooks.h +++ b/objc/hooks.h @@ -14,7 +14,7 @@ extern "C" { #ifndef OBJC_HOOK -#define OBJC_HOOK PUBLIC extern +#define OBJC_HOOK OBJC_PUBLIC extern #endif struct objc_category; /** @@ -109,7 +109,7 @@ typedef IMP (*objc_tracing_hook)(id, SEL, IMP, int, void*); /** * Registers a tracing hook for a specified selector. */ -PUBLIC int objc_registerTracingHook(SEL, objc_tracing_hook); +OBJC_PUBLIC int objc_registerTracingHook(SEL, objc_tracing_hook); #ifdef __cplusplus } diff --git a/objc/message.h b/objc/message.h index f1395c3..62aadab 100644 --- a/objc/message.h +++ b/objc/message.h @@ -23,7 +23,7 @@ * systems even within the same architecture, so take great care if using this * function for small (two integer) structures. */ -PUBLIC +OBJC_PUBLIC id objc_msgSend(id self, SEL _cmd, ...); /** * Standard message sending function. This function must be cast to the @@ -40,7 +40,7 @@ id objc_msgSend(id self, SEL _cmd, ...); * architecture, so take great care if using this function for small (two * integer) structures. */ -PUBLIC +OBJC_PUBLIC #ifdef __cplusplus id objc_msgSend_stret(id self, SEL _cmd, ...); #else @@ -58,7 +58,7 @@ void objc_msgSend_stret(id self, SEL _cmd, ...); * This version of the function is used for all messages that return floating * point values. */ -PUBLIC +OBJC_PUBLIC long double objc_msgSend_fpret(id self, SEL _cmd, ...); #endif diff --git a/objc/objc-arc.h b/objc/objc-arc.h index a44e9b4..03b10be 100644 --- a/objc/objc-arc.h +++ b/objc/objc-arc.h @@ -13,90 +13,90 @@ extern "C" { /** * Autoreleases the argument. Equivalent to [obj autorelease]. */ -PUBLIC id objc_autorelease(id obj); +OBJC_PUBLIC id objc_autorelease(id obj); /** * Autoreleases a return value. This is equivalent to [obj autorelease], but * may also store the object somewhere where it can be quickly removed without * the need for any message sending. */ -PUBLIC id objc_autoreleaseReturnValue(id obj); +OBJC_PUBLIC id objc_autoreleaseReturnValue(id obj); /** * Initializes object as a weak pointer and stores value in it, or nil if value * has already begun deallocation. */ -PUBLIC id objc_initWeak(id *object, id value); +OBJC_PUBLIC id objc_initWeak(id *object, id value); /** * Loads the object. Returns nil if the object stored at this address has * already begun deallocation. */ -PUBLIC id objc_loadWeak(id* object); +OBJC_PUBLIC id objc_loadWeak(id* object); /** * Loads a weak value and retains it. */ -PUBLIC id objc_loadWeakRetained(id* obj); +OBJC_PUBLIC id objc_loadWeakRetained(id* obj); /** * Retains the argument. Equivalent to [obj retain]. */ -PUBLIC id objc_retain(id obj); +OBJC_PUBLIC id objc_retain(id obj); /** * Retains the argument, assuming that the argument is a normal object and has * its reference count managed by the runtime. * This is intended to implement `-retain` in ARC-compatible root classes. */ -PUBLIC id objc_retain_fast_np(id obj) OBJC_NONPORTABLE; +OBJC_PUBLIC id objc_retain_fast_np(id obj) OBJC_NONPORTABLE; /** * Retains and autoreleases an object. Equivalent to [[obj retain] autorelease]. */ -PUBLIC id objc_retainAutorelease(id obj); +OBJC_PUBLIC id objc_retainAutorelease(id obj); /** * Retains and releases a return value. Equivalent to * objc_retain(objc_autoreleaseReturnValue(obj)). */ -PUBLIC id objc_retainAutoreleaseReturnValue(id obj); +OBJC_PUBLIC id objc_retainAutoreleaseReturnValue(id obj); /** * Retains a return value that has previously been autoreleased and returned. * This is equivalent to objc_retainAutoreleaseReturnValue(), but may support a * fast path, skipping the autorelease pool entirely. */ -PUBLIC id objc_retainAutoreleasedReturnValue(id obj); +OBJC_PUBLIC id objc_retainAutoreleasedReturnValue(id obj); /** * Retains a block. */ -PUBLIC id objc_retainBlock(id b); +OBJC_PUBLIC id objc_retainBlock(id b); /** * Stores value in addr. This first retains value, then releases the old value * at addr, and stores the retained value in the address. */ -PUBLIC id objc_storeStrong(id *addr, id value); +OBJC_PUBLIC id objc_storeStrong(id *addr, id value); /** * Stores obj in zeroing weak pointer addr. If obj has begun deallocation, * then this stores nil. */ -PUBLIC id objc_storeWeak(id *addr, id obj); +OBJC_PUBLIC id objc_storeWeak(id *addr, id obj); /** * Allocates an autorelease pool and pushes it onto the top of the autorelease * pool stack. Note that the returned autorelease pool is not required to be * an object. */ -PUBLIC void *objc_autoreleasePoolPush(void); +OBJC_PUBLIC void *objc_autoreleasePoolPush(void); /** * Pops the specified autorelease pool from the stack, sending release messages * to every object that has been autreleased since the pool was created. */ -PUBLIC void objc_autoreleasePoolPop(void *pool); +OBJC_PUBLIC void objc_autoreleasePoolPop(void *pool); /** * Initializes dest as a weak pointer and stores the value stored in src into * it. */ -PUBLIC void objc_copyWeak(id *dest, id *src); +OBJC_PUBLIC void objc_copyWeak(id *dest, id *src); /** * Destroys addr as a weak pointer. */ -PUBLIC void objc_destroyWeak(id* addr); +OBJC_PUBLIC void objc_destroyWeak(id* addr); /** * Equivalent to objc_copyWeak(), but may also set src to nil. */ -PUBLIC void objc_moveWeak(id *dest, id *src); +OBJC_PUBLIC void objc_moveWeak(id *dest, id *src); /** * Releases the argument, assuming that the argument is a normal object and has * its reference count managed by the runtime. If the retain count reaches @@ -106,7 +106,7 @@ PUBLIC void objc_moveWeak(id *dest, id *src); * This is intended to implement `-release` in ARC-compatible root * classes. */ -PUBLIC void objc_release_fast_np(id obj) OBJC_NONPORTABLE; +OBJC_PUBLIC void objc_release_fast_np(id obj) OBJC_NONPORTABLE; /** * Releases the argument, assuming that the argument is a normal object and has * its reference count managed by the runtime. If the retain count reaches @@ -116,15 +116,15 @@ PUBLIC void objc_release_fast_np(id obj) OBJC_NONPORTABLE; * This is intended to implement `NSDecrementExtraRefCountWasZero` for use with * ARC-compatible classes. */ -PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) OBJC_NONPORTABLE; +OBJC_PUBLIC BOOL objc_release_fast_no_destroy_np(id obj) OBJC_NONPORTABLE; /** * Returns the retain count of an object. */ -PUBLIC size_t object_getRetainCount_np(id obj) OBJC_NONPORTABLE; +OBJC_PUBLIC size_t object_getRetainCount_np(id obj) OBJC_NONPORTABLE; /** * Releases an object. Equivalent to [obj release]. */ -PUBLIC void objc_release(id obj); +OBJC_PUBLIC void objc_release(id obj); /** * Mark the object as about to begin deallocation. All subsequent reads of * weak pointers will return 0. This function should be called in -release, @@ -134,16 +134,16 @@ PUBLIC void objc_release(id obj); * * Nonstandard extension. */ -PUBLIC BOOL objc_delete_weak_refs(id obj); +OBJC_PUBLIC BOOL objc_delete_weak_refs(id obj); /** * Returns the total number of objects in the ARC-managed autorelease pool. */ -PUBLIC unsigned long objc_arc_autorelease_count_np(void); +OBJC_PUBLIC unsigned long objc_arc_autorelease_count_np(void); /** * Returns the total number of times that an object has been autoreleased in * this thread. */ -PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id); +OBJC_PUBLIC unsigned long objc_arc_autorelease_count_for_object_np(id); #ifdef __cplusplus } diff --git a/objc/objc-visibility.h b/objc/objc-visibility.h index 0c4ef1b..4999638 100644 --- a/objc/objc-visibility.h +++ b/objc/objc-visibility.h @@ -1,9 +1,9 @@ #if defined _WIN32 || defined __CYGWIN__ # ifdef __OBJC_RUNTIME_INTERNAL__ -# define PUBLIC __attribute__((dllexport)) +# define OBJC_PUBLIC __attribute__((dllexport)) # else -# define PUBLIC __attribute__((dllimport)) +# define OBJC_PUBLIC __attribute__((dllimport)) # endif #else -# define PUBLIC +# define OBJC_PUBLIC #endif diff --git a/objc/runtime.h b/objc/runtime.h index ca19bf1..5dd8a75 100644 --- a/objc/runtime.h +++ b/objc/runtime.h @@ -225,7 +225,7 @@ typedef struct * registered by the runtime. The alignment must be the base-2 logarithm of * the alignment requirement and the types should be an Objective-C type encoding. */ -PUBLIC +OBJC_PUBLIC BOOL class_addIvar(Class cls, const char *name, size_t size, @@ -235,13 +235,13 @@ BOOL class_addIvar(Class cls, /** * Adds a method to the class. */ -PUBLIC +OBJC_PUBLIC BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types); /** * Adds a protocol to the class. */ -PUBLIC +OBJC_PUBLIC BOOL class_addProtocol(Class cls, Protocol *protocol); /** @@ -249,7 +249,7 @@ BOOL class_addProtocol(Class cls, Protocol *protocol); * name are regarded as equivalent, even if they have different methods. This * behaviour will change in a future version. */ -PUBLIC +OBJC_PUBLIC BOOL class_conformsToProtocol(Class cls, Protocol *protocol); /** @@ -257,7 +257,7 @@ BOOL class_conformsToProtocol(Class cls, Protocol *protocol); * the outCount argument is set to the number of instance variables returned. * The caller is responsible for freeing the returned buffer. */ -PUBLIC +OBJC_PUBLIC Ivar* class_copyIvarList(Class cls, unsigned int *outCount); /** @@ -265,7 +265,7 @@ Ivar* class_copyIvarList(Class cls, unsigned int *outCount); * outCount argument is set to the number of methods returned. The caller is * responsible for freeing the returned buffer. */ -PUBLIC +OBJC_PUBLIC Method * class_copyMethodList(Class cls, unsigned int *outCount); /** @@ -273,7 +273,7 @@ Method * class_copyMethodList(Class cls, unsigned int *outCount); * the outCount argument is set to the number of declared properties returned. * The caller is responsible for freeing the returned buffer. */ -PUBLIC +OBJC_PUBLIC objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount); /** @@ -281,13 +281,13 @@ objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount); * outCount argument is set to the number of protocols returned. The caller is * responsible for freeing the returned buffer. */ -PUBLIC +OBJC_PUBLIC Protocol *__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount); /** * Creates an instance of this class, allocating memory using malloc. */ -PUBLIC +OBJC_PUBLIC id class_createInstance(Class cls, size_t extraBytes); /** @@ -295,7 +295,7 @@ id class_createInstance(Class cls, size_t extraBytes); * class. This is an opaque data type and must be accessed with the method_*() * family of functions. */ -PUBLIC +OBJC_PUBLIC Method class_getClassMethod(Class aClass, SEL aSelector); /** @@ -303,7 +303,7 @@ Method class_getClassMethod(Class aClass, SEL aSelector); * this class. This is an opaque data type and must be accessed with the * ivar_*() family of functions. */ -PUBLIC +OBJC_PUBLIC Ivar class_getClassVariable(Class cls, const char* name); /** @@ -311,7 +311,7 @@ Ivar class_getClassVariable(Class cls, const char* name); * in this class. This is an opaque data type and must be accessed with the * method_*() family of functions. */ -PUBLIC +OBJC_PUBLIC Method class_getInstanceMethod(Class aClass, SEL aSelector); /** @@ -319,7 +319,7 @@ Method class_getInstanceMethod(Class aClass, SEL aSelector); * class's superclasses must be loaded before this call, or the result is * undefined with the non-fragile ABI. */ -PUBLIC +OBJC_PUBLIC size_t class_getInstanceSize(Class cls); /** @@ -327,26 +327,26 @@ size_t class_getInstanceSize(Class cls); * returning a pointer to the instance variable definition or a null * pointer if no instance variable of that name was found. */ -PUBLIC +OBJC_PUBLIC Ivar class_getInstanceVariable(Class cls, const char* name); /** * Sets the object value of a specified instance variable. */ -PUBLIC +OBJC_PUBLIC void object_setIvar(id object, Ivar ivar, id value); /** * Sets a named instance variable to the value specified by *value. Note that * the instance variable must be a pointer-sized quantity. */ -PUBLIC +OBJC_PUBLIC Ivar object_setInstanceVariable(id obj, const char *name, void *value); /** * Returns the value of the named instance variable. This should not be used * with instance variables that are not pointers. */ -PUBLIC +OBJC_PUBLIC id object_getIvar(id object, Ivar ivar); /** @@ -355,7 +355,7 @@ id object_getIvar(id object, Ivar ivar); * * Note that the instance variable must be a pointer-sized quantity. */ -PUBLIC +OBJC_PUBLIC Ivar object_getInstanceVariable(id obj, const char *name, void **outValue); /** @@ -363,62 +363,62 @@ Ivar object_getInstanceVariable(id obj, const char *name, void **outValue); * the receiver does not have a method corresponding to this message then this * function may return a runtime function that performs forwarding. */ -PUBLIC +OBJC_PUBLIC IMP class_getMethodImplementation(Class cls, SEL name); /** * Identical to class_getMethodImplementation(). */ -PUBLIC +OBJC_PUBLIC IMP class_getMethodImplementation_stret(Class cls, SEL name); /** * Returns the name of the class. This string is owned by the runtime and is * valid for (at least) as long as the class remains loaded. */ -PUBLIC +OBJC_PUBLIC const char * class_getName(Class cls); /** * Retrieves metadata about the property with the specified name. */ -PUBLIC +OBJC_PUBLIC objc_property_t class_getProperty(Class cls, const char *name); /** * Returns the superclass of the specified class. */ -PUBLIC +OBJC_PUBLIC Class class_getSuperclass(Class cls); /** * Returns the version of the class. Currently, the class version is not used * inside the runtime at all, however it may be used for the developer-mode ABI. */ -PUBLIC +OBJC_PUBLIC int class_getVersion(Class theClass); /** * Sets the version for this class. */ -PUBLIC +OBJC_PUBLIC void class_setVersion(Class theClass, int version); -PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables") +OBJC_PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables") const char *class_getWeakIvarLayout(Class cls); /** * Returns whether the class is a metaclass. This can be used in conjunction * with object_getClass() for differentiating between objects and classes. */ -PUBLIC +OBJC_PUBLIC BOOL class_isMetaClass(Class cls); /** * Registers an alias for the class. Returns YES if the alias could be * registered successfully. */ -PUBLIC OBJC_NONPORTABLE +OBJC_PUBLIC OBJC_NONPORTABLE BOOL class_registerAlias_np(Class cls, const char *alias); /** @@ -426,7 +426,7 @@ BOOL class_registerAlias_np(Class cls, const char *alias); * Objective-C runtime uses typed selectors, however the types of the selector * will be ignored and a new selector registered with the specified types. */ -PUBLIC +OBJC_PUBLIC IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types); /** @@ -435,20 +435,20 @@ IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types); * or more of the various forwarding mechanisms, then this will still return * NO. */ -PUBLIC +OBJC_PUBLIC BOOL class_respondsToSelector(Class cls, SEL sel); /** * Returns the instance variable layout of this class as an opaque list that * can be applied to other classes. */ -PUBLIC +OBJC_PUBLIC const char *class_getIvarLayout(Class cls); /** * Sets the class's instance variable layout. The layout argument must be a * value returned by class_getIvarLayout(). */ -PUBLIC +OBJC_PUBLIC void class_setIvarLayout(Class cls, const char *layout); /** @@ -456,29 +456,29 @@ void class_setIvarLayout(Class cls, const char *layout); * because modifying the superclass of a class at run time is a very complex * operation and this function is almost always used incorrectly. */ -PUBLIC __attribute__((deprecated)) +OBJC_PUBLIC __attribute__((deprecated)) Class class_setSuperclass(Class cls, Class newSuper); -PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables") +OBJC_PUBLIC OBJC_GNUSTEP_RUNTIME_UNSUPPORTED("Weak instance variables") void class_setWeakIvarLayout(Class cls, const char *layout); /** * Returns the name of an instance variable. */ -PUBLIC +OBJC_PUBLIC const char* ivar_getName(Ivar ivar); /** * Returns the offset of an instance variable. This value can be added to the * object pointer to get the address of the instance variable. */ -PUBLIC +OBJC_PUBLIC ptrdiff_t ivar_getOffset(Ivar ivar); /** * Returns the Objective-C type encoding of the instance variable. */ -PUBLIC +OBJC_PUBLIC const char* ivar_getTypeEncoding(Ivar ivar); /** @@ -487,14 +487,14 @@ const char* ivar_getTypeEncoding(Ivar ivar); * Objective-C method will be the self and _cmd parameters, so the returned * value will be "@" and ":" respectively. */ -PUBLIC +OBJC_PUBLIC char* method_copyArgumentType(Method method, unsigned int index); /** * Copies the type encoding of an argument of this method. The caller is * responsible for freeing the returned C string. */ -PUBLIC +OBJC_PUBLIC char* method_copyReturnType(Method method); /** @@ -502,7 +502,7 @@ char* method_copyReturnType(Method method); * expensive on the GNUstep runtime and its use is discouraged. It is * recommended that users call class_replaceMethod() instead. */ -PUBLIC +OBJC_PUBLIC void method_exchangeImplementations(Method m1, Method m2); /** @@ -512,13 +512,13 @@ void method_exchangeImplementations(Method m1, Method m2); * output string if there is enough space for the argument type and the NULL * terminator. Its use is therefore discouraged. */ -PUBLIC +OBJC_PUBLIC void method_getArgumentType(Method method, unsigned int index, char *dst, size_t dst_len); /** * Returns a pointer to the function used to implement this method. */ -PUBLIC +OBJC_PUBLIC IMP method_getImplementation(Method method); /** @@ -528,14 +528,14 @@ IMP method_getImplementation(Method method); * although calling method_getTypeEncoding() is faster if you just require the * types. */ -PUBLIC +OBJC_PUBLIC SEL method_getName(Method method); /** * Returns the number of arguments (including self and _cmd) that this method * expects. */ -PUBLIC +OBJC_PUBLIC unsigned method_getNumberOfArguments(Method method); /** @@ -545,7 +545,7 @@ unsigned method_getNumberOfArguments(Method method); * output string if there is enough space for the argument type and the NULL * terminator. Its use is therefore discouraged. */ -PUBLIC +OBJC_PUBLIC void method_getReturnType(Method method, char *dst, size_t dst_len); /** @@ -553,7 +553,7 @@ void method_getReturnType(Method method, char *dst, size_t dst_len); * runtime and will persist for (at least) as long as the class owning the * method is loaded. */ -PUBLIC +OBJC_PUBLIC const char * method_getTypeEncoding(Method method); /** @@ -561,7 +561,7 @@ const char * method_getTypeEncoding(Method method); * expensive with the GNUstep runtime and its use is discouraged. It is * recommended that you call class_replaceMethod() instead. */ -PUBLIC +OBJC_PUBLIC IMP method_setImplementation(Method method, IMP imp); /** @@ -570,7 +570,7 @@ IMP method_setImplementation(Method method, IMP imp); * used for class variables by adding instance variables to the returned * metaclass. */ -PUBLIC +OBJC_PUBLIC Class objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes); /** @@ -578,7 +578,7 @@ Class objc_allocateClassPair(Class superclass, const char *name, size_t extraByt * attempts to send messages to instances of this class or its subclasses * result in undefined behaviour. */ -PUBLIC +OBJC_PUBLIC void objc_disposeClassPair(Class cls); /** @@ -587,7 +587,7 @@ void objc_disposeClassPair(Class cls); * loaded, it calls the _objc_lookup_class() callback to allow an external * library to load the module providing this class. */ -PUBLIC +OBJC_PUBLIC id objc_getClass(const char *name); /** @@ -596,21 +596,21 @@ id objc_getClass(const char *name); * is 0, it returns the total number of classes registered with the runtime. * Otherwise, it copies classes and returns the number copied. */ -PUBLIC +OBJC_PUBLIC int objc_getClassList(Class *buffer, int bufferLen); /** * Returns a copy of the list of all classes in the system. The caller is * responsible for freeing this list. The number of classes is returned in the * parameter. */ -PUBLIC +OBJC_PUBLIC Class *objc_copyClassList(unsigned int *outCount); /** * Returns the metaclass with the specified name. This is equivalent to * calling object_getClass() on the result of objc_getClass(). */ -PUBLIC +OBJC_PUBLIC id objc_getMetaClass(const char *name); /** @@ -618,20 +618,20 @@ id objc_getMetaClass(const char *name); * function should generally only be called early on in a program, to ensure * that all required libraries are loaded. */ -PUBLIC +OBJC_PUBLIC id objc_getRequiredClass(const char *name); /** * Looks up the class with the specified name, but does not invoke any * external lazy loading mechanisms. */ -PUBLIC +OBJC_PUBLIC id objc_lookUpClass(const char *name); /** * Returns the protocol with the specified name. */ -PUBLIC +OBJC_PUBLIC Protocol *objc_getProtocol(const char *name); /** * Allocates a new protocol. This returns NULL if a protocol with the same @@ -640,18 +640,18 @@ Protocol *objc_getProtocol(const char *name); * Protocols are immutable after they have been registered, so may only be * modified between calling this function and calling objc_registerProtocol(). */ -PUBLIC +OBJC_PUBLIC Protocol *objc_allocateProtocol(const char *name); /** * Registers a protocol with the runtime. After this point, the protocol may * not be modified. */ -PUBLIC +OBJC_PUBLIC void objc_registerProtocol(Protocol *proto); /** * Adds a method to the protocol. */ -PUBLIC +OBJC_PUBLIC void protocol_addMethodDescription(Protocol *aProtocol, SEL name, const char *types, @@ -660,12 +660,12 @@ void protocol_addMethodDescription(Protocol *aProtocol, /** * Adds a protocol to the protocol. */ -PUBLIC +OBJC_PUBLIC void protocol_addProtocol(Protocol *aProtocol, Protocol *addition); /** * Adds a property to the protocol. */ -PUBLIC +OBJC_PUBLIC void protocol_addProperty(Protocol *aProtocol, const char *name, const objc_property_attribute_t *attributes, @@ -680,7 +680,7 @@ void protocol_addProperty(Protocol *aProtocol, * adding instance variables and methods to it. A class can not have instance * variables added to it after objc_registerClassPair() has been called. */ -PUBLIC +OBJC_PUBLIC void objc_registerClassPair(Class cls); /** @@ -688,7 +688,7 @@ void objc_registerClassPair(Class cls); * object. This is a pointer to the storage specified with the extraBytes * parameter given when allocating an object. */ -PUBLIC +OBJC_PUBLIC void *object_getIndexedIvars(id obj); // FIXME: The GNU runtime has a version of this which omits the size parameter @@ -697,35 +697,35 @@ void *object_getIndexedIvars(id obj); /** * Free an object created with class_createInstance(). */ -PUBLIC +OBJC_PUBLIC id object_dispose(id obj); /** * Returns the class of the object. Note: the isa pointer should not be * accessed directly with the GNUstep runtime. */ -PUBLIC +OBJC_PUBLIC Class object_getClass(id obj); /** * Sets the class of the object. Note: the isa pointer should not be * accessed directly with the GNUstep runtime. */ -PUBLIC +OBJC_PUBLIC Class object_setClass(id obj, Class cls); /** * Returns the name of the class of the object. This is equivalent to calling * class_getName() on the result of object_getClass(). */ -PUBLIC +OBJC_PUBLIC const char *object_getClassName(id obj); /** * Returns the name of a specified property. */ -PUBLIC +OBJC_PUBLIC const char *property_getName(objc_property_t property); /** @@ -734,13 +734,13 @@ const char *property_getName(objc_property_t property); * description of the format for this string may be found in Apple's * Objective-C Runtime Programming Guide. */ -PUBLIC +OBJC_PUBLIC const char *property_getAttributes(objc_property_t property); /** * Returns an array of attributes for this property. */ -PUBLIC +OBJC_PUBLIC objc_property_attribute_t *property_copyAttributeList(objc_property_t property, unsigned int *outCount); /** @@ -748,7 +748,7 @@ objc_property_attribute_t *property_copyAttributeList(objc_property_t property, * that this only sets the property metadata. The property accessor methods * must already be created. */ -PUBLIC +OBJC_PUBLIC BOOL class_addProperty(Class cls, const char *name, const objc_property_attribute_t *attributes, @@ -758,7 +758,7 @@ BOOL class_addProperty(Class cls, * Replaces property metadata. If the property does not exist, then this is * equivalent to calling class_addProperty(). */ -PUBLIC +OBJC_PUBLIC void class_replaceProperty(Class cls, const char *name, const objc_property_attribute_t *attributes, @@ -767,14 +767,14 @@ void class_replaceProperty(Class cls, /** * Returns a copy of a single attribute. */ -PUBLIC +OBJC_PUBLIC char *property_copyAttributeValue(objc_property_t property, const char *attributeName); /** * Testswhether a protocol conforms to another protocol. */ -PUBLIC +OBJC_PUBLIC BOOL protocol_conformsToProtocol(Protocol *p, Protocol *other); /** @@ -782,7 +782,7 @@ BOOL protocol_conformsToProtocol(Protocol *p, Protocol *other); * the array in the variable pointed to by the last parameter. The caller is * responsible for freeing this array. */ -PUBLIC +OBJC_PUBLIC struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p, BOOL isRequiredMethod, BOOL isInstanceMethod, unsigned int *count); @@ -791,7 +791,7 @@ struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p, * stored in the variable pointed to by the last argument. The caller is * responsible for freeing the returned array. */ -PUBLIC +OBJC_PUBLIC objc_property_t *protocol_copyPropertyList(Protocol *p, unsigned int *count); /** @@ -799,7 +799,7 @@ objc_property_t *protocol_copyPropertyList(Protocol *p, unsigned int *count); * being stored in the variable pointed to by the last argument. The caller is * responsible for freeing the returned array. */ -PUBLIC +OBJC_PUBLIC objc_property_t *protocol_copyPropertyList2(Protocol *p, unsigned int *count, BOOL isRequiredProperty, BOOL isInstanceProperty); @@ -808,7 +808,7 @@ objc_property_t *protocol_copyPropertyList2(Protocol *p, unsigned int *count, * number of protocols in the array being returned via the last argument. The * caller is responsible for freeing this array. */ -PUBLIC +OBJC_PUBLIC Protocol *__unsafe_unretained*protocol_copyProtocolList(Protocol *p, unsigned int *count); /** @@ -819,13 +819,13 @@ Protocol *__unsafe_unretained*protocol_copyProtocolList(Protocol *p, unsigned in * * The caller is responsible for freeing the returned array. */ -PUBLIC +OBJC_PUBLIC Protocol *__unsafe_unretained*objc_copyProtocolList(unsigned int *outCount); /** * Returns the method description for the specified method within a given * protocol. */ -PUBLIC +OBJC_PUBLIC struct objc_method_description protocol_getMethodDescription(Protocol *p, SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod); @@ -836,20 +836,20 @@ struct objc_method_description protocol_getMethodDescription(Protocol *p, * implementation and so its semantics may change in the future and this * runtime may diverge from Apple's. */ -PUBLIC +OBJC_PUBLIC const char *_protocol_getMethodTypeEncoding(Protocol *p, SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod); /** * Returns the name of the specified protocol. */ -PUBLIC +OBJC_PUBLIC const char* protocol_getName(Protocol *p); /** * Returns the property metadata for the property with the specified name. */ -PUBLIC +OBJC_PUBLIC objc_property_t protocol_getProperty(Protocol *p, const char *name, BOOL isRequiredProperty, BOOL isInstanceProperty); @@ -859,7 +859,7 @@ objc_property_t protocol_getProperty(Protocol *p, const char *name, * which made not attempt to unique protocols (or even register them with the * runtime). */ -PUBLIC +OBJC_PUBLIC BOOL protocol_isEqual(Protocol *p, Protocol *other); /** @@ -867,25 +867,25 @@ BOOL protocol_isEqual(Protocol *p, Protocol *other); * the function (either a method or a forwarding hook) that should be called in * response to a given message. */ -PUBLIC +OBJC_PUBLIC IMP objc_msg_lookup(id, SEL) OBJC_NONPORTABLE; /** * The message lookup function used for messages sent to super in the GCC ABI. * This specifies both the class and the */ -PUBLIC +OBJC_PUBLIC IMP objc_msg_lookup_super(struct objc_super*, SEL) OBJC_NONPORTABLE; /** * Returns the name of the specified selector. */ -PUBLIC +OBJC_PUBLIC const char *sel_getName(SEL sel); /** * Registers a selector with the runtime. This is equivalent to sel_registerName(). */ -PUBLIC +OBJC_PUBLIC SEL sel_getUid(const char *selName); /** @@ -898,26 +898,26 @@ SEL sel_getUid(const char *selName); * both b and c are typed selectors with different types, then then the first * two will return YES, but the third case will return NO. */ -PUBLIC +OBJC_PUBLIC BOOL sel_isEqual(SEL sel1, SEL sel2); /** * Registers an untyped selector with the runtime. */ -PUBLIC +OBJC_PUBLIC SEL sel_registerName(const char *selName); /** * Register a typed selector. */ -PUBLIC +OBJC_PUBLIC SEL sel_registerTypedName_np(const char *selName, const char *types) OBJC_NONPORTABLE; /** * Returns the type encoding associated with a selector, or the empty string is * there is no such type. */ -PUBLIC +OBJC_PUBLIC const char *sel_getType_np(SEL aSel) OBJC_NONPORTABLE; /** @@ -928,7 +928,7 @@ const char *sel_getType_np(SEL aSel) OBJC_NONPORTABLE; * once with a relatively small on-stack buffer and then only call it again * with a heap-allocated buffer if there is not enough space. */ -PUBLIC +OBJC_PUBLIC unsigned sel_copyTypes_np(const char *selName, const char **types, unsigned count) OBJC_NONPORTABLE; /** @@ -939,14 +939,14 @@ unsigned sel_copyTypes_np(const char *selName, const char **types, unsigned coun * once with a relatively small on-stack buffer and then only call it again * with a heap-allocated buffer if there is not enough space. */ -PUBLIC +OBJC_PUBLIC unsigned sel_copyTypedSelectors_np(const char *selName, SEL *const sels, unsigned count) OBJC_NONPORTABLE; /** * New ABI lookup function. Receiver may be modified during lookup or proxy * forwarding and the sender may affect how lookup occurs. */ -PUBLIC +OBJC_PUBLIC extern struct objc_slot *objc_msg_lookup_sender(id *receiver, SEL selector, id sender) OBJC_NONPORTABLE OBJC_DEPRECATED; @@ -954,7 +954,7 @@ extern struct objc_slot *objc_msg_lookup_sender(id *receiver, SEL selector, id s * Deprecated function for accessing a slot without going via any forwarding * mechanisms. */ -PUBLIC +OBJC_PUBLIC extern struct objc_slot *objc_get_slot(Class, SEL) OBJC_NONPORTABLE OBJC_DEPRECATED; @@ -964,7 +964,7 @@ extern struct objc_slot *objc_get_slot(Class, SEL) * counter. If this value is equal to `objc_method_cache_version` then the * slot is safe to reuse without performing another lookup. */ -PUBLIC +OBJC_PUBLIC extern struct objc_slot2 *objc_get_slot2(Class, SEL, uint64_t*) OBJC_NONPORTABLE; @@ -974,14 +974,14 @@ extern struct objc_slot2 *objc_get_slot2(Class, SEL, uint64_t*) * counter. If this value is equal to `objc_method_cache_version` then the * slot is safe to reuse without performing another lookup. */ -PUBLIC +OBJC_PUBLIC extern struct objc_slot2 *objc_slot_lookup_version(id *receiver, SEL selector, uint64_t*) OBJC_NONPORTABLE; /** * Look up a slot, invoking any required forwarding mechanisms. */ -PUBLIC +OBJC_PUBLIC extern IMP objc_msg_lookup2(id *receiver, SEL selector) OBJC_NONPORTABLE; /** @@ -989,7 +989,7 @@ extern IMP objc_msg_lookup2(id *receiver, SEL selector) OBJC_NONPORTABLE; * pointer. If the class can be registered, then this returns YES. The second * argument specifies the bit pattern to use to identify the small object. */ -PUBLIC +OBJC_PUBLIC BOOL objc_registerSmallObjectClass_np(Class cls, uintptr_t classId); /** @@ -1053,7 +1053,7 @@ typedef uintptr_t objc_AssociationPolicy; * Returns an object previously stored by calling objc_setAssociatedObject() * with the same arguments, or nil if none exists. */ -PUBLIC +OBJC_PUBLIC id objc_getAssociatedObject(id object, void *key); /** * Associates an object with another. This provides a mechanism for storing @@ -1063,12 +1063,12 @@ id objc_getAssociatedObject(id object, void *key); * value may be any object, but must respond to -copy or -retain, and -release, * if an association policy of copy or retain is passed as the final argument. */ -PUBLIC +OBJC_PUBLIC void objc_setAssociatedObject(id object, void *key, id value, objc_AssociationPolicy policy); /** * Removes all associations from an object. */ -PUBLIC +OBJC_PUBLIC void objc_removeAssociatedObjects(id object); /** @@ -1076,7 +1076,7 @@ void objc_removeAssociatedObjects(id object); * take an object pointer (self) as its first argument, and then the same * arguments as the method. */ -PUBLIC +OBJC_PUBLIC IMP imp_implementationWithBlock(void *block); /** * Returns the type encoding of an IMP that would be returned by passing the @@ -1084,49 +1084,49 @@ IMP imp_implementationWithBlock(void *block); * block encoding for transforming to an IMP (it must take id as its first * argument). The caller is responsible for freeing the returned value. */ -PUBLIC +OBJC_PUBLIC char *block_copyIMPTypeEncoding_np(void*block); /** * Returns the block that was used in an IMP created by * imp_implementationWithBlock(). The result of calling this function with any * other IMP is undefined. */ -PUBLIC +OBJC_PUBLIC void *imp_getBlock(IMP anImp); /** * Removes a block that was converted to an IMP with * imp_implementationWithBlock(). The result of calling this function with any * other IMP is undefined. Returns YES on success, NO on failure. */ -PUBLIC +OBJC_PUBLIC BOOL imp_removeBlock(IMP anImp); /** * Adds a method to a specific object, This method will not be added to any * other instances of the same class. */ -PUBLIC +OBJC_PUBLIC BOOL object_addMethod_np(id object, SEL name, IMP imp, const char *types); /** * Replaces a method on a specific object, This method will not be added to * any other instances of the same class. */ -PUBLIC +OBJC_PUBLIC IMP object_replaceMethod_np(id object, SEL name, IMP imp, const char *types); /** * Creates a clone, in the JavaScript sense - an object which inherits both * associated references and methods from the original object. */ -PUBLIC +OBJC_PUBLIC id object_clone_np(id object); /** * Returns the prototype of the object if it was created with * object_clone_np(), or nil otherwise. */ -PUBLIC +OBJC_PUBLIC id object_getPrototype_np(id object); /** @@ -1147,7 +1147,7 @@ id object_getPrototype_np(id object); * This currently sets a global value. In the future, it may be configurable * on a per-thread basis. */ -PUBLIC +OBJC_PUBLIC int objc_set_apple_compatible_objcxx_exceptions(int newValue) OBJC_NONPORTABLE; diff --git a/objc/slot.h b/objc/slot.h index dbd8ada..68ed478 100644 --- a/objc/slot.h +++ b/objc/slot.h @@ -23,7 +23,7 @@ struct objc_slot2 * invalid, for example if a subclass loads a category containing methods that * were inherited from the superclass. */ -PUBLIC extern _Atomic(uint64_t) objc_method_cache_version; +OBJC_PUBLIC extern _Atomic(uint64_t) objc_method_cache_version; /** * Legacy cache structure. This is no longer maintained in the runtime and is diff --git a/properties.m b/properties.m index 8b8467c..37bf4cc 100644 --- a/properties.m +++ b/properties.m @@ -18,7 +18,7 @@ PRIVATE int spinlocks[spinlock_count]; /** * Public function for getting a property. */ -PUBLIC +OBJC_PUBLIC id objc_getProperty(id obj, SEL _cmd, ptrdiff_t offset, BOOL isAtomic) { if (nil == obj) { return nil; } @@ -46,7 +46,7 @@ id objc_getProperty(id obj, SEL _cmd, ptrdiff_t offset, BOOL isAtomic) return ret; } -PUBLIC +OBJC_PUBLIC void objc_setProperty(id obj, SEL _cmd, ptrdiff_t offset, id arg, BOOL isAtomic, BOOL isCopy) { if (nil == obj) { return; } @@ -87,7 +87,7 @@ void objc_setProperty(id obj, SEL _cmd, ptrdiff_t offset, id arg, BOOL isAtomic, objc_release(old); } -PUBLIC +OBJC_PUBLIC void objc_setProperty_atomic(id obj, SEL _cmd, id arg, ptrdiff_t offset) { char *addr = (char*)obj; @@ -101,7 +101,7 @@ void objc_setProperty_atomic(id obj, SEL _cmd, id arg, ptrdiff_t offset) objc_release(old); } -PUBLIC +OBJC_PUBLIC void objc_setProperty_atomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset) { char *addr = (char*)obj; @@ -116,7 +116,7 @@ void objc_setProperty_atomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset) objc_release(old); } -PUBLIC +OBJC_PUBLIC void objc_setProperty_nonatomic(id obj, SEL _cmd, id arg, ptrdiff_t offset) { char *addr = (char*)obj; @@ -127,7 +127,7 @@ void objc_setProperty_nonatomic(id obj, SEL _cmd, id arg, ptrdiff_t offset) objc_release(old); } -PUBLIC +OBJC_PUBLIC void objc_setProperty_nonatomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset) { char *addr = (char*)obj; @@ -137,7 +137,7 @@ void objc_setProperty_nonatomic_copy(id obj, SEL _cmd, id arg, ptrdiff_t offset) objc_release(old); } -PUBLIC +OBJC_PUBLIC void objc_copyCppObjectAtomic(void *dest, const void *src, void (*copyHelper) (void *dest, const void *source)) { @@ -150,7 +150,7 @@ void objc_copyCppObjectAtomic(void *dest, const void *src, unlock_spinlock(lock2); } -PUBLIC +OBJC_PUBLIC void objc_getCppObjectAtomic(void *dest, const void *src, void (*copyHelper) (void *dest, const void *source)) { @@ -160,7 +160,7 @@ void objc_getCppObjectAtomic(void *dest, const void *src, unlock_spinlock(lock); } -PUBLIC +OBJC_PUBLIC void objc_setCppObjectAtomic(void *dest, const void *src, void (*copyHelper) (void *dest, const void *source)) { @@ -177,7 +177,7 @@ void objc_setCppObjectAtomic(void *dest, const void *src, * pointers corresponds to the object, which causes some excessive locking to * be needed. */ -PUBLIC +OBJC_PUBLIC void objc_copyPropertyStruct(void *dest, void *src, ptrdiff_t size, @@ -204,7 +204,7 @@ void objc_copyPropertyStruct(void *dest, * Get property structure function. Copies a structure from an ivar to another * variable. Locks on the address of src. */ -PUBLIC +OBJC_PUBLIC void objc_getPropertyStruct(void *dest, void *src, ptrdiff_t size, @@ -228,7 +228,7 @@ void objc_getPropertyStruct(void *dest, * Set property structure function. Copes a structure to an ivar. Locks on * dest. */ -PUBLIC +OBJC_PUBLIC void objc_setPropertyStruct(void *dest, void *src, ptrdiff_t size, @@ -249,7 +249,7 @@ void objc_setPropertyStruct(void *dest, } -PUBLIC +OBJC_PUBLIC objc_property_t class_getProperty(Class cls, const char *name) { if (Nil == cls) @@ -272,7 +272,7 @@ objc_property_t class_getProperty(Class cls, const char *name) return NULL; } -PUBLIC +OBJC_PUBLIC objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount) { if (Nil == cls) @@ -327,7 +327,7 @@ static const char* property_getIVar(objc_property_t property) return 0; } -PUBLIC +OBJC_PUBLIC const char *property_getName(objc_property_t property) { if (NULL == property) { return NULL; } @@ -352,7 +352,7 @@ static const char *property_getTypeEncoding(objc_property_t property) return property->type; } -PUBLIC +OBJC_PUBLIC const char *property_getAttributes(objc_property_t property) { if (NULL == property) { return NULL; } @@ -360,7 +360,7 @@ const char *property_getAttributes(objc_property_t property) } -PUBLIC +OBJC_PUBLIC objc_property_attribute_t *property_copyAttributeList(objc_property_t property, unsigned int *outCount) { @@ -551,7 +551,7 @@ PRIVATE struct objc_property propertyFromAttrs(const objc_property_attribute_t * } -PUBLIC +OBJC_PUBLIC BOOL class_addProperty(Class cls, const char *name, const objc_property_attribute_t *attributes, @@ -572,7 +572,7 @@ BOOL class_addProperty(Class cls, return YES; } -PUBLIC +OBJC_PUBLIC void class_replaceProperty(Class cls, const char *name, const objc_property_attribute_t *attributes, @@ -589,7 +589,7 @@ void class_replaceProperty(Class cls, LOCK_RUNTIME_FOR_SCOPE(); memcpy(old, &p, sizeof(struct objc_property)); } -PUBLIC +OBJC_PUBLIC char *property_copyAttributeValue(objc_property_t property, const char *attributeName) { diff --git a/visibility.h b/visibility.h index ed37593..07637fd 100644 --- a/visibility.h +++ b/visibility.h @@ -8,7 +8,7 @@ #ifdef NO_LEGACY # define LEGACY PRIVATE #else -# define LEGACY PUBLIC +# define LEGACY OBJC_PUBLIC #endif #if defined(DEBUG) || (!defined(__clang__))