/ basic-headers / Availability.h
Availability.h
  1  /*
  2   * Copyright (c) 2007-2016 by Apple Inc.. All rights reserved.
  3   *
  4   * @APPLE_LICENSE_HEADER_START@
  5   * 
  6   * This file contains Original Code and/or Modifications of Original Code
  7   * as defined in and that are subject to the Apple Public Source License
  8   * Version 2.0 (the 'License'). You may not use this file except in
  9   * compliance with the License. Please obtain a copy of the License at
 10   * http://www.opensource.apple.com/apsl/ and read it before using this
 11   * file.
 12   * 
 13   * The Original Code and all software distributed under the License are
 14   * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 15   * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
 16   * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
 17   * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
 18   * Please see the License for the specific language governing rights and
 19   * limitations under the License.
 20   * 
 21   * @APPLE_LICENSE_HEADER_END@
 22   */
 23   
 24  #ifndef __AVAILABILITY__
 25  #define __AVAILABILITY__
 26   /*     
 27      These macros are for use in OS header files. They enable function prototypes
 28      and Objective-C methods to be tagged with the OS version in which they
 29      were first available; and, if applicable, the OS version in which they 
 30      became deprecated.  
 31       
 32      The desktop Mac OS X and iOS each have different version numbers.
 33      The __OSX_AVAILABLE_STARTING() macro allows you to specify both the desktop
 34      and iOS version numbers.  For instance:
 35          __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0)
 36      means the function/method was first available on Mac OS X 10.2 on the desktop
 37      and first available in iOS 2.0 on the iPhone.
 38      
 39      If a function is available on one platform, but not the other a _NA (not
 40      applicable) parameter is used.  For instance:
 41              __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA)
 42      means that the function/method was first available on Mac OS X 10.3, and it
 43      currently not implemented on the iPhone.
 44  
 45      At some point, a function/method may be deprecated.  That means Apple
 46      recommends applications stop using the function, either because there is a 
 47      better replacement or the functionality is being phased out.  Deprecated
 48      functions/methods can be tagged with a __OSX_AVAILABLE_BUT_DEPRECATED()
 49      macro which specifies the OS version where the function became available
 50      as well as the OS version in which it became deprecated.  For instance:
 51          __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)
 52      means that the function/method was introduced in Mac OS X 10.0, then
 53      became deprecated beginning in Mac OS X 10.5.  On iOS the function 
 54      has never been available.  
 55      
 56      For these macros to function properly, a program must specify the OS version range 
 57      it is targeting.  The min OS version is specified as an option to the compiler:
 58      -mmacosx-version-min=10.x when building for Mac OS X, and -miphoneos-version-min=y.z
 59      when building for the iPhone.  The upper bound for the OS version is rarely needed,
 60      but it can be set on the command line via: -D__MAC_OS_X_VERSION_MAX_ALLOWED=10x0 for
 61      Mac OS X and __IPHONE_OS_VERSION_MAX_ALLOWED = y0z00 for iOS.  
 62      
 63      Examples:
 64  
 65          A function available in Mac OS X 10.5 and later, but not on the phone:
 66          
 67              extern void mymacfunc() __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 68  
 69  
 70          An Objective-C method in Mac OS X 10.5 and later, but not on the phone:
 71          
 72              @interface MyClass : NSObject
 73              -(void) mymacmethod __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
 74              @end
 75  
 76          
 77          An enum available on the phone, but not available on Mac OS X:
 78          
 79              #if __IPHONE_OS_VERSION_MIN_REQUIRED
 80                  enum { myEnum = 1 };
 81              #endif
 82             Note: this works when targeting the Mac OS X platform because 
 83             __IPHONE_OS_VERSION_MIN_REQUIRED is undefined which evaluates to zero. 
 84          
 85  
 86          An enum with values added in different iPhoneOS versions:
 87  		
 88  			enum {
 89  			    myX  = 1,	// Usable on iPhoneOS 2.1 and later
 90  			    myY  = 2,	// Usable on iPhoneOS 3.0 and later
 91  			    myZ  = 3,	// Usable on iPhoneOS 3.0 and later
 92  				...
 93  		      Note: you do not want to use #if with enumeration values
 94  			  when a client needs to see all values at compile time
 95  			  and use runtime logic to only use the viable values.
 96  			  
 97  
 98      It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one
 99      source base that can be compiled to target a range of OS versions.  It is best
100      to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.
101      That is because you might get compiled on an old OS that does not define a later
102      OS version macro, and in the C preprocessor undefined values evaluate to zero
103      in expresssions, which could cause the #if expression to evaluate in an unexpected
104      way.
105      
106          #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
107              // code only compiled when targeting Mac OS X and not iPhone
108              // note use of 1050 instead of __MAC_10_5
109              #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
110                  // code in here might run on pre-Leopard OS
111              #else
112                  // code here can assume Leopard or later
113              #endif
114          #endif
115  
116  
117  */
118  
119  /* 
120   * __API_TO_BE_DEPRECATED is used as a version number in API that will be deprecated 
121   * in an upcoming release. This soft deprecation is an intermediate step before formal 
122   * deprecation to notify developers about the API before compiler warnings are generated.
123   * You can find all places in your code that use soft deprecated API by redefining the 
124   * value of this macro to your current minimum deployment target, for example:
125   * (macOS)
126   *   clang -D__API_TO_BE_DEPRECATED=10.12 <other compiler flags>
127   * (iOS)
128   *   clang -D__API_TO_BE_DEPRECATED=11.0 <other compiler flags>
129   */
130   
131  #ifndef __API_TO_BE_DEPRECATED
132  #define __API_TO_BE_DEPRECATED 100000
133  #endif
134  
135  #ifndef __MAC_10_0
136  #define __MAC_10_0            1000
137  #define __MAC_10_1            1010
138  #define __MAC_10_2            1020
139  #define __MAC_10_3            1030
140  #define __MAC_10_4            1040
141  #define __MAC_10_5            1050
142  #define __MAC_10_6            1060
143  #define __MAC_10_7            1070
144  #define __MAC_10_8            1080
145  #define __MAC_10_9            1090
146  #define __MAC_10_10         101000
147  #define __MAC_10_10_2       101002
148  #define __MAC_10_10_3       101003
149  #define __MAC_10_11         101100
150  #define __MAC_10_11_2       101102
151  #define __MAC_10_11_3       101103
152  #define __MAC_10_11_4       101104
153  #define __MAC_10_12         101200
154  #define __MAC_10_12_1       101201
155  #define __MAC_10_12_2       101202
156  #define __MAC_10_12_4       101204
157  #define __MAC_10_13         101300
158  #define __MAC_10_13_1       101301
159  #define __MAC_10_13_2       101302
160  #define __MAC_10_13_4       101304
161  #define __MAC_10_14         101400
162  #define __MAC_10_14_1       101401
163  #define __MAC_10_14_4       101404
164  #define __MAC_10_15         101500
165  #define __MAC_10_15_1       101501
166  /* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
167  
168  #define __IPHONE_2_0      20000
169  #define __IPHONE_2_1      20100
170  #define __IPHONE_2_2      20200
171  #define __IPHONE_3_0      30000
172  #define __IPHONE_3_1      30100
173  #define __IPHONE_3_2      30200
174  #define __IPHONE_4_0      40000
175  #define __IPHONE_4_1      40100
176  #define __IPHONE_4_2      40200
177  #define __IPHONE_4_3      40300
178  #define __IPHONE_5_0      50000
179  #define __IPHONE_5_1      50100
180  #define __IPHONE_6_0      60000
181  #define __IPHONE_6_1      60100
182  #define __IPHONE_7_0      70000
183  #define __IPHONE_7_1      70100
184  #define __IPHONE_8_0      80000
185  #define __IPHONE_8_1      80100
186  #define __IPHONE_8_2      80200
187  #define __IPHONE_8_3      80300
188  #define __IPHONE_8_4      80400
189  #define __IPHONE_9_0      90000
190  #define __IPHONE_9_1      90100
191  #define __IPHONE_9_2      90200
192  #define __IPHONE_9_3      90300
193  #define __IPHONE_10_0    100000
194  #define __IPHONE_10_1    100100
195  #define __IPHONE_10_2    100200
196  #define __IPHONE_10_3    100300
197  #define __IPHONE_11_0    110000
198  #define __IPHONE_11_1    110100
199  #define __IPHONE_11_2    110200
200  #define __IPHONE_11_3    110300
201  #define __IPHONE_11_4    110400
202  #define __IPHONE_12_0    120000
203  #define __IPHONE_12_1    120100
204  #define __IPHONE_12_2    120200
205  #define __IPHONE_12_3    120300
206  #define __IPHONE_13_0    130000
207  #define __IPHONE_13_1    130100
208  #define __IPHONE_13_2    130200
209  /* __IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
210  
211  #define __TVOS_9_0        90000
212  #define __TVOS_9_1        90100
213  #define __TVOS_9_2        90200
214  #define __TVOS_10_0      100000
215  #define __TVOS_10_0_1    100001
216  #define __TVOS_10_1      100100
217  #define __TVOS_10_2      100200
218  #define __TVOS_11_0      110000
219  #define __TVOS_11_1      110100
220  #define __TVOS_11_2      110200
221  #define __TVOS_11_3      110300
222  #define __TVOS_11_4      110400
223  #define __TVOS_12_0      120000
224  #define __TVOS_12_1      120100
225  #define __TVOS_12_2      120200
226  #define __TVOS_12_3      120300
227  #define __TVOS_13_0      130000
228  #define __TVOS_13_1      130100
229  
230  #define __WATCHOS_1_0     10000
231  #define __WATCHOS_2_0     20000
232  #define __WATCHOS_2_1     20100
233  #define __WATCHOS_2_2     20200
234  #define __WATCHOS_3_0     30000
235  #define __WATCHOS_3_1     30100
236  #define __WATCHOS_3_1_1   30101
237  #define __WATCHOS_3_2     30200
238  #define __WATCHOS_4_0     40000
239  #define __WATCHOS_4_1     40100
240  #define __WATCHOS_4_2     40200
241  #define __WATCHOS_4_3     40300
242  #define __WATCHOS_5_0     50000
243  #define __WATCHOS_5_1     50100
244  #define __WATCHOS_5_2     50200
245  #define __WATCHOS_6_0     60000
246  #define __WATCHOS_6_0_1   60001
247  
248  #define __DRIVERKIT_19_0 190000
249  #endif /* __MAC_10_0 */
250  
251  #include <AvailabilityInternal.h>
252  
253  #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
254      #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios
255      #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
256                                                      __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
257      #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
258                                                      __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
259  
260  #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
261  
262     #if defined(__has_builtin)
263      #if __has_builtin(__is_target_arch)
264       #if __has_builtin(__is_target_vendor)
265        #if __has_builtin(__is_target_os)
266         #if __has_builtin(__is_target_environment)
267          #if __has_builtin(__is_target_variant_os)
268           #if __has_builtin(__is_target_variant_environment)
269            #if (__is_target_arch(x86_64) && __is_target_vendor(apple) && ((__is_target_os(ios) && __is_target_environment(macabi)) || (__is_target_variant_os(ios) && __is_target_variant_environment(macabi))))
270              #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx __AVAILABILITY_INTERNAL##_ios
271              #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
272                                                              __AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
273              #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
274                                                              __AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg) __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
275            #endif /* # if __is_target_arch... */
276           #endif /* #if __has_builtin(__is_target_variant_environment) */
277          #endif /* #if __has_builtin(__is_target_variant_os) */
278         #endif /* #if __has_builtin(__is_target_environment) */
279        #endif /* #if __has_builtin(__is_target_os) */
280       #endif /* #if __has_builtin(__is_target_vendor) */
281      #endif /* #if __has_builtin(__is_target_arch) */
282     #endif /* #if defined(__has_builtin) */
283  
284      #ifndef __OSX_AVAILABLE_STARTING
285        #if defined(__has_attribute) && defined(__has_feature)
286            #if __has_attribute(availability)      
287          #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx
288          #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
289                                                          __AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep
290          #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
291                                                          __AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg)
292          #else
293          #define __OSX_AVAILABLE_STARTING(_osx, _ios)
294          #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
295          #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
296        #endif
297      #endif
298  #endif /* __OSX_AVAILABLE_STARTING */
299  
300  #else
301      #define __OSX_AVAILABLE_STARTING(_osx, _ios)
302      #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
303      #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
304  #endif
305  
306  
307  #if defined(__has_feature)
308    #if __has_feature(attribute_availability_with_message)
309      #define __OS_AVAILABILITY(_target, _availability)            __attribute__((availability(_target,_availability)))
310      #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)  __attribute__((availability(_target,_availability,message=_msg)))
311    #elif __has_feature(attribute_availability)
312      #define __OS_AVAILABILITY(_target, _availability)            __attribute__((availability(_target,_availability)))
313      #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)  __attribute__((availability(_target,_availability)))
314    #else
315      #define __OS_AVAILABILITY(_target, _availability)
316      #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
317    #endif
318  #else
319      #define __OS_AVAILABILITY(_target, _availability)
320      #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
321  #endif
322  
323  
324  /* for use to document app extension usage */
325  #if defined(__has_feature)
326    #if __has_feature(attribute_availability_app_extension)
327      #define __OSX_EXTENSION_UNAVAILABLE(_msg)  __OS_AVAILABILITY_MSG(macosx_app_extension,unavailable,_msg)
328      #define __IOS_EXTENSION_UNAVAILABLE(_msg)  __OS_AVAILABILITY_MSG(ios_app_extension,unavailable,_msg)
329    #else
330      #define __OSX_EXTENSION_UNAVAILABLE(_msg)
331      #define __IOS_EXTENSION_UNAVAILABLE(_msg)
332    #endif
333  #else
334      #define __OSX_EXTENSION_UNAVAILABLE(_msg)
335      #define __IOS_EXTENSION_UNAVAILABLE(_msg)
336  #endif
337  
338  #define __OS_EXTENSION_UNAVAILABLE(_msg)  __OSX_EXTENSION_UNAVAILABLE(_msg) __IOS_EXTENSION_UNAVAILABLE(_msg)
339  
340  
341  
342  /* for use marking APIs available info for Mac OSX */
343  #if defined(__has_attribute)
344    #if __has_attribute(availability)
345      #define __OSX_UNAVAILABLE                    __OS_AVAILABILITY(macosx,unavailable)
346      #define __OSX_AVAILABLE(_vers)               __OS_AVAILABILITY(macosx,introduced=_vers)
347      #define __OSX_DEPRECATED(_start, _dep, _msg) __OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)
348    #endif
349  #endif
350  
351  #ifndef __OSX_UNAVAILABLE
352    #define __OSX_UNAVAILABLE
353  #endif
354  
355  #ifndef __OSX_AVAILABLE
356    #define __OSX_AVAILABLE(_vers)
357  #endif
358  
359  #ifndef __OSX_DEPRECATED
360    #define __OSX_DEPRECATED(_start, _dep, _msg)
361  #endif
362  
363  
364  /* for use marking APIs available info for iOS */
365  #if defined(__has_attribute)
366    #if __has_attribute(availability)
367      #define __IOS_UNAVAILABLE                    __OS_AVAILABILITY(ios,unavailable)
368      #define __IOS_PROHIBITED                     __OS_AVAILABILITY(ios,unavailable)
369      #define __IOS_AVAILABLE(_vers)               __OS_AVAILABILITY(ios,introduced=_vers)
370      #define __IOS_DEPRECATED(_start, _dep, _msg) __IOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(ios,deprecated=_dep,_msg)
371    #endif
372  #endif
373  
374  #ifndef __IOS_UNAVAILABLE
375    #define __IOS_UNAVAILABLE
376  #endif
377  
378  #ifndef __IOS_PROHIBITED
379    #define __IOS_PROHIBITED
380  #endif
381  
382  #ifndef __IOS_AVAILABLE
383    #define __IOS_AVAILABLE(_vers)
384  #endif
385  
386  #ifndef __IOS_DEPRECATED
387    #define __IOS_DEPRECATED(_start, _dep, _msg)
388  #endif
389  
390  
391  /* for use marking APIs available info for tvOS */
392  #if defined(__has_feature)
393    #if __has_feature(attribute_availability_tvos)
394      #define __TVOS_UNAVAILABLE                    __OS_AVAILABILITY(tvos,unavailable)
395      #define __TVOS_PROHIBITED                     __OS_AVAILABILITY(tvos,unavailable)
396      #define __TVOS_AVAILABLE(_vers)               __OS_AVAILABILITY(tvos,introduced=_vers)
397      #define __TVOS_DEPRECATED(_start, _dep, _msg) __TVOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(tvos,deprecated=_dep,_msg)
398    #endif
399  #endif
400  
401  #ifndef __TVOS_UNAVAILABLE
402    #define __TVOS_UNAVAILABLE
403  #endif
404  
405  #ifndef __TVOS_PROHIBITED
406    #define __TVOS_PROHIBITED
407  #endif
408  
409  #ifndef __TVOS_AVAILABLE
410    #define __TVOS_AVAILABLE(_vers)
411  #endif
412  
413  #ifndef __TVOS_DEPRECATED
414    #define __TVOS_DEPRECATED(_start, _dep, _msg)
415  #endif
416  
417  
418  /* for use marking APIs available info for Watch OS */
419  #if defined(__has_feature)
420    #if __has_feature(attribute_availability_watchos)
421      #define __WATCHOS_UNAVAILABLE                    __OS_AVAILABILITY(watchos,unavailable)
422      #define __WATCHOS_PROHIBITED                     __OS_AVAILABILITY(watchos,unavailable)
423      #define __WATCHOS_AVAILABLE(_vers)               __OS_AVAILABILITY(watchos,introduced=_vers)
424      #define __WATCHOS_DEPRECATED(_start, _dep, _msg) __WATCHOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(watchos,deprecated=_dep,_msg)
425    #endif
426  #endif
427  
428  #ifndef __WATCHOS_UNAVAILABLE
429    #define __WATCHOS_UNAVAILABLE
430  #endif
431  
432  #ifndef __WATCHOS_PROHIBITED
433    #define __WATCHOS_PROHIBITED
434  #endif
435  
436  #ifndef __WATCHOS_AVAILABLE
437    #define __WATCHOS_AVAILABLE(_vers)
438  #endif
439  
440  #ifndef __WATCHOS_DEPRECATED
441    #define __WATCHOS_DEPRECATED(_start, _dep, _msg)
442  #endif
443  
444  
445  /* for use marking APIs unavailable for swift */
446  #if defined(__has_feature)
447    #if __has_feature(attribute_availability_swift)
448      #define __SWIFT_UNAVAILABLE                   __OS_AVAILABILITY(swift,unavailable)
449      #define __SWIFT_UNAVAILABLE_MSG(_msg)         __OS_AVAILABILITY_MSG(swift,unavailable,_msg)
450    #endif
451  #endif
452  
453  #ifndef __SWIFT_UNAVAILABLE
454    #define __SWIFT_UNAVAILABLE
455  #endif
456  
457  #ifndef __SWIFT_UNAVAILABLE_MSG
458    #define __SWIFT_UNAVAILABLE_MSG(_msg)
459  #endif
460  
461  /*
462   Macros for defining which versions/platform a given symbol can be used.
463   
464   @see http://clang.llvm.org/docs/AttributeReference.html#availability
465   
466   * Note that these macros are only compatible with clang compilers that
467   * support the following target selection options:
468   *
469   * -mmacosx-version-min
470   * -miphoneos-version-min
471   * -mwatchos-version-min
472   * -mtvos-version-min
473   */
474  
475  #if defined(__has_feature) && defined(__has_attribute)
476   #if __has_attribute(availability)
477  
478      /*
479       * API Introductions
480       *
481       * Use to specify the release that a particular API became available.
482       *
483       * Platform names:
484       *   macos, ios, tvos, watchos
485       *
486       * Examples:
487       *    __API_AVAILABLE(macos(10.10))
488       *    __API_AVAILABLE(macos(10.9), ios(10.0))
489       *    __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
490       *    __API_AVAILABLE(driverkit(19.0))
491       */
492      #define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
493      
494      #define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
495      #define __API_AVAILABLE_END _Pragma("clang attribute pop")
496  
497      /*
498       * API Deprecations
499       *
500       * Use to specify the release that a particular API became unavailable.
501       *
502       * Platform names:
503       *   macos, ios, tvos, watchos
504       *
505       * Examples:
506       *
507       *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8))
508       *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8), ios(2.0, 3.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
509       *
510       *    __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
511       *    __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
512       */
513      #define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
514      #define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
515  
516      #define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
517      #define __API_DEPRECATED_END _Pragma("clang attribute pop")
518  
519      #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
520      #define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop")
521  
522      /*
523       * API Unavailability
524       * Use to specify that an API is unavailable for a particular platform.
525       *
526       * Example:
527       *    __API_UNAVAILABLE(macos)
528       *    __API_UNAVAILABLE(watchos, tvos)
529       */
530      #define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
531  
532      #define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
533      #define __API_UNAVAILABLE_END _Pragma("clang attribute pop")
534   #else 
535  
536      /* 
537       * Evaluate to nothing for compilers that don't support availability.
538       */
539      
540      #define __API_AVAILABLE(...)
541      #define __API_AVAILABLE_BEGIN(...)
542      #define __API_AVAILABLE_END
543      #define __API_DEPRECATED(...)
544      #define __API_DEPRECATED_WITH_REPLACEMENT(...)
545      #define __API_DEPRECATED_BEGIN(...)
546      #define __API_DEPRECATED_END
547      #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...)
548      #define __API_DEPRECATED_WITH_REPLACEMENT_END
549      #define __API_UNAVAILABLE(...)
550      #define __API_UNAVAILABLE_BEGIN(...)
551      #define __API_UNAVAILABLE_END
552   #endif /* __has_attribute(availability) */
553  #else
554  
555      /* 
556       * Evaluate to nothing for compilers that don't support clang language extensions.
557       */
558      
559      #define __API_AVAILABLE(...)
560      #define __API_AVAILABLE_BEGIN(...)
561      #define __API_AVAILABLE_END
562      #define __API_DEPRECATED(...)
563      #define __API_DEPRECATED_WITH_REPLACEMENT(...)
564      #define __API_DEPRECATED_BEGIN(...)
565      #define __API_DEPRECATED_END
566      #define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...)
567      #define __API_DEPRECATED_WITH_REPLACEMENT_END
568      #define __API_UNAVAILABLE(...)
569      #define __API_UNAVAILABLE_BEGIN(...)
570      #define __API_UNAVAILABLE_END
571  #endif /*  #if defined(__has_feature) && defined(__has_attribute) */
572  
573  #if __has_include(<AvailabilityProhibitedInternal.h>)
574    #include <AvailabilityProhibitedInternal.h>
575  #endif
576  
577  /*
578   * If SPI decorations have not been defined elsewhere, disable them.
579   */
580  
581  #ifndef __SPI_AVAILABLE
582    #define __SPI_AVAILABLE(...)
583  #endif
584  
585  #ifndef __SPI_DEPRECATED
586    #define __SPI_DEPRECATED(...)
587  #endif
588  
589  #ifndef __SPI_DEPRECATED_WITH_REPLACEMENT
590    #define __SPI_DEPRECATED_WITH_REPLACEMENT(...)
591  #endif
592  
593  
594  
595  #endif /* __AVAILABILITY__ */
596