X-Git-Url: https://git.saurik.com/apple/objc4.git/blobdiff_plain/8972963c21fb120c80c09e06536ba4aa7eb98af3..b496e0986ba6c65ea66cb359f67cc7b28cd37f38:/runtime/objc-api.h diff --git a/runtime/objc-api.h b/runtime/objc-api.h index 2fcb92f..94130b9 100644 --- a/runtime/objc-api.h +++ b/runtime/objc-api.h @@ -25,6 +25,7 @@ #ifndef _OBJC_OBJC_API_H_ #define _OBJC_OBJC_API_H_ +#include #include #include @@ -32,18 +33,31 @@ # define __has_feature(x) 0 #endif +#ifndef __has_extension +# define __has_extension __has_feature +#endif + + /* * OBJC_API_VERSION 0 or undef: Tiger and earlier API only * OBJC_API_VERSION 2: Leopard and later API available */ #if !defined(OBJC_API_VERSION) -# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +# 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 + +/* OBJC_OLD_DISPATCH_PROTOTYPES == 0 enforces the rule that the dispatch + * functions must be cast to an appropriate function pointer type. */ +#if !defined(OBJC_OLD_DISPATCH_PROTOTYPES) +# define OBJC_OLD_DISPATCH_PROTOTYPES 1 +#endif + + /* OBJC2_UNAVAILABLE: unavailable in objc 2.0, deprecated in Leopard */ #if !defined(OBJC2_UNAVAILABLE) # if __OBJC2__ @@ -56,12 +70,29 @@ /* OBJC_ARC_UNAVAILABLE: unavailable with -fobjc-arc */ #if !defined(OBJC_ARC_UNAVAILABLE) # if __has_feature(objc_arr) -# define OBJC_ARC_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) +# if __has_extension(attribute_unavailable_with_message) +# define OBJC_ARC_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) +# else +# define OBJC_ARC_UNAVAILABLE __attribute__((unavailable)) +# endif # else # define OBJC_ARC_UNAVAILABLE # endif #endif +/* OBJC_GC_UNAVAILABLE: unavailable with -fobjc-gc or -fobjc-gc-only */ +#if !defined(OBJC_GC_UNAVAILABLE) +# if __OBJC_GC__ +# if __has_extension(attribute_unavailable_with_message) +# define OBJC_GC_UNAVAILABLE __attribute__((unavailable("not available in garbage collecting mode"))) +# else +# define OBJC_GC_UNAVAILABLE __attribute__((unavailable)) +# endif +# else +# define OBJC_GC_UNAVAILABLE +# endif +#endif + #if !defined(OBJC_EXTERN) # if defined(__cplusplus) # define OBJC_EXTERN extern "C"