mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-23 20:29:50 +00:00
ad16172625
- __strong pointers, preventing objects from being freed _ __weak pointers are automatically freed when the last remaining __strong pointer goes away - objc_gc_{retain,release}_np() functions, which can be used to implement CFRetain() and CFRelease() (adds an reference count - the object will not be collected until after its last retain is gone.
25 lines
651 B
C
25 lines
651 B
C
#if defined _WIN32 || defined __CYGWIN__
|
|
# define PUBLIC __attribute__((dllexport))
|
|
# define PRIVATE
|
|
#else
|
|
# define PUBLIC __attribute__ ((visibility("default")))
|
|
# define PRIVATE __attribute__ ((visibility("hidden")))
|
|
#endif
|
|
#ifdef NO_LEGACY
|
|
# define LEGACY PRIVATE
|
|
#else
|
|
# define LEGACY PUBLIC
|
|
#endif
|
|
|
|
#if defined(DEBUG) || (!defined(__clang__))
|
|
# include <assert.h>
|
|
# define UNREACHABLE(x) assert(0 && x)
|
|
# define ASSERT(x) assert(x)
|
|
#else
|
|
# define UNREACHABLE(x) __builtin_unreachable()
|
|
# define ASSERT(x) do { if (x) __builtin_unreachable(); } while(0)
|
|
#endif
|
|
|
|
#define LIKELY(x) __builtin_expect(x, 1)
|
|
#define UNLIKELY(x) __builtin_expect(x, 0)
|