2 //===----------------------------------------------------------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___AVAILABILITY
11 #define _LIBCPP___AVAILABILITY
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 # pragma GCC system_header
19 // Libc++ is shipped by various vendors. In particular, it is used as a system
20 // library on macOS, iOS and other Apple platforms. In order for users to be
21 // able to compile a binary that is intended to be deployed to an older version
22 // of a platform, Clang provides availability attributes [1]. These attributes
23 // can be placed on declarations and are used to describe the life cycle of a
24 // symbol in the library.
26 // The main goal is to ensure a compile-time error if a symbol that hasn't been
27 // introduced in a previously released library is used in a program that targets
28 // that previously released library. Normally, this would be a load-time error
29 // when one tries to launch the program against the older library.
31 // For example, the filesystem library was introduced in the dylib in macOS 10.15.
32 // If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their
33 // program, the compiler would normally not complain (because the required
34 // declarations are in the headers), but the dynamic loader would fail to find
35 // the symbols when actually trying to launch the program on macOS 10.13. To
36 // turn this into a compile-time issue instead, declarations are annotated with
37 // when they were introduced, and the compiler can produce a diagnostic if the
38 // program references something that isn't available on the deployment target.
40 // This mechanism is general in nature, and any vendor can add their markup to
41 // the library (see below). Whenever a new feature is added that requires support
42 // in the shared library, two macros are added below to allow marking the feature
44 // 1. A macro named `_LIBCPP_AVAILABILITY_HAS_NO_<feature>` which must be defined
45 // exactly when compiling for a target that doesn't support the feature.
46 // 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must always be defined
47 // and must expand to the proper availability attribute for the platform.
49 // When vendors decide to ship the feature as part of their shared library, they
50 // can update these macros appropriately for their platform, and the library will
51 // use those to provide an optimal user experience.
53 // Furthermore, many features in the standard library have corresponding
54 // feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_NO_<feature>` macros
55 // are checked by the corresponding feature-test macros generated by
56 // generate_feature_test_macro_components.py to ensure that the library
57 // doesn't announce a feature as being implemented if it is unavailable on
58 // the deployment target.
60 // Note that this mechanism is disabled by default in the "upstream" libc++.
61 // Availability annotations are only meaningful when shipping libc++ inside
62 // a platform (i.e. as a system library), and so vendors that want them should
63 // turn those annotations on at CMake configuration time.
65 // [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
68 // For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
70 #if defined(_LIBCPP_DISABLE_AVAILABILITY)
71 # if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
72 # define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
76 // Availability markup is disabled when building the library, or when the compiler
77 // doesn't support the proper attributes.
78 #if defined(_LIBCPP_BUILDING_LIBRARY) || \
79 defined(_LIBCXXABI_BUILDING_LIBRARY) || \
80 !__has_feature(attribute_availability_with_strict) || \
81 !__has_feature(attribute_availability_in_templates) || \
82 !__has_extension(pragma_clang_attribute_external_declaration)
83 # if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
84 # define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
88 #if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
90 // This controls the availability of std::shared_mutex and std::shared_timed_mutex,
91 // which were added to the dylib later.
92 // # define _LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX
93 # define _LIBCPP_AVAILABILITY_SHARED_MUTEX
95 // These macros control the availability of std::bad_optional_access and
96 // other exception types. These were put in the shared library to prevent
97 // code bloat from every user program defining the vtable for these exception
100 // Note that when exceptions are disabled, the methods that normally throw
101 // these exceptions can be used even on older deployment targets, but those
102 // methods will abort instead of throwing.
103 // # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS
104 # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
106 // # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS
107 # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
109 // # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST
110 # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
112 // This controls the availability of std::uncaught_exceptions().
113 // # define _LIBCPP_AVAILABILITY_HAS_NO_UNCAUGHT_EXCEPTIONS
114 # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
116 // This controls the availability of the sized version of ::operator delete,
117 // ::operator delete[], and their align_val_t variants, which were all added
118 // in C++17, and hence not present in early dylibs.
119 // # define _LIBCPP_AVAILABILITY_HAS_NO_SIZED_NEW_DELETE
120 # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
122 // This controls the availability of the std::future_error exception.
124 // Note that when exceptions are disabled, the methods that normally throw
125 // std::future_error can be used even on older deployment targets, but those
126 // methods will abort instead of throwing.
127 // # define _LIBCPP_AVAILABILITY_HAS_NO_FUTURE_ERROR
128 # define _LIBCPP_AVAILABILITY_FUTURE_ERROR
130 // This controls the availability of std::type_info's vtable.
131 // I can't imagine how using std::type_info can work at all if
132 // this isn't supported.
133 // # define _LIBCPP_AVAILABILITY_HAS_NO_TYPEINFO_VTABLE
134 # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
136 // This controls the availability of std::locale::category members
137 // (e.g. std::locale::collate), which are defined in the dylib.
138 // # define _LIBCPP_AVAILABILITY_HAS_NO_LOCALE_CATEGORY
139 # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
141 // This controls the availability of atomic operations on std::shared_ptr
142 // (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared
143 // lock table located in the dylib.
144 // # define _LIBCPP_AVAILABILITY_HAS_NO_ATOMIC_SHARED_PTR
145 # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
147 // These macros control the availability of all parts of <filesystem> that
148 // depend on something in the dylib.
149 // # define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM_LIBRARY
150 # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
151 # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
152 # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
154 // This controls the availability of floating-point std::to_chars functions.
155 // These overloads were added later than the integer overloads.
156 // # define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT
157 # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
159 // This controls the availability of the C++20 synchronization library,
160 // which requires shared library support for various operations
161 // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
162 // <semaphore>, and notification functions on std::atomic.
163 // # define _LIBCPP_AVAILABILITY_HAS_NO_SYNC
164 # define _LIBCPP_AVAILABILITY_SYNC
166 // This controls whether the library claims to provide a default verbose
167 // termination function, and consequently whether the headers will try
168 // to use it when the mechanism isn't overriden at compile-time.
169 // # define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT
170 # define _LIBCPP_AVAILABILITY_VERBOSE_ABORT
172 // This controls the availability of the C++17 std::pmr library,
173 // which is implemented in large part in the built library.
174 // # define _LIBCPP_AVAILABILITY_HAS_NO_PMR
175 # define _LIBCPP_AVAILABILITY_PMR
177 // This controls the availability of the C++20 time zone database.
178 // The parser code is built in the library.
179 // # define _LIBCPP_AVAILABILITY_HAS_NO_TZDB
180 # define _LIBCPP_AVAILABILITY_TZDB
182 // Enable additional explicit instantiations of iostreams components. This
183 // reduces the number of weak definitions generated in programs that use
184 // iostreams by providing a single strong definition in the shared library.
186 // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
187 // or once libc++ doesn't use the attribute anymore.
188 // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
189 #if defined(_LIBCPP_COMPILER_GCC) || defined(_WIN32)
190 # define _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
193 #elif defined(__APPLE__)
195 // shared_mutex and shared_timed_mutex
196 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \
197 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
198 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \
199 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000)
200 # define _LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX
202 # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
203 __attribute__((availability(macos,strict,introduced=10.12))) \
204 __attribute__((availability(ios,strict,introduced=10.0))) \
205 __attribute__((availability(tvos,strict,introduced=10.0))) \
206 __attribute__((availability(watchos,strict,introduced=3.0)))
208 // bad_optional_access, bad_variant_access and bad_any_cast
209 // Note: bad_optional_access & friends were not introduced in the matching
210 // macOS and iOS versions, so the version mismatch between macOS and others
212 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) || \
213 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \
214 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000) || \
215 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000)
216 # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS
217 # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS
218 # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST
220 # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \
221 __attribute__((availability(macos,strict,introduced=10.13))) \
222 __attribute__((availability(ios,strict,introduced=12.0))) \
223 __attribute__((availability(tvos,strict,introduced=12.0))) \
224 __attribute__((availability(watchos,strict,introduced=5.0)))
225 # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
226 _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
227 # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
228 _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
230 // uncaught_exceptions
231 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \
232 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
233 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \
234 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000)
235 # define _LIBCPP_AVAILABILITY_HAS_NO_UNCAUGHT_EXCEPTIONS
237 # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
238 __attribute__((availability(macos,strict,introduced=10.12))) \
239 __attribute__((availability(ios,strict,introduced=10.0))) \
240 __attribute__((availability(tvos,strict,introduced=10.0))) \
241 __attribute__((availability(watchos,strict,introduced=3.0)))
243 // sized operator new and sized operator delete
244 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \
245 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
246 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \
247 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000)
248 # define _LIBCPP_AVAILABILITY_HAS_NO_SIZED_NEW_DELETE
250 # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
251 __attribute__((availability(macos,strict,introduced=10.12))) \
252 __attribute__((availability(ios,strict,introduced=10.0))) \
253 __attribute__((availability(tvos,strict,introduced=10.0))) \
254 __attribute__((availability(watchos,strict,introduced=3.0)))
257 # if (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 60000)
258 # define _LIBCPP_AVAILABILITY_HAS_NO_FUTURE_ERROR
260 # define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
261 __attribute__((availability(ios,strict,introduced=6.0)))
263 // type_info's vtable
264 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \
265 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)
266 # define _LIBCPP_AVAILABILITY_HAS_NO_TYPEINFO_VTABLE
268 # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
269 __attribute__((availability(macos,strict,introduced=10.9))) \
270 __attribute__((availability(ios,strict,introduced=7.0)))
273 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \
274 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)
275 # define _LIBCPP_AVAILABILITY_HAS_NO_LOCALE_CATEGORY
277 # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
278 __attribute__((availability(macos,strict,introduced=10.9))) \
279 __attribute__((availability(ios,strict,introduced=7.0)))
281 // atomic operations on shared_ptr
282 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \
283 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)
284 # define _LIBCPP_AVAILABILITY_HAS_NO_ATOMIC_SHARED_PTR
286 # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
287 __attribute__((availability(macos,strict,introduced=10.9))) \
288 __attribute__((availability(ios,strict,introduced=7.0)))
291 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
292 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
293 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
294 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
295 # define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM_LIBRARY
297 # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \
298 __attribute__((availability(macos,strict,introduced=10.15))) \
299 __attribute__((availability(ios,strict,introduced=13.0))) \
300 __attribute__((availability(tvos,strict,introduced=13.0))) \
301 __attribute__((availability(watchos,strict,introduced=6.0)))
302 # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH \
303 _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
304 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
305 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
306 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
307 # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP \
308 _Pragma("clang attribute pop") \
309 _Pragma("clang attribute pop") \
310 _Pragma("clang attribute pop") \
311 _Pragma("clang attribute pop")
313 // std::to_chars(floating-point)
314 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) || \
315 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \
316 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) || \
317 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300)
318 # define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT
320 # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
321 __attribute__((availability(macos,strict,introduced=13.3))) \
322 __attribute__((availability(ios,strict,introduced=16.3))) \
323 __attribute__((availability(tvos,strict,introduced=16.3))) \
324 __attribute__((availability(watchos,strict,introduced=9.3)))
326 // c++20 synchronization library
327 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
328 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
329 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
330 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
331 # define _LIBCPP_AVAILABILITY_HAS_NO_SYNC
333 # define _LIBCPP_AVAILABILITY_SYNC \
334 __attribute__((availability(macos,strict,introduced=11.0))) \
335 __attribute__((availability(ios,strict,introduced=14.0))) \
336 __attribute__((availability(tvos,strict,introduced=14.0))) \
337 __attribute__((availability(watchos,strict,introduced=7.0)))
339 // __libcpp_verbose_abort
340 # if 1 // TODO: Update once this is released
341 # define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT
343 # define _LIBCPP_AVAILABILITY_VERBOSE_ABORT \
344 __attribute__((unavailable))
347 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \
348 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \
349 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \
350 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000)
351 # define _LIBCPP_AVAILABILITY_HAS_NO_PMR
353 // TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed
354 // Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
355 // 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
356 // use availability annotations until that bug has been fixed.
358 # define _LIBCPP_AVAILABILITY_PMR \
359 __attribute__((availability(macos, strict, introduced = 14.0))) \
360 __attribute__((availability(ios, strict, introduced = 17.0))) \
361 __attribute__((availability(tvos, strict, introduced = 17.0))) \
362 __attribute__((availability(watchos, strict, introduced = 10.0)))
364 # define _LIBCPP_AVAILABILITY_PMR
367 # define _LIBCPP_AVAILABILITY_HAS_NO_TZDB
368 # define _LIBCPP_AVAILABILITY_TZDB __attribute__((unavailable))
370 # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120000) || \
371 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \
372 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150000) || \
373 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80000)
374 # define _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
378 // ...New vendors can add availability markup here...
380 # error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
384 // Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.
385 // Those are defined in terms of the availability attributes above, and
386 // should not be vendor-specific.
387 #if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
388 # define _LIBCPP_AVAILABILITY_FUTURE
389 # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
390 # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
391 # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
393 # define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
394 # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
395 # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
396 # define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
399 #endif // _LIBCPP___AVAILABILITY