[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __configuration / availability.h
blobd805c5a4d978d3f5169f4f32c7176084507dd9dc
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___CONFIGURATION_AVAILABILITY_H
11 #define _LIBCPP___CONFIGURATION_AVAILABILITY_H
13 #include <__configuration/compiler.h>
14 #include <__configuration/language.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
18 #endif
20 // Libc++ is shipped by various vendors. In particular, it is used as a system
21 // library on macOS, iOS and other Apple platforms. In order for users to be
22 // able to compile a binary that is intended to be deployed to an older version
23 // of a platform, Clang provides availability attributes [1]. These attributes
24 // can be placed on declarations and are used to describe the life cycle of a
25 // symbol in the library.
27 // The main goal is to ensure a compile-time error if a symbol that hasn't been
28 // introduced in a previously released library is used in a program that targets
29 // that previously released library. Normally, this would be a load-time error
30 // when one tries to launch the program against the older library.
32 // For example, the filesystem library was introduced in the dylib in LLVM 9.
33 // On Apple platforms, this corresponds to macOS 10.15. If a user compiles on
34 // a macOS 10.15 host but targets macOS 10.13 with their program, the compiler
35 // would normally not complain (because the required declarations are in the
36 // headers), but the dynamic loader would fail to find the symbols when actually
37 // trying to launch the program on macOS 10.13. To turn this into a compile-time
38 // issue instead, declarations are annotated with when they were introduced, and
39 // the compiler can produce a diagnostic if the program references something that
40 // isn't available on the deployment target.
42 // This mechanism is general in nature, and any vendor can add their markup to
43 // the library (see below). Whenever a new feature is added that requires support
44 // in the shared library, two macros are added below to allow marking the feature
45 // as unavailable:
46 // 1. A macro named `_LIBCPP_AVAILABILITY_HAS_<feature>` which must be defined
47 // to `_LIBCPP_INTRODUCED_IN_<version>` for the appropriate LLVM version.
48 // 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must be defined to
49 // `_LIBCPP_INTRODUCED_IN_<version>_MARKUP` for the appropriate LLVM version.
51 // When vendors decide to ship the feature as part of their shared library, they
52 // can update the `_LIBCPP_INTRODUCED_IN_<version>` macro (and the markup counterpart)
53 // based on the platform version they shipped that version of LLVM in. The library
54 // will then use this markup to provide an optimal user experience on these platforms.
56 // Furthermore, many features in the standard library have corresponding
57 // feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_<feature>` macros
58 // are checked by the corresponding feature-test macros generated by
59 // generate_feature_test_macro_components.py to ensure that the library
60 // doesn't announce a feature as being implemented if it is unavailable on
61 // the deployment target.
63 // Note that this mechanism is disabled by default in the "upstream" libc++.
64 // Availability annotations are only meaningful when shipping libc++ inside
65 // a platform (i.e. as a system library), and so vendors that want them should
66 // turn those annotations on at CMake configuration time.
68 // [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
70 // For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
71 // for a while.
72 #if defined(_LIBCPP_DISABLE_AVAILABILITY)
73 # undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
74 # define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
75 #endif
77 // Availability markup is disabled when building the library, or when a non-Clang
78 // compiler is used because only Clang supports the necessary attributes.
79 #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || !defined(_LIBCPP_COMPILER_CLANG_BASED)
80 # undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
81 # define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
82 #endif
84 // When availability annotations are disabled, we take for granted that features introduced
85 // in all versions of the library are available.
86 #if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
88 # define _LIBCPP_INTRODUCED_IN_LLVM_20 1
89 # define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE /* nothing */
91 # define _LIBCPP_INTRODUCED_IN_LLVM_19 1
92 # define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE /* nothing */
94 # define _LIBCPP_INTRODUCED_IN_LLVM_18 1
95 # define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE /* nothing */
97 # define _LIBCPP_INTRODUCED_IN_LLVM_17 1
98 # define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE /* nothing */
100 # define _LIBCPP_INTRODUCED_IN_LLVM_16 1
101 # define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE /* nothing */
103 # define _LIBCPP_INTRODUCED_IN_LLVM_15 1
104 # define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE /* nothing */
106 # define _LIBCPP_INTRODUCED_IN_LLVM_14 1
107 # define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE /* nothing */
109 # define _LIBCPP_INTRODUCED_IN_LLVM_13 1
110 # define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE /* nothing */
112 # define _LIBCPP_INTRODUCED_IN_LLVM_12 1
113 # define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */
115 # define _LIBCPP_INTRODUCED_IN_LLVM_11 1
116 # define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */
118 # define _LIBCPP_INTRODUCED_IN_LLVM_10 1
119 # define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE /* nothing */
121 # define _LIBCPP_INTRODUCED_IN_LLVM_9 1
122 # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE /* nothing */
123 # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */
124 # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP /* nothing */
126 # define _LIBCPP_INTRODUCED_IN_LLVM_8 1
127 # define _LIBCPP_INTRODUCED_IN_LLVM_8_ATTRIBUTE /* nothing */
129 # define _LIBCPP_INTRODUCED_IN_LLVM_4 1
130 # define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE /* nothing */
132 #elif defined(__APPLE__)
134 // clang-format off
136 // LLVM 20
137 // TODO: Fill this in
138 # define _LIBCPP_INTRODUCED_IN_LLVM_20 0
139 # define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE __attribute__((unavailable))
141 // LLVM 19
142 // TODO: Fill this in
143 # define _LIBCPP_INTRODUCED_IN_LLVM_19 0
144 # define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))
146 // LLVM 18
147 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \
148 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180000) || \
149 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180000) || \
150 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110000) || \
151 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90000) || \
152 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 240000)
153 # define _LIBCPP_INTRODUCED_IN_LLVM_18 0
154 # else
155 # define _LIBCPP_INTRODUCED_IN_LLVM_18 1
156 # endif
157 # define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE \
158 __attribute__((availability(macos, strict, introduced = 15.0))) \
159 __attribute__((availability(ios, strict, introduced = 18.0))) \
160 __attribute__((availability(tvos, strict, introduced = 18.0))) \
161 __attribute__((availability(watchos, strict, introduced = 11.0))) \
162 __attribute__((availability(bridgeos, strict, introduced = 9.0))) \
163 __attribute__((availability(driverkit, strict, introduced = 24.0)))
165 // LLVM 17
166 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140400) || \
167 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170400) || \
168 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170400) || \
169 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100400) || \
170 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 80400) || \
171 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 230400)
172 # define _LIBCPP_INTRODUCED_IN_LLVM_17 0
173 # else
174 # define _LIBCPP_INTRODUCED_IN_LLVM_17 1
175 # endif
176 # define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE \
177 __attribute__((availability(macos, strict, introduced = 14.4))) \
178 __attribute__((availability(ios, strict, introduced = 17.4))) \
179 __attribute__((availability(tvos, strict, introduced = 17.4))) \
180 __attribute__((availability(watchos, strict, introduced = 10.4))) \
181 __attribute__((availability(bridgeos, strict, introduced = 8.4))) \
182 __attribute__((availability(driverkit, strict, introduced = 23.4)))
184 // LLVM 16
185 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \
186 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \
187 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \
188 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000) || \
189 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 80000) || \
190 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 230000)
191 # define _LIBCPP_INTRODUCED_IN_LLVM_16 0
192 # else
193 # define _LIBCPP_INTRODUCED_IN_LLVM_16 1
194 # endif
195 # define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE \
196 __attribute__((availability(macos, strict, introduced = 14.0))) \
197 __attribute__((availability(ios, strict, introduced = 17.0))) \
198 __attribute__((availability(tvos, strict, introduced = 17.0))) \
199 __attribute__((availability(watchos, strict, introduced = 10.0))) \
200 __attribute__((availability(bridgeos, strict, introduced = 8.0))) \
201 __attribute__((availability(driverkit, strict, introduced = 23.0)))
203 // LLVM 15
204 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130400) || \
205 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160500) || \
206 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160500) || \
207 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90500) || \
208 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 70500) || \
209 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 220400)
210 # define _LIBCPP_INTRODUCED_IN_LLVM_15 0
211 # else
212 # define _LIBCPP_INTRODUCED_IN_LLVM_15 1
213 # endif
214 # define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE \
215 __attribute__((availability(macos, strict, introduced = 13.4))) \
216 __attribute__((availability(ios, strict, introduced = 16.5))) \
217 __attribute__((availability(tvos, strict, introduced = 16.5))) \
218 __attribute__((availability(watchos, strict, introduced = 9.5))) \
219 __attribute__((availability(bridgeos, strict, introduced = 7.5))) \
220 __attribute__((availability(driverkit, strict, introduced = 22.4)))
222 // LLVM 14
223 # define _LIBCPP_INTRODUCED_IN_LLVM_14 _LIBCPP_INTRODUCED_IN_LLVM_15
224 # define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
226 // LLVM 13
227 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130000) || \
228 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160000) || \
229 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160000) || \
230 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90000) || \
231 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 70000) || \
232 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 220000)
233 # define _LIBCPP_INTRODUCED_IN_LLVM_13 0
234 # else
235 # define _LIBCPP_INTRODUCED_IN_LLVM_13 1
236 # endif
237 # define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE \
238 __attribute__((availability(macos, strict, introduced = 13.0))) \
239 __attribute__((availability(ios, strict, introduced = 16.0))) \
240 __attribute__((availability(tvos, strict, introduced = 16.0))) \
241 __attribute__((availability(watchos, strict, introduced = 9.0))) \
242 __attribute__((availability(bridgeos, strict, introduced = 7.0))) \
243 __attribute__((availability(driverkit, strict, introduced = 22.0)))
245 // LLVM 12
246 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120300) || \
247 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150300) || \
248 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150300) || \
249 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80300) || \
250 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 60000) || \
251 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 210300)
252 # define _LIBCPP_INTRODUCED_IN_LLVM_12 0
253 # else
254 # define _LIBCPP_INTRODUCED_IN_LLVM_12 1
255 # endif
256 # define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE \
257 __attribute__((availability(macos, strict, introduced = 12.3))) \
258 __attribute__((availability(ios, strict, introduced = 15.3))) \
259 __attribute__((availability(tvos, strict, introduced = 15.3))) \
260 __attribute__((availability(watchos, strict, introduced = 8.3))) \
261 __attribute__((availability(bridgeos, strict, introduced = 6.0))) \
262 __attribute__((availability(driverkit, strict, introduced = 21.3)))
264 // LLVM 11
265 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
266 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
267 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
268 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
269 # define _LIBCPP_INTRODUCED_IN_LLVM_11 0
270 # else
271 # define _LIBCPP_INTRODUCED_IN_LLVM_11 1
272 # endif
273 # define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE \
274 __attribute__((availability(macos, strict, introduced = 11.0))) \
275 __attribute__((availability(ios, strict, introduced = 14.0))) \
276 __attribute__((availability(tvos, strict, introduced = 14.0))) \
277 __attribute__((availability(watchos, strict, introduced = 7.0)))
279 // LLVM 10
280 # define _LIBCPP_INTRODUCED_IN_LLVM_10 _LIBCPP_INTRODUCED_IN_LLVM_11
281 # define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
283 // LLVM 9
284 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
285 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
286 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
287 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
288 # define _LIBCPP_INTRODUCED_IN_LLVM_9 0
289 # else
290 # define _LIBCPP_INTRODUCED_IN_LLVM_9 1
291 # endif
292 # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE \
293 __attribute__((availability(macos, strict, introduced = 10.15))) \
294 __attribute__((availability(ios, strict, introduced = 13.0))) \
295 __attribute__((availability(tvos, strict, introduced = 13.0))) \
296 __attribute__((availability(watchos, strict, introduced = 6.0)))
297 # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH \
298 _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
299 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
300 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
301 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
302 # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP \
303 _Pragma("clang attribute pop") \
304 _Pragma("clang attribute pop") \
305 _Pragma("clang attribute pop") \
306 _Pragma("clang attribute pop")
308 // LLVM 4
309 # if defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000
310 # define _LIBCPP_INTRODUCED_IN_LLVM_4 0
311 # else
312 # define _LIBCPP_INTRODUCED_IN_LLVM_4 1
313 # endif
314 # define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE __attribute__((availability(watchos, strict, introduced = 5.0)))
316 // clang-format on
318 #else
320 // ...New vendors can add availability markup here...
322 # error \
323 "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
325 #endif
327 // These macros control the availability of std::bad_optional_access and
328 // other exception types. These were put in the shared library to prevent
329 // code bloat from every user program defining the vtable for these exception
330 // types.
332 // Note that when exceptions are disabled, the methods that normally throw
333 // these exceptions can be used even on older deployment targets, but those
334 // methods will abort instead of throwing.
335 #define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4
336 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
338 #define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4
339 #define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
341 #define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4
342 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
344 // These macros control the availability of all parts of <filesystem> that
345 // depend on something in the dylib.
346 #define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9
347 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE
348 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH
349 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP
351 // This controls the availability of the C++20 synchronization library,
352 // which requires shared library support for various operations
353 // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
354 // <semaphore>, and notification functions on std::atomic.
355 #define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11
356 #define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
358 // Enable additional explicit instantiations of iostreams components. This
359 // reduces the number of weak definitions generated in programs that use
360 // iostreams by providing a single strong definition in the shared library.
362 // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
363 // or once libc++ doesn't use the attribute anymore.
364 // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
365 #if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
366 # define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12
367 #else
368 # define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
369 #endif
371 // This controls the availability of floating-point std::to_chars functions.
372 // These overloads were added later than the integer overloads.
373 #define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14
374 #define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE
376 // This controls whether the library claims to provide a default verbose
377 // termination function, and consequently whether the headers will try
378 // to use it when the mechanism isn't overriden at compile-time.
379 #define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15
380 #define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
382 // This controls the availability of the C++17 std::pmr library,
383 // which is implemented in large part in the built library.
385 // TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed
386 // Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
387 // it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we
388 // use availability annotations until that bug has been fixed.
389 #define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16
390 #define _LIBCPP_AVAILABILITY_PMR
392 // These macros controls the availability of __cxa_init_primary_exception
393 // in the built library, which std::make_exception_ptr might use
394 // (see libcxx/include/__exception/exception_ptr.h).
395 #define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
396 #define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
398 // This controls the availability of C++23 <print>, which
399 // has a dependency on the built library (it needs access to
400 // the underlying buffer types of std::cout, std::cerr, and std::clog.
401 #define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18
402 #define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
404 // This controls the availability of the C++20 time zone database.
405 // The parser code is built in the library.
406 #define _LIBCPP_AVAILABILITY_HAS_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19
407 #define _LIBCPP_AVAILABILITY_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
409 // These macros determine whether we assume that std::bad_function_call and
410 // std::bad_expected_access provide a key function in the dylib. This allows
411 // centralizing their vtable and typeinfo instead of having all TUs provide
412 // a weak definition that then gets deduplicated.
413 #define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
414 #define _LIBCPP_AVAILABILITY_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
415 #define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
416 #define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
418 // This controls the availability of floating-point std::from_chars functions.
419 // These overloads were added later than the integer overloads.
420 #define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20
421 #define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE
423 // Define availability attributes that depend on _LIBCPP_HAS_EXCEPTIONS.
424 // Those are defined in terms of the availability attributes above, and
425 // should not be vendor-specific.
426 #if !_LIBCPP_HAS_EXCEPTIONS
427 # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
428 # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
429 # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
430 #else
431 # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
432 # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
433 # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
434 #endif
436 // Define availability attributes that depend on both
437 // _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
438 #if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI
439 # undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
440 # undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
441 # define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0
442 # define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
443 #endif
445 #endif // _LIBCPP___CONFIGURATION_AVAILABILITY_H