123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- #ifndef _OBJC_OBJC_API_H_
- #define _OBJC_OBJC_API_H_
- #include <Availability.h>
- #include <AvailabilityMacros.h>
- #include <TargetConditionals.h>
- #include <sys/types.h>
- #ifndef __has_feature
- # define __has_feature(x) 0
- #endif
- #ifndef __has_extension
- # define __has_extension __has_feature
- #endif
- #ifndef __has_attribute
- # define __has_attribute(x) 0
- #endif
- #if !__has_feature(nullability)
- # ifndef _Nullable
- # define _Nullable
- # endif
- # ifndef _Nonnull
- # define _Nonnull
- # endif
- # ifndef _Null_unspecified
- # define _Null_unspecified
- # endif
- #endif
- #ifndef __APPLE_BLEACH_SDK__
- # if __has_feature(attribute_availability_bridgeos)
- # ifndef __BRIDGEOS_AVAILABLE
- # define __BRIDGEOS_AVAILABLE(_vers) __OS_AVAILABILITY(bridgeos,introduced=_vers)
- # endif
- # ifndef __BRIDGEOS_DEPRECATED
- # define __BRIDGEOS_DEPRECATED(_start, _dep, _msg) __BRIDGEOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(bridgeos,deprecated=_dep,_msg)
- # endif
- # ifndef __BRIDGEOS_UNAVAILABLE
- # define __BRIDGEOS_UNAVAILABLE __OS_AVAILABILITY(bridgeos,unavailable)
- # endif
- # else
- # ifndef __BRIDGEOS_AVAILABLE
- # define __BRIDGEOS_AVAILABLE(_vers)
- # endif
- # ifndef __BRIDGEOS_DEPRECATED
- # define __BRIDGEOS_DEPRECATED(_start, _dep, _msg)
- # endif
- # ifndef __BRIDGEOS_UNAVAILABLE
- # define __BRIDGEOS_UNAVAILABLE
- # endif
- # endif
- #endif
- #if !defined(OBJC_API_VERSION)
- # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_5
- # define OBJC_API_VERSION 0
- # else
- # define OBJC_API_VERSION 2
- # endif
- #endif
- #if defined(__OBJC_GC__)
- # error Objective-C garbage collection is not supported.
- #elif TARGET_OS_OSX
-
- # define OBJC_NO_GC 1
- # undef OBJC_NO_GC_API
- #else
-
- # define OBJC_NO_GC 1
- # define OBJC_NO_GC_API 1
- #endif
- #if !defined(NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER)
- # define NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER 1
- #endif
- #if !defined(OBJC_OLD_DISPATCH_PROTOTYPES)
- # if __swift__
-
-
- # define OBJC_OLD_DISPATCH_PROTOTYPES 1
- # else
- # define OBJC_OLD_DISPATCH_PROTOTYPES 1
- # endif
- #endif
- #if !defined(OBJC_AVAILABLE)
- # define OBJC_AVAILABLE(x, i, t, w, b) \
- __OSX_AVAILABLE(x) __IOS_AVAILABLE(i) __TVOS_AVAILABLE(t) \
- __WATCHOS_AVAILABLE(w) __BRIDGEOS_AVAILABLE(b)
- #endif
- #if !defined(OBJC_ISA_AVAILABILITY)
- # if __OBJC2__
- # define OBJC_ISA_AVAILABILITY __attribute__((deprecated))
- # else
- # define OBJC_ISA_AVAILABILITY
- # endif
- #endif
- #if !defined(OBJC2_UNAVAILABLE)
- # if __OBJC2__
- # define OBJC2_UNAVAILABLE UNAVAILABLE_ATTRIBUTE
- # else
-
- # define OBJC2_UNAVAILABLE \
- __OSX_DEPRECATED(10.5, 10.5, "not available in __OBJC2__") \
- __IOS_DEPRECATED(2.0, 2.0, "not available in __OBJC2__") \
- __TVOS_UNAVAILABLE __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE
- # endif
- #endif
- #if !defined(OBJC_UNAVAILABLE)
- # if __has_extension(attribute_unavailable_with_message)
- # define OBJC_UNAVAILABLE(_msg) __attribute__((unavailable(_msg)))
- # else
- # define OBJC_UNAVAILABLE(_msg) __attribute__((unavailable))
- # endif
- #endif
- #if !defined(OBJC_DEPRECATED)
- # if __has_extension(attribute_deprecated_with_message)
- # define OBJC_DEPRECATED(_msg) __attribute__((deprecated(_msg)))
- # else
- # define OBJC_DEPRECATED(_msg) __attribute__((deprecated))
- # endif
- #endif
- #if !defined(OBJC_ARC_UNAVAILABLE)
- # if __has_feature(objc_arc)
- # define OBJC_ARC_UNAVAILABLE OBJC_UNAVAILABLE("not available in automatic reference counting mode")
- # else
- # define OBJC_ARC_UNAVAILABLE
- # endif
- #endif
- #if !defined(OBJC_SWIFT_UNAVAILABLE)
- # if __has_feature(attribute_availability_swift)
- # define OBJC_SWIFT_UNAVAILABLE(_msg) __attribute__((availability(swift, unavailable, message=_msg)))
- # else
- # define OBJC_SWIFT_UNAVAILABLE(_msg)
- # endif
- #endif
- #if !defined(OBJC_ARM64_UNAVAILABLE)
- # if defined(__arm64__)
- # define OBJC_ARM64_UNAVAILABLE OBJC_UNAVAILABLE("not available in arm64")
- # else
- # define OBJC_ARM64_UNAVAILABLE
- # endif
- #endif
- #if !defined(OBJC_GC_UNAVAILABLE)
- # define OBJC_GC_UNAVAILABLE
- #endif
- #if !defined(OBJC_EXTERN)
- # if defined(__cplusplus)
- # define OBJC_EXTERN extern "C"
- # else
- # define OBJC_EXTERN extern
- # endif
- #endif
- #if !defined(OBJC_VISIBLE)
- # if TARGET_OS_WIN32
- # if defined(BUILDING_OBJC)
- # define OBJC_VISIBLE __declspec(dllexport)
- # else
- # define OBJC_VISIBLE __declspec(dllimport)
- # endif
- # else
- # define OBJC_VISIBLE __attribute__((visibility("default")))
- # endif
- #endif
- #if !defined(OBJC_EXPORT)
- # define OBJC_EXPORT OBJC_EXTERN OBJC_VISIBLE
- #endif
- #if !defined(OBJC_IMPORT)
- # define OBJC_IMPORT extern
- #endif
- #if !defined(OBJC_ROOT_CLASS)
- # if __has_attribute(objc_root_class)
- # define OBJC_ROOT_CLASS __attribute__((objc_root_class))
- # else
- # define OBJC_ROOT_CLASS
- # endif
- #endif
- #ifndef __DARWIN_NULL
- #define __DARWIN_NULL NULL
- #endif
- #if !defined(OBJC_INLINE)
- # define OBJC_INLINE __inline
- #endif
- #if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))
- #define OBJC_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
- #if (__cplusplus)
- #define OBJC_OPTIONS(_type, _name) _type _name; enum : _type
- #else
- #define OBJC_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
- #endif
- #else
- #define OBJC_ENUM(_type, _name) _type _name; enum
- #define OBJC_OPTIONS(_type, _name) _type _name; enum
- #endif
- #if !defined(OBJC_RETURNS_RETAINED)
- # if __OBJC__ && __has_attribute(ns_returns_retained)
- # define OBJC_RETURNS_RETAINED __attribute__((ns_returns_retained))
- # else
- # define OBJC_RETURNS_RETAINED
- # endif
- #endif
- #endif
|