base.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. // Copyright (c) 2009-2011 Apple Inc. All rights reserved.
  2. #ifndef __XPC_BASE_H__
  3. #define __XPC_BASE_H__
  4. #include <sys/cdefs.h>
  5. __BEGIN_DECLS
  6. // Certain parts of the project use all the project's headers but have to build
  7. // against Zin -- liblaunch_host being the example. So we need to define these.
  8. #ifndef __MAC_10_9
  9. #define __MAC_10_9 1090
  10. #define __AVAILABILITY_INTERNAL__MAC_10_9 \
  11. __attribute__((availability(macosx, introduced=10.9)))
  12. #endif
  13. #ifndef __IPHONE_7_0
  14. #define __IPHONE_7_0 70000
  15. #define __AVAILABILITY_INTERNAL__IPHONE_7_0 \
  16. __attribute__((availability(ios, introduced=7.0)))
  17. #endif
  18. #ifndef __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_9
  19. #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_9
  20. #endif // __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_9
  21. #ifndef __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_9
  22. #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_9
  23. #endif // __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_9
  24. #ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_9
  25. #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_9
  26. #endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_9
  27. #ifndef __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_9
  28. #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_9
  29. #endif // __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_9
  30. #if !defined(__has_include)
  31. #define __has_include(x) 0
  32. #endif
  33. #if !defined(__has_attribute)
  34. #define __has_attribute(x) 0
  35. #endif
  36. #if __has_include(<xpc/availability.h>)
  37. #include <xpc/availability.h>
  38. #else
  39. #include <Availability.h>
  40. #define __XPC_IOS_SIMULATOR_AVAILABLE_STARTING(version)
  41. #endif
  42. #ifndef __XPC_INDIRECT__
  43. #error "Please #include <xpc/xpc.h> instead of this file directly."
  44. #endif // __XPC_INDIRECT__
  45. #pragma mark Attribute Shims
  46. #ifdef __GNUC__
  47. #define XPC_CONSTRUCTOR __attribute__((constructor))
  48. #define XPC_NORETURN __attribute__((__noreturn__))
  49. #define XPC_NOTHROW __attribute__((__nothrow__))
  50. #define XPC_NONNULL1 __attribute__((__nonnull__(1)))
  51. #define XPC_NONNULL2 __attribute__((__nonnull__(2)))
  52. #define XPC_NONNULL3 __attribute__((__nonnull__(3)))
  53. #define XPC_NONNULL4 __attribute__((__nonnull__(4)))
  54. #define XPC_NONNULL5 __attribute__((__nonnull__(5)))
  55. #define XPC_NONNULL6 __attribute__((__nonnull__(6)))
  56. #define XPC_NONNULL7 __attribute__((__nonnull__(7)))
  57. #define XPC_NONNULL8 __attribute__((__nonnull__(8)))
  58. #define XPC_NONNULL9 __attribute__((__nonnull__(9)))
  59. #define XPC_NONNULL10 __attribute__((__nonnull__(10)))
  60. #define XPC_NONNULL11 __attribute__((__nonnull__(11)))
  61. #define XPC_NONNULL_ALL __attribute__((__nonnull__))
  62. #define XPC_SENTINEL __attribute__((__sentinel__))
  63. #define XPC_PURE __attribute__((__pure__))
  64. #define XPC_WARN_RESULT __attribute__((__warn_unused_result__))
  65. #define XPC_MALLOC __attribute__((__malloc__))
  66. #define XPC_UNUSED __attribute__((unused))
  67. #define XPC_USED __attribute__((used))
  68. #define XPC_PACKED __attribute__((__packed__))
  69. #define XPC_PRINTF(m, n) __attribute__((format(printf, m, n)))
  70. #define XPC_INLINE static __inline__ __attribute__((__always_inline__))
  71. #define XPC_NOINLINE __attribute__((noinline))
  72. #define XPC_NOIMPL __attribute__((unavailable))
  73. #if __has_extension(attribute_unavailable_with_message)
  74. #define XPC_UNAVAILABLE(m) __attribute__((unavailable(m)))
  75. #else // __has_extension(attribute_unavailable_with_message)
  76. #define XPC_UNAVAILABLE(m) XPC_NOIMPL
  77. #endif // __has_extension(attribute_unavailable_with_message)
  78. #define XPC_EXPORT extern __attribute__((visibility("default")))
  79. #define XPC_NOEXPORT __attribute__((visibility("hidden")))
  80. #define XPC_WEAKIMPORT extern __attribute__((weak_import))
  81. #define XPC_DEBUGGER_EXCL XPC_NOEXPORT XPC_USED
  82. #define XPC_TRANSPARENT_UNION __attribute__((transparent_union))
  83. #if __clang__
  84. #define XPC_DEPRECATED(m) __attribute__((deprecated(m)))
  85. #else
  86. #define XPC_DEPRECATED(m) __attribute__((deprecated))
  87. #endif // __clang
  88. #if __OBJC__
  89. #define XPC_GIVES_REFERENCE __strong
  90. #define XPC_UNRETAINED __unsafe_unretained
  91. #define XPC_BRIDGE(xo) ((__bridge void *)(xo))
  92. #define XPC_BRIDGEREF_BEGIN(xo) ((__bridge_retained void *)(xo))
  93. #define XPC_BRIDGEREF_BEGIN_WITH_REF(xo) ((__bridge void *)(xo))
  94. #define XPC_BRIDGEREF_MIDDLE(xo) ((__bridge id)(xo))
  95. #define XPC_BRIDGEREF_END(xo) ((__bridge_transfer id)(xo))
  96. #else // __OBJC__
  97. #define XPC_GIVES_REFERENCE
  98. #define XPC_UNRETAINED
  99. #define XPC_BRIDGE(xo)
  100. #define XPC_BRIDGEREF_BEGIN(xo) (xo)
  101. #define XPC_BRIDGEREF_BEGIN_WITH_REF(xo) (xo)
  102. #define XPC_BRIDGEREF_MIDDLE(xo) (xo)
  103. #define XPC_BRIDGEREF_END(xo) (xo)
  104. #endif // __OBJC__
  105. #else // __GNUC__
  106. /*! @parseOnly */
  107. #define XPC_CONSTRUCTOR
  108. /*! @parseOnly */
  109. #define XPC_NORETURN
  110. /*! @parseOnly */
  111. #define XPC_NOTHROW
  112. /*! @parseOnly */
  113. #define XPC_NONNULL1
  114. /*! @parseOnly */
  115. #define XPC_NONNULL2
  116. /*! @parseOnly */
  117. #define XPC_NONNULL3
  118. /*! @parseOnly */
  119. #define XPC_NONNULL4
  120. /*! @parseOnly */
  121. #define XPC_NONNULL5
  122. /*! @parseOnly */
  123. #define XPC_NONNULL6
  124. /*! @parseOnly */
  125. #define XPC_NONNULL7
  126. /*! @parseOnly */
  127. #define XPC_NONNULL8
  128. /*! @parseOnly */
  129. #define XPC_NONNULL9
  130. /*! @parseOnly */
  131. #define XPC_NONNULL10
  132. /*! @parseOnly */
  133. #define XPC_NONNULL11
  134. /*! @parseOnly */
  135. #define XPC_NONNULL(n)
  136. /*! @parseOnly */
  137. #define XPC_NONNULL_ALL
  138. /*! @parseOnly */
  139. #define XPC_SENTINEL
  140. /*! @parseOnly */
  141. #define XPC_PURE
  142. /*! @parseOnly */
  143. #define XPC_WARN_RESULT
  144. /*! @parseOnly */
  145. #define XPC_MALLOC
  146. /*! @parseOnly */
  147. #define XPC_UNUSED
  148. /*! @parseOnly */
  149. #define XPC_PACKED
  150. /*! @parseOnly */
  151. #define XPC_PRINTF(m, n)
  152. /*! @parseOnly */
  153. #define XPC_INLINE static inline
  154. /*! @parseOnly */
  155. #define XPC_NOINLINE
  156. /*! @parseOnly */
  157. #define XPC_NOIMPL
  158. /*! @parseOnly */
  159. #define XPC_EXPORT extern
  160. /*! @parseOnly */
  161. #define XPC_WEAKIMPORT
  162. /*! @parseOnly */
  163. #define XPC_DEPRECATED
  164. /*! @parseOnly */
  165. #define XPC_UNAVAILABLE(m)
  166. #endif // __GNUC__
  167. #define XPC_PROJECT_EXPORT XPC_EXPORT
  168. __END_DECLS
  169. #endif // __XPC_BASE_H__