xref: /xnu-8792.81.2/EXTERNAL_HEADERS/Availability.h (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions /*
2*19c3b8c2SApple OSS Distributions  * Copyright (c) 2007-2016 by Apple Inc.. All rights reserved.
3*19c3b8c2SApple OSS Distributions  *
4*19c3b8c2SApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*19c3b8c2SApple OSS Distributions  *
6*19c3b8c2SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*19c3b8c2SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*19c3b8c2SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*19c3b8c2SApple OSS Distributions  * compliance with the License. Please obtain a copy of the License at
10*19c3b8c2SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this
11*19c3b8c2SApple OSS Distributions  * file.
12*19c3b8c2SApple OSS Distributions  *
13*19c3b8c2SApple OSS Distributions  * The Original Code and all software distributed under the License are
14*19c3b8c2SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15*19c3b8c2SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16*19c3b8c2SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17*19c3b8c2SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18*19c3b8c2SApple OSS Distributions  * Please see the License for the specific language governing rights and
19*19c3b8c2SApple OSS Distributions  * limitations under the License.
20*19c3b8c2SApple OSS Distributions  *
21*19c3b8c2SApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
22*19c3b8c2SApple OSS Distributions  */
23*19c3b8c2SApple OSS Distributions 
24*19c3b8c2SApple OSS Distributions #ifndef __AVAILABILITY__
25*19c3b8c2SApple OSS Distributions #define __AVAILABILITY__
26*19c3b8c2SApple OSS Distributions  /*
27*19c3b8c2SApple OSS Distributions     These macros are for use in OS header files. They enable function prototypes
28*19c3b8c2SApple OSS Distributions     and Objective-C methods to be tagged with the OS version in which they
29*19c3b8c2SApple OSS Distributions     were first available; and, if applicable, the OS version in which they
30*19c3b8c2SApple OSS Distributions     became deprecated.
31*19c3b8c2SApple OSS Distributions 
32*19c3b8c2SApple OSS Distributions     The desktop Mac OS X and iOS each have different version numbers.
33*19c3b8c2SApple OSS Distributions     The __OSX_AVAILABLE_STARTING() macro allows you to specify both the desktop
34*19c3b8c2SApple OSS Distributions     and iOS version numbers.  For instance:
35*19c3b8c2SApple OSS Distributions         __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0)
36*19c3b8c2SApple OSS Distributions     means the function/method was first available on Mac OS X 10.2 on the desktop
37*19c3b8c2SApple OSS Distributions     and first available in iOS 2.0 on the iPhone.
38*19c3b8c2SApple OSS Distributions 
39*19c3b8c2SApple OSS Distributions     If a function is available on one platform, but not the other a _NA (not
40*19c3b8c2SApple OSS Distributions     applicable) parameter is used.  For instance:
41*19c3b8c2SApple OSS Distributions             __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA)
42*19c3b8c2SApple OSS Distributions     means that the function/method was first available on Mac OS X 10.3, and it
43*19c3b8c2SApple OSS Distributions     currently not implemented on the iPhone.
44*19c3b8c2SApple OSS Distributions 
45*19c3b8c2SApple OSS Distributions     At some point, a function/method may be deprecated.  That means Apple
46*19c3b8c2SApple OSS Distributions     recommends applications stop using the function, either because there is a
47*19c3b8c2SApple OSS Distributions     better replacement or the functionality is being phased out.  Deprecated
48*19c3b8c2SApple OSS Distributions     functions/methods can be tagged with a __OSX_AVAILABLE_BUT_DEPRECATED()
49*19c3b8c2SApple OSS Distributions     macro which specifies the OS version where the function became available
50*19c3b8c2SApple OSS Distributions     as well as the OS version in which it became deprecated.  For instance:
51*19c3b8c2SApple OSS Distributions         __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)
52*19c3b8c2SApple OSS Distributions     means that the function/method was introduced in Mac OS X 10.0, then
53*19c3b8c2SApple OSS Distributions     became deprecated beginning in Mac OS X 10.5.  On iOS the function
54*19c3b8c2SApple OSS Distributions     has never been available.
55*19c3b8c2SApple OSS Distributions 
56*19c3b8c2SApple OSS Distributions     For these macros to function properly, a program must specify the OS version range
57*19c3b8c2SApple OSS Distributions     it is targeting.  The min OS version is specified as an option to the compiler:
58*19c3b8c2SApple OSS Distributions     -mmacosx-version-min=10.x when building for Mac OS X, and -miphoneos-version-min=y.z
59*19c3b8c2SApple OSS Distributions     when building for the iPhone.  The upper bound for the OS version is rarely needed,
60*19c3b8c2SApple OSS Distributions     but it can be set on the command line via: -D__MAC_OS_X_VERSION_MAX_ALLOWED=10x0 for
61*19c3b8c2SApple OSS Distributions     Mac OS X and __IPHONE_OS_VERSION_MAX_ALLOWED = y0z00 for iOS.
62*19c3b8c2SApple OSS Distributions 
63*19c3b8c2SApple OSS Distributions     Examples:
64*19c3b8c2SApple OSS Distributions 
65*19c3b8c2SApple OSS Distributions         A function available in Mac OS X 10.5 and later, but not on the phone:
66*19c3b8c2SApple OSS Distributions 
67*19c3b8c2SApple OSS Distributions             extern void mymacfunc() __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
68*19c3b8c2SApple OSS Distributions 
69*19c3b8c2SApple OSS Distributions 
70*19c3b8c2SApple OSS Distributions         An Objective-C method in Mac OS X 10.5 and later, but not on the phone:
71*19c3b8c2SApple OSS Distributions 
72*19c3b8c2SApple OSS Distributions             @interface MyClass : NSObject
73*19c3b8c2SApple OSS Distributions             -(void) mymacmethod __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
74*19c3b8c2SApple OSS Distributions             @end
75*19c3b8c2SApple OSS Distributions 
76*19c3b8c2SApple OSS Distributions 
77*19c3b8c2SApple OSS Distributions         An enum available on the phone, but not available on Mac OS X:
78*19c3b8c2SApple OSS Distributions 
79*19c3b8c2SApple OSS Distributions             #if __IPHONE_OS_VERSION_MIN_REQUIRED
80*19c3b8c2SApple OSS Distributions                 enum { myEnum = 1 };
81*19c3b8c2SApple OSS Distributions             #endif
82*19c3b8c2SApple OSS Distributions            Note: this works when targeting the Mac OS X platform because
83*19c3b8c2SApple OSS Distributions            __IPHONE_OS_VERSION_MIN_REQUIRED is undefined which evaluates to zero.
84*19c3b8c2SApple OSS Distributions 
85*19c3b8c2SApple OSS Distributions 
86*19c3b8c2SApple OSS Distributions         An enum with values added in different iPhoneOS versions:
87*19c3b8c2SApple OSS Distributions 
88*19c3b8c2SApple OSS Distributions 			enum {
89*19c3b8c2SApple OSS Distributions 			    myX  = 1,	// Usable on iPhoneOS 2.1 and later
90*19c3b8c2SApple OSS Distributions 			    myY  = 2,	// Usable on iPhoneOS 3.0 and later
91*19c3b8c2SApple OSS Distributions 			    myZ  = 3,	// Usable on iPhoneOS 3.0 and later
92*19c3b8c2SApple OSS Distributions 				...
93*19c3b8c2SApple OSS Distributions 		      Note: you do not want to use #if with enumeration values
94*19c3b8c2SApple OSS Distributions 			  when a client needs to see all values at compile time
95*19c3b8c2SApple OSS Distributions 			  and use runtime logic to only use the viable values.
96*19c3b8c2SApple OSS Distributions 
97*19c3b8c2SApple OSS Distributions 
98*19c3b8c2SApple OSS Distributions     It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one
99*19c3b8c2SApple OSS Distributions     source base that can be compiled to target a range of OS versions.  It is best
100*19c3b8c2SApple OSS Distributions     to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.
101*19c3b8c2SApple OSS Distributions     That is because you might get compiled on an old OS that does not define a later
102*19c3b8c2SApple OSS Distributions     OS version macro, and in the C preprocessor undefined values evaluate to zero
103*19c3b8c2SApple OSS Distributions     in expresssions, which could cause the #if expression to evaluate in an unexpected
104*19c3b8c2SApple OSS Distributions     way.
105*19c3b8c2SApple OSS Distributions 
106*19c3b8c2SApple OSS Distributions         #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
107*19c3b8c2SApple OSS Distributions             // code only compiled when targeting Mac OS X and not iPhone
108*19c3b8c2SApple OSS Distributions             // note use of 1050 instead of __MAC_10_5
109*19c3b8c2SApple OSS Distributions             #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
110*19c3b8c2SApple OSS Distributions                 // code in here might run on pre-Leopard OS
111*19c3b8c2SApple OSS Distributions             #else
112*19c3b8c2SApple OSS Distributions                 // code here can assume Leopard or later
113*19c3b8c2SApple OSS Distributions             #endif
114*19c3b8c2SApple OSS Distributions         #endif
115*19c3b8c2SApple OSS Distributions 
116*19c3b8c2SApple OSS Distributions 
117*19c3b8c2SApple OSS Distributions */
118*19c3b8c2SApple OSS Distributions 
119*19c3b8c2SApple OSS Distributions #define __MAC_10_0            1000
120*19c3b8c2SApple OSS Distributions #define __MAC_10_1            1010
121*19c3b8c2SApple OSS Distributions #define __MAC_10_2            1020
122*19c3b8c2SApple OSS Distributions #define __MAC_10_3            1030
123*19c3b8c2SApple OSS Distributions #define __MAC_10_4            1040
124*19c3b8c2SApple OSS Distributions #define __MAC_10_5            1050
125*19c3b8c2SApple OSS Distributions #define __MAC_10_6            1060
126*19c3b8c2SApple OSS Distributions #define __MAC_10_7            1070
127*19c3b8c2SApple OSS Distributions #define __MAC_10_8            1080
128*19c3b8c2SApple OSS Distributions #define __MAC_10_9            1090
129*19c3b8c2SApple OSS Distributions #define __MAC_10_10         101000
130*19c3b8c2SApple OSS Distributions #define __MAC_10_10_2       101002
131*19c3b8c2SApple OSS Distributions #define __MAC_10_10_3       101003
132*19c3b8c2SApple OSS Distributions #define __MAC_10_11         101100
133*19c3b8c2SApple OSS Distributions #define __MAC_10_11_2       101102
134*19c3b8c2SApple OSS Distributions #define __MAC_10_11_3       101103
135*19c3b8c2SApple OSS Distributions #define __MAC_10_11_4       101104
136*19c3b8c2SApple OSS Distributions #define __MAC_10_12         101200
137*19c3b8c2SApple OSS Distributions #define __MAC_10_12_1       101201
138*19c3b8c2SApple OSS Distributions #define __MAC_10_12_2       101202
139*19c3b8c2SApple OSS Distributions #define __MAC_10_12_4       101204
140*19c3b8c2SApple OSS Distributions /* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
141*19c3b8c2SApple OSS Distributions 
142*19c3b8c2SApple OSS Distributions #define __IPHONE_2_0      20000
143*19c3b8c2SApple OSS Distributions #define __IPHONE_2_1      20100
144*19c3b8c2SApple OSS Distributions #define __IPHONE_2_2      20200
145*19c3b8c2SApple OSS Distributions #define __IPHONE_3_0      30000
146*19c3b8c2SApple OSS Distributions #define __IPHONE_3_1      30100
147*19c3b8c2SApple OSS Distributions #define __IPHONE_3_2      30200
148*19c3b8c2SApple OSS Distributions #define __IPHONE_4_0      40000
149*19c3b8c2SApple OSS Distributions #define __IPHONE_4_1      40100
150*19c3b8c2SApple OSS Distributions #define __IPHONE_4_2      40200
151*19c3b8c2SApple OSS Distributions #define __IPHONE_4_3      40300
152*19c3b8c2SApple OSS Distributions #define __IPHONE_5_0      50000
153*19c3b8c2SApple OSS Distributions #define __IPHONE_5_1      50100
154*19c3b8c2SApple OSS Distributions #define __IPHONE_6_0      60000
155*19c3b8c2SApple OSS Distributions #define __IPHONE_6_1      60100
156*19c3b8c2SApple OSS Distributions #define __IPHONE_7_0      70000
157*19c3b8c2SApple OSS Distributions #define __IPHONE_7_1      70100
158*19c3b8c2SApple OSS Distributions #define __IPHONE_8_0      80000
159*19c3b8c2SApple OSS Distributions #define __IPHONE_8_1      80100
160*19c3b8c2SApple OSS Distributions #define __IPHONE_8_2      80200
161*19c3b8c2SApple OSS Distributions #define __IPHONE_8_3      80300
162*19c3b8c2SApple OSS Distributions #define __IPHONE_8_4      80400
163*19c3b8c2SApple OSS Distributions #define __IPHONE_9_0      90000
164*19c3b8c2SApple OSS Distributions #define __IPHONE_9_1      90100
165*19c3b8c2SApple OSS Distributions #define __IPHONE_9_2      90200
166*19c3b8c2SApple OSS Distributions #define __IPHONE_9_3      90300
167*19c3b8c2SApple OSS Distributions #define __IPHONE_10_0    100000
168*19c3b8c2SApple OSS Distributions #define __IPHONE_10_1    100100
169*19c3b8c2SApple OSS Distributions #define __IPHONE_10_2    100200
170*19c3b8c2SApple OSS Distributions #define __IPHONE_10_3    100300
171*19c3b8c2SApple OSS Distributions /* __IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
172*19c3b8c2SApple OSS Distributions 
173*19c3b8c2SApple OSS Distributions #define __TVOS_9_0        90000
174*19c3b8c2SApple OSS Distributions #define __TVOS_9_1        90100
175*19c3b8c2SApple OSS Distributions #define __TVOS_9_2        90200
176*19c3b8c2SApple OSS Distributions #define __TVOS_10_0      100000
177*19c3b8c2SApple OSS Distributions #define __TVOS_10_0_1    100001
178*19c3b8c2SApple OSS Distributions #define __TVOS_10_1      100100
179*19c3b8c2SApple OSS Distributions #define __TVOS_10_2      100200
180*19c3b8c2SApple OSS Distributions 
181*19c3b8c2SApple OSS Distributions #define __WATCHOS_1_0     10000
182*19c3b8c2SApple OSS Distributions #define __WATCHOS_2_0     20000
183*19c3b8c2SApple OSS Distributions #define __WATCHOS_3_0     30000
184*19c3b8c2SApple OSS Distributions #define __WATCHOS_3_1     30100
185*19c3b8c2SApple OSS Distributions #define __WATCHOS_3_1_1   30101
186*19c3b8c2SApple OSS Distributions #define __WATCHOS_3_2     30200
187*19c3b8c2SApple OSS Distributions 
188*19c3b8c2SApple OSS Distributions #include <AvailabilityInternal.h>
189*19c3b8c2SApple OSS Distributions 
190*19c3b8c2SApple OSS Distributions #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
191*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios
192*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
193*19c3b8c2SApple OSS Distributions                                                     __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
194*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
195*19c3b8c2SApple OSS Distributions                                                     __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
196*19c3b8c2SApple OSS Distributions 
197*19c3b8c2SApple OSS Distributions #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
198*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx
199*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
200*19c3b8c2SApple OSS Distributions                                                     __AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep
201*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
202*19c3b8c2SApple OSS Distributions                                                     __AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg)
203*19c3b8c2SApple OSS Distributions 
204*19c3b8c2SApple OSS Distributions #else
205*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_STARTING(_osx, _ios)
206*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
207*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
208*19c3b8c2SApple OSS Distributions #endif
209*19c3b8c2SApple OSS Distributions 
210*19c3b8c2SApple OSS Distributions 
211*19c3b8c2SApple OSS Distributions #if defined(__has_feature)
212*19c3b8c2SApple OSS Distributions   #if __has_feature(attribute_availability_with_message)
213*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY(_target, _availability)            __attribute__((availability(_target,_availability)))
214*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)  __attribute__((availability(_target,_availability,message=_msg)))
215*19c3b8c2SApple OSS Distributions   #elif __has_feature(attribute_availability)
216*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY(_target, _availability)            __attribute__((availability(_target,_availability)))
217*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)  __attribute__((availability(_target,_availability)))
218*19c3b8c2SApple OSS Distributions   #else
219*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY(_target, _availability)
220*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
221*19c3b8c2SApple OSS Distributions   #endif
222*19c3b8c2SApple OSS Distributions #else
223*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY(_target, _availability)
224*19c3b8c2SApple OSS Distributions     #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
225*19c3b8c2SApple OSS Distributions #endif
226*19c3b8c2SApple OSS Distributions 
227*19c3b8c2SApple OSS Distributions 
228*19c3b8c2SApple OSS Distributions /* for use to document app extension usage */
229*19c3b8c2SApple OSS Distributions #if defined(__has_feature)
230*19c3b8c2SApple OSS Distributions   #if __has_feature(attribute_availability_app_extension)
231*19c3b8c2SApple OSS Distributions     #define __OSX_EXTENSION_UNAVAILABLE(_msg)  __OS_AVAILABILITY_MSG(macosx_app_extension,unavailable,_msg)
232*19c3b8c2SApple OSS Distributions     #define __IOS_EXTENSION_UNAVAILABLE(_msg)  __OS_AVAILABILITY_MSG(ios_app_extension,unavailable,_msg)
233*19c3b8c2SApple OSS Distributions   #else
234*19c3b8c2SApple OSS Distributions     #define __OSX_EXTENSION_UNAVAILABLE(_msg)
235*19c3b8c2SApple OSS Distributions     #define __IOS_EXTENSION_UNAVAILABLE(_msg)
236*19c3b8c2SApple OSS Distributions   #endif
237*19c3b8c2SApple OSS Distributions #else
238*19c3b8c2SApple OSS Distributions     #define __OSX_EXTENSION_UNAVAILABLE(_msg)
239*19c3b8c2SApple OSS Distributions     #define __IOS_EXTENSION_UNAVAILABLE(_msg)
240*19c3b8c2SApple OSS Distributions #endif
241*19c3b8c2SApple OSS Distributions 
242*19c3b8c2SApple OSS Distributions #define __OS_EXTENSION_UNAVAILABLE(_msg)  __OSX_EXTENSION_UNAVAILABLE(_msg) __IOS_EXTENSION_UNAVAILABLE(_msg)
243*19c3b8c2SApple OSS Distributions 
244*19c3b8c2SApple OSS Distributions 
245*19c3b8c2SApple OSS Distributions 
246*19c3b8c2SApple OSS Distributions /* for use marking APIs available info for Mac OSX */
247*19c3b8c2SApple OSS Distributions #if defined(__has_attribute)
248*19c3b8c2SApple OSS Distributions   #if __has_attribute(availability)
249*19c3b8c2SApple OSS Distributions     #define __OSX_UNAVAILABLE                    __OS_AVAILABILITY(macosx,unavailable)
250*19c3b8c2SApple OSS Distributions     #define __OSX_AVAILABLE(_vers)               __OS_AVAILABILITY(macosx,introduced=_vers)
251*19c3b8c2SApple OSS Distributions     #define __OSX_DEPRECATED(_start, _dep, _msg) __OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)
252*19c3b8c2SApple OSS Distributions   #endif
253*19c3b8c2SApple OSS Distributions #endif
254*19c3b8c2SApple OSS Distributions 
255*19c3b8c2SApple OSS Distributions #ifndef __OSX_UNAVAILABLE
256*19c3b8c2SApple OSS Distributions   #define __OSX_UNAVAILABLE
257*19c3b8c2SApple OSS Distributions #endif
258*19c3b8c2SApple OSS Distributions 
259*19c3b8c2SApple OSS Distributions #ifndef __OSX_AVAILABLE
260*19c3b8c2SApple OSS Distributions   #define __OSX_AVAILABLE(_vers)
261*19c3b8c2SApple OSS Distributions #endif
262*19c3b8c2SApple OSS Distributions 
263*19c3b8c2SApple OSS Distributions #ifndef __OSX_DEPRECATED
264*19c3b8c2SApple OSS Distributions   #define __OSX_DEPRECATED(_start, _dep, _msg)
265*19c3b8c2SApple OSS Distributions #endif
266*19c3b8c2SApple OSS Distributions 
267*19c3b8c2SApple OSS Distributions 
268*19c3b8c2SApple OSS Distributions /* for use marking APIs available info for iOS */
269*19c3b8c2SApple OSS Distributions #if defined(__has_attribute)
270*19c3b8c2SApple OSS Distributions   #if __has_attribute(availability)
271*19c3b8c2SApple OSS Distributions     #define __IOS_UNAVAILABLE                    __OS_AVAILABILITY(ios,unavailable)
272*19c3b8c2SApple OSS Distributions     #define __IOS_PROHIBITED                     __OS_AVAILABILITY(ios,unavailable)
273*19c3b8c2SApple OSS Distributions     #define __IOS_AVAILABLE(_vers)               __OS_AVAILABILITY(ios,introduced=_vers)
274*19c3b8c2SApple OSS Distributions     #define __IOS_DEPRECATED(_start, _dep, _msg) __IOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(ios,deprecated=_dep,_msg)
275*19c3b8c2SApple OSS Distributions   #endif
276*19c3b8c2SApple OSS Distributions #endif
277*19c3b8c2SApple OSS Distributions 
278*19c3b8c2SApple OSS Distributions #ifndef __IOS_UNAVAILABLE
279*19c3b8c2SApple OSS Distributions   #define __IOS_UNAVAILABLE
280*19c3b8c2SApple OSS Distributions #endif
281*19c3b8c2SApple OSS Distributions 
282*19c3b8c2SApple OSS Distributions #ifndef __IOS_PROHIBITED
283*19c3b8c2SApple OSS Distributions   #define __IOS_PROHIBITED
284*19c3b8c2SApple OSS Distributions #endif
285*19c3b8c2SApple OSS Distributions 
286*19c3b8c2SApple OSS Distributions #ifndef __IOS_AVAILABLE
287*19c3b8c2SApple OSS Distributions   #define __IOS_AVAILABLE(_vers)
288*19c3b8c2SApple OSS Distributions #endif
289*19c3b8c2SApple OSS Distributions 
290*19c3b8c2SApple OSS Distributions #ifndef __IOS_DEPRECATED
291*19c3b8c2SApple OSS Distributions   #define __IOS_DEPRECATED(_start, _dep, _msg)
292*19c3b8c2SApple OSS Distributions #endif
293*19c3b8c2SApple OSS Distributions 
294*19c3b8c2SApple OSS Distributions 
295*19c3b8c2SApple OSS Distributions /* for use marking APIs available info for tvOS */
296*19c3b8c2SApple OSS Distributions #if defined(__has_feature)
297*19c3b8c2SApple OSS Distributions   #if __has_feature(attribute_availability_tvos)
298*19c3b8c2SApple OSS Distributions     #define __TVOS_UNAVAILABLE                    __OS_AVAILABILITY(tvos,unavailable)
299*19c3b8c2SApple OSS Distributions     #define __TVOS_PROHIBITED                     __OS_AVAILABILITY(tvos,unavailable)
300*19c3b8c2SApple OSS Distributions     #define __TVOS_AVAILABLE(_vers)               __OS_AVAILABILITY(tvos,introduced=_vers)
301*19c3b8c2SApple OSS Distributions     #define __TVOS_DEPRECATED(_start, _dep, _msg) __TVOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(tvos,deprecated=_dep,_msg)
302*19c3b8c2SApple OSS Distributions   #endif
303*19c3b8c2SApple OSS Distributions #endif
304*19c3b8c2SApple OSS Distributions 
305*19c3b8c2SApple OSS Distributions #ifndef __TVOS_UNAVAILABLE
306*19c3b8c2SApple OSS Distributions   #define __TVOS_UNAVAILABLE
307*19c3b8c2SApple OSS Distributions #endif
308*19c3b8c2SApple OSS Distributions 
309*19c3b8c2SApple OSS Distributions #ifndef __TVOS_PROHIBITED
310*19c3b8c2SApple OSS Distributions   #define __TVOS_PROHIBITED
311*19c3b8c2SApple OSS Distributions #endif
312*19c3b8c2SApple OSS Distributions 
313*19c3b8c2SApple OSS Distributions #ifndef __TVOS_AVAILABLE
314*19c3b8c2SApple OSS Distributions   #define __TVOS_AVAILABLE(_vers)
315*19c3b8c2SApple OSS Distributions #endif
316*19c3b8c2SApple OSS Distributions 
317*19c3b8c2SApple OSS Distributions #ifndef __TVOS_DEPRECATED
318*19c3b8c2SApple OSS Distributions   #define __TVOS_DEPRECATED(_start, _dep, _msg)
319*19c3b8c2SApple OSS Distributions #endif
320*19c3b8c2SApple OSS Distributions 
321*19c3b8c2SApple OSS Distributions 
322*19c3b8c2SApple OSS Distributions /* for use marking APIs available info for Watch OS */
323*19c3b8c2SApple OSS Distributions #if defined(__has_feature)
324*19c3b8c2SApple OSS Distributions   #if __has_feature(attribute_availability_watchos)
325*19c3b8c2SApple OSS Distributions     #define __WATCHOS_UNAVAILABLE                    __OS_AVAILABILITY(watchos,unavailable)
326*19c3b8c2SApple OSS Distributions     #define __WATCHOS_PROHIBITED                     __OS_AVAILABILITY(watchos,unavailable)
327*19c3b8c2SApple OSS Distributions     #define __WATCHOS_AVAILABLE(_vers)               __OS_AVAILABILITY(watchos,introduced=_vers)
328*19c3b8c2SApple OSS Distributions     #define __WATCHOS_DEPRECATED(_start, _dep, _msg) __WATCHOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(watchos,deprecated=_dep,_msg)
329*19c3b8c2SApple OSS Distributions   #endif
330*19c3b8c2SApple OSS Distributions #endif
331*19c3b8c2SApple OSS Distributions 
332*19c3b8c2SApple OSS Distributions #ifndef __WATCHOS_UNAVAILABLE
333*19c3b8c2SApple OSS Distributions   #define __WATCHOS_UNAVAILABLE
334*19c3b8c2SApple OSS Distributions #endif
335*19c3b8c2SApple OSS Distributions 
336*19c3b8c2SApple OSS Distributions #ifndef __WATCHOS_PROHIBITED
337*19c3b8c2SApple OSS Distributions   #define __WATCHOS_PROHIBITED
338*19c3b8c2SApple OSS Distributions #endif
339*19c3b8c2SApple OSS Distributions 
340*19c3b8c2SApple OSS Distributions #ifndef __WATCHOS_AVAILABLE
341*19c3b8c2SApple OSS Distributions   #define __WATCHOS_AVAILABLE(_vers)
342*19c3b8c2SApple OSS Distributions #endif
343*19c3b8c2SApple OSS Distributions 
344*19c3b8c2SApple OSS Distributions #ifndef __WATCHOS_DEPRECATED
345*19c3b8c2SApple OSS Distributions   #define __WATCHOS_DEPRECATED(_start, _dep, _msg)
346*19c3b8c2SApple OSS Distributions #endif
347*19c3b8c2SApple OSS Distributions 
348*19c3b8c2SApple OSS Distributions 
349*19c3b8c2SApple OSS Distributions /* for use marking APIs unavailable for swift */
350*19c3b8c2SApple OSS Distributions #if defined(__has_feature)
351*19c3b8c2SApple OSS Distributions   #if __has_feature(attribute_availability_swift)
352*19c3b8c2SApple OSS Distributions     #define __SWIFT_UNAVAILABLE                   __OS_AVAILABILITY(swift,unavailable)
353*19c3b8c2SApple OSS Distributions     #define __SWIFT_UNAVAILABLE_MSG(_msg)         __OS_AVAILABILITY_MSG(swift,unavailable,_msg)
354*19c3b8c2SApple OSS Distributions   #endif
355*19c3b8c2SApple OSS Distributions #endif
356*19c3b8c2SApple OSS Distributions 
357*19c3b8c2SApple OSS Distributions #ifndef __SWIFT_UNAVAILABLE
358*19c3b8c2SApple OSS Distributions   #define __SWIFT_UNAVAILABLE
359*19c3b8c2SApple OSS Distributions #endif
360*19c3b8c2SApple OSS Distributions 
361*19c3b8c2SApple OSS Distributions #ifndef __SWIFT_UNAVAILABLE_MSG
362*19c3b8c2SApple OSS Distributions   #define __SWIFT_UNAVAILABLE_MSG(_msg)
363*19c3b8c2SApple OSS Distributions #endif
364*19c3b8c2SApple OSS Distributions 
365*19c3b8c2SApple OSS Distributions #if __has_include(<AvailabilityProhibitedInternal.h>)
366*19c3b8c2SApple OSS Distributions   #include <AvailabilityProhibitedInternal.h>
367*19c3b8c2SApple OSS Distributions #endif
368*19c3b8c2SApple OSS Distributions 
369*19c3b8c2SApple OSS Distributions /*
370*19c3b8c2SApple OSS Distributions  Macros for defining which versions/platform a given symbol can be used.
371*19c3b8c2SApple OSS Distributions 
372*19c3b8c2SApple OSS Distributions  @see http://clang.llvm.org/docs/AttributeReference.html#availability
373*19c3b8c2SApple OSS Distributions  */
374*19c3b8c2SApple OSS Distributions 
375*19c3b8c2SApple OSS Distributions /*
376*19c3b8c2SApple OSS Distributions  * API Introductions
377*19c3b8c2SApple OSS Distributions  *
378*19c3b8c2SApple OSS Distributions  * Use to specify the release that a particular API became available.
379*19c3b8c2SApple OSS Distributions  *
380*19c3b8c2SApple OSS Distributions  * Platform names:
381*19c3b8c2SApple OSS Distributions  *   macos, ios, tvos, watchos
382*19c3b8c2SApple OSS Distributions  *
383*19c3b8c2SApple OSS Distributions  * Examples:
384*19c3b8c2SApple OSS Distributions  *    __API_AVAILABLE(macos(10.10))
385*19c3b8c2SApple OSS Distributions  *    __API_AVAILABLE(macos(10.9), ios(10.0))
386*19c3b8c2SApple OSS Distributions  *    __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
387*19c3b8c2SApple OSS Distributions  */
388*19c3b8c2SApple OSS Distributions #define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1)(__VA_ARGS__)
389*19c3b8c2SApple OSS Distributions 
390*19c3b8c2SApple OSS Distributions 
391*19c3b8c2SApple OSS Distributions /*
392*19c3b8c2SApple OSS Distributions  * API Deprecations
393*19c3b8c2SApple OSS Distributions  *
394*19c3b8c2SApple OSS Distributions  * Use to specify the release that a particular API became unavailable.
395*19c3b8c2SApple OSS Distributions  *
396*19c3b8c2SApple OSS Distributions  * Platform names:
397*19c3b8c2SApple OSS Distributions  *   macos, ios, tvos, watchos
398*19c3b8c2SApple OSS Distributions  *
399*19c3b8c2SApple OSS Distributions  * Examples:
400*19c3b8c2SApple OSS Distributions  *
401*19c3b8c2SApple OSS Distributions  *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8))
402*19c3b8c2SApple OSS Distributions  *    __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))
403*19c3b8c2SApple OSS Distributions  *
404*19c3b8c2SApple OSS Distributions  *    __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
405*19c3b8c2SApple OSS Distributions  *    __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
406*19c3b8c2SApple OSS Distributions  */
407*19c3b8c2SApple OSS Distributions #define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1)(__VA_ARGS__)
408*19c3b8c2SApple OSS Distributions #define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1)(__VA_ARGS__)
409*19c3b8c2SApple OSS Distributions 
410*19c3b8c2SApple OSS Distributions /*
411*19c3b8c2SApple OSS Distributions  * API Unavailability
412*19c3b8c2SApple OSS Distributions  * Use to specify that an API is unavailable for a particular platform.
413*19c3b8c2SApple OSS Distributions  *
414*19c3b8c2SApple OSS Distributions  * Example:
415*19c3b8c2SApple OSS Distributions  *    __API_UNAVAILABLE(macos)
416*19c3b8c2SApple OSS Distributions  *    __API_UNAVAILABLE(watchos, tvos)
417*19c3b8c2SApple OSS Distributions  */
418*19c3b8c2SApple OSS Distributions #define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1)(__VA_ARGS__)
419*19c3b8c2SApple OSS Distributions 
420*19c3b8c2SApple OSS Distributions #endif /* __AVAILABILITY__ */
421