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//===----------------------------------------------------------------------===// 9 10#ifndef _LIBCPP___AVAILABILITY 11#define _LIBCPP___AVAILABILITY 12 13#include <__config> 14 15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 16# pragma GCC system_header 17#endif 18 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. 25// 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. 30// 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. 39// 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 43// as unavailable: 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. 48// 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. 52// 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. 59// 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. 64// 65// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability 66 67 68// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY 69// for a while. 70#if defined(_LIBCPP_DISABLE_AVAILABILITY) 71# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) 72# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS 73# endif 74#endif 75 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 85# endif 86#endif 87 88#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) 89 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 94 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 98 // types. 99 // 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 105 106// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS 107# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS 108 109// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST 110# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST 111 112 // This controls the availability of std::uncaught_exceptions(). 113// # define _LIBCPP_AVAILABILITY_HAS_NO_UNCAUGHT_EXCEPTIONS 114# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS 115 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 121 122 // This controls the availability of the std::future_error exception. 123 // 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 129 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 135 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 140 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 146 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 153 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 158 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 165 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 171 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 176 177#elif defined(__APPLE__) 178 179 // shared_mutex and shared_timed_mutex 180# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ 181 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ 182 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ 183 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) 184# define _LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX 185# endif 186# define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ 187 __attribute__((availability(macos,strict,introduced=10.12))) \ 188 __attribute__((availability(ios,strict,introduced=10.0))) \ 189 __attribute__((availability(tvos,strict,introduced=10.0))) \ 190 __attribute__((availability(watchos,strict,introduced=3.0))) 191 192 // bad_optional_access, bad_variant_access and bad_any_cast 193 // Note: bad_optional_access & friends were not introduced in the matching 194 // macOS and iOS versions, so the version mismatch between macOS and others 195 // is intended. 196# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) || \ 197 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \ 198 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000) || \ 199 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) 200# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS 201# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS 202# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST 203# endif 204# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ 205 __attribute__((availability(macos,strict,introduced=10.13))) \ 206 __attribute__((availability(ios,strict,introduced=12.0))) \ 207 __attribute__((availability(tvos,strict,introduced=12.0))) \ 208 __attribute__((availability(watchos,strict,introduced=5.0))) 209# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \ 210 _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS 211# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \ 212 _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS 213 214 // uncaught_exceptions 215# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ 216 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ 217 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ 218 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) 219# define _LIBCPP_AVAILABILITY_HAS_NO_UNCAUGHT_EXCEPTIONS 220# endif 221# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ 222 __attribute__((availability(macos,strict,introduced=10.12))) \ 223 __attribute__((availability(ios,strict,introduced=10.0))) \ 224 __attribute__((availability(tvos,strict,introduced=10.0))) \ 225 __attribute__((availability(watchos,strict,introduced=3.0))) 226 227 // sized operator new and sized operator delete 228# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ 229 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ 230 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ 231 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) 232# define _LIBCPP_AVAILABILITY_HAS_NO_SIZED_NEW_DELETE 233# endif 234# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ 235 __attribute__((availability(macos,strict,introduced=10.12))) \ 236 __attribute__((availability(ios,strict,introduced=10.0))) \ 237 __attribute__((availability(tvos,strict,introduced=10.0))) \ 238 __attribute__((availability(watchos,strict,introduced=3.0))) 239 240 // future_error 241# if (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 60000) 242# define _LIBCPP_AVAILABILITY_HAS_NO_FUTURE_ERROR 243# endif 244# define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ 245 __attribute__((availability(ios,strict,introduced=6.0))) 246 247 // type_info's vtable 248# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \ 249 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000) 250# define _LIBCPP_AVAILABILITY_HAS_NO_TYPEINFO_VTABLE 251# endif 252# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ 253 __attribute__((availability(macos,strict,introduced=10.9))) \ 254 __attribute__((availability(ios,strict,introduced=7.0))) 255 256 // locale::category 257# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \ 258 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000) 259# define _LIBCPP_AVAILABILITY_HAS_NO_LOCALE_CATEGORY 260# endif 261# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ 262 __attribute__((availability(macos,strict,introduced=10.9))) \ 263 __attribute__((availability(ios,strict,introduced=7.0))) 264 265 // atomic operations on shared_ptr 266# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \ 267 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000) 268# define _LIBCPP_AVAILABILITY_HAS_NO_ATOMIC_SHARED_PTR 269# endif 270# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ 271 __attribute__((availability(macos,strict,introduced=10.9))) \ 272 __attribute__((availability(ios,strict,introduced=7.0))) 273 274 // <filesystem> 275# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \ 276 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \ 277 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \ 278 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) 279# define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM_LIBRARY 280# endif 281# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \ 282 __attribute__((availability(macos,strict,introduced=10.15))) \ 283 __attribute__((availability(ios,strict,introduced=13.0))) \ 284 __attribute__((availability(tvos,strict,introduced=13.0))) \ 285 __attribute__((availability(watchos,strict,introduced=6.0))) 286# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH \ 287 _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \ 288 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ 289 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ 290 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") 291# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP \ 292 _Pragma("clang attribute pop") \ 293 _Pragma("clang attribute pop") \ 294 _Pragma("clang attribute pop") \ 295 _Pragma("clang attribute pop") 296 297 // std::to_chars(floating-point) 298# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) || \ 299 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \ 300 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) || \ 301 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300) 302# define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT 303# endif 304# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \ 305 __attribute__((availability(macos,strict,introduced=13.3))) \ 306 __attribute__((availability(ios,strict,introduced=16.3))) \ 307 __attribute__((availability(tvos,strict,introduced=16.3))) \ 308 __attribute__((availability(watchos,strict,introduced=9.3))) 309 310 // c++20 synchronization library 311# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \ 312 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \ 313 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \ 314 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000) 315# define _LIBCPP_AVAILABILITY_HAS_NO_SYNC 316# endif 317# define _LIBCPP_AVAILABILITY_SYNC \ 318 __attribute__((availability(macos,strict,introduced=11.0))) \ 319 __attribute__((availability(ios,strict,introduced=14.0))) \ 320 __attribute__((availability(tvos,strict,introduced=14.0))) \ 321 __attribute__((availability(watchos,strict,introduced=7.0))) 322 323 // __libcpp_verbose_abort 324# if 1 // TODO: Update once this is released 325# define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT 326# endif 327# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT \ 328 __attribute__((unavailable)) 329 330 // std::pmr 331# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \ 332 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \ 333 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \ 334 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000) 335# define _LIBCPP_AVAILABILITY_HAS_NO_PMR 336# endif 337// TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed 338// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support 339// 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 340// use availability annotations until that bug has been fixed. 341# if 0 342# define _LIBCPP_AVAILABILITY_PMR \ 343 __attribute__((availability(macos, strict, introduced = 14.0))) \ 344 __attribute__((availability(ios, strict, introduced = 17.0))) \ 345 __attribute__((availability(tvos, strict, introduced = 17.0))) \ 346 __attribute__((availability(watchos, strict, introduced = 10.0))) 347# else 348# define _LIBCPP_AVAILABILITY_PMR 349# endif 350 351#else 352 353// ...New vendors can add availability markup here... 354 355# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!" 356 357#endif 358 359// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS. 360// Those are defined in terms of the availability attributes above, and 361// should not be vendor-specific. 362#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) 363# define _LIBCPP_AVAILABILITY_FUTURE 364# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST 365# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS 366# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS 367#else 368# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR 369# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST 370# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS 371# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS 372#endif 373 374#endif // _LIBCPP___AVAILABILITY 375