401 lines · c
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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___CXX03___CONFIGURATION_AVAILABILITY_H11#define _LIBCPP___CXX03___CONFIGURATION_AVAILABILITY_H12 13#include <__cxx03/__configuration/compiler.h>14#include <__cxx03/__configuration/language.h>15 16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)17# pragma GCC system_header18#endif19 20// Libc++ is shipped by various vendors. In particular, it is used as a system21// library on macOS, iOS and other Apple platforms. In order for users to be22// able to compile a binary that is intended to be deployed to an older version23// of a platform, Clang provides availability attributes [1]. These attributes24// can be placed on declarations and are used to describe the life cycle of a25// symbol in the library.26//27// The main goal is to ensure a compile-time error if a symbol that hasn't been28// introduced in a previously released library is used in a program that targets29// that previously released library. Normally, this would be a load-time error30// when one tries to launch the program against the older library.31//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 on34// a macOS 10.15 host but targets macOS 10.13 with their program, the compiler35// would normally not complain (because the required declarations are in the36// headers), but the dynamic loader would fail to find the symbols when actually37// trying to launch the program on macOS 10.13. To turn this into a compile-time38// issue instead, declarations are annotated with when they were introduced, and39// the compiler can produce a diagnostic if the program references something that40// isn't available on the deployment target.41//42// This mechanism is general in nature, and any vendor can add their markup to43// the library (see below). Whenever a new feature is added that requires support44// in the shared library, two macros are added below to allow marking the feature45// as unavailable:46// 1. A macro named `_LIBCPP_AVAILABILITY_HAS_<feature>` which must be defined47// to `_LIBCPP_INTRODUCED_IN_<version>` for the appropriate LLVM version.48// 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must be defined to49// `_LIBCPP_INTRODUCED_IN_<version>_MARKUP` for the appropriate LLVM version.50//51// When vendors decide to ship the feature as part of their shared library, they52// 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 library54// will then use this markup to provide an optimal user experience on these platforms.55//56// Furthermore, many features in the standard library have corresponding57// feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_<feature>` macros58// are checked by the corresponding feature-test macros generated by59// generate_feature_test_macro_components.py to ensure that the library60// doesn't announce a feature as being implemented if it is unavailable on61// the deployment target.62//63// Note that this mechanism is disabled by default in the "upstream" libc++.64// Availability annotations are only meaningful when shipping libc++ inside65// a platform (i.e. as a system library), and so vendors that want them should66// turn those annotations on at CMake configuration time.67//68// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability69 70// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY71// for a while.72#if defined(_LIBCPP_DISABLE_AVAILABILITY)73# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)74# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS75# endif76#endif77 78// Availability markup is disabled when building the library, or when a non-Clang79// compiler is used because only Clang supports the necessary attributes.80#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || !defined(_LIBCPP_COMPILER_CLANG_BASED)81# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)82# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS83# endif84#endif85 86// When availability annotations are disabled, we take for granted that features introduced87// in all versions of the library are available.88#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)89 90# define _LIBCPP_INTRODUCED_IN_LLVM_19 191# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE /* nothing */92 93# define _LIBCPP_INTRODUCED_IN_LLVM_18 194# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE /* nothing */95 96# define _LIBCPP_INTRODUCED_IN_LLVM_17 197# define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE /* nothing */98 99# define _LIBCPP_INTRODUCED_IN_LLVM_16 1100# define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE /* nothing */101 102# define _LIBCPP_INTRODUCED_IN_LLVM_15 1103# define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE /* nothing */104 105# define _LIBCPP_INTRODUCED_IN_LLVM_14 1106# define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE /* nothing */107 108# define _LIBCPP_INTRODUCED_IN_LLVM_13 1109# define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE /* nothing */110 111# define _LIBCPP_INTRODUCED_IN_LLVM_12 1112# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */113 114# define _LIBCPP_INTRODUCED_IN_LLVM_11 1115# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */116 117# define _LIBCPP_INTRODUCED_IN_LLVM_10 1118# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE /* nothing */119 120# define _LIBCPP_INTRODUCED_IN_LLVM_9 1121# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE /* nothing */122# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */123# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP /* nothing */124 125# define _LIBCPP_INTRODUCED_IN_LLVM_8 1126# define _LIBCPP_INTRODUCED_IN_LLVM_8_ATTRIBUTE /* nothing */127 128# define _LIBCPP_INTRODUCED_IN_LLVM_4 1129# define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE /* nothing */130 131#elif defined(__APPLE__)132 133// clang-format off134 135// LLVM 19136// TODO: Fill this in137# define _LIBCPP_INTRODUCED_IN_LLVM_19 0138# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))139 140// LLVM 18141// TODO: Fill this in142# define _LIBCPP_INTRODUCED_IN_LLVM_18 0143# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE __attribute__((unavailable))144 145// LLVM 17146# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140400) || \147 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170400) || \148 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170400) || \149 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100400)150# define _LIBCPP_INTRODUCED_IN_LLVM_17 0151# else152# define _LIBCPP_INTRODUCED_IN_LLVM_17 1153# endif154# define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE \155 __attribute__((availability(macos, strict, introduced = 14.4))) \156 __attribute__((availability(ios, strict, introduced = 17.4))) \157 __attribute__((availability(tvos, strict, introduced = 17.4))) \158 __attribute__((availability(watchos, strict, introduced = 10.4)))159 160// LLVM 16161# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \162 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \163 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \164 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000)165# define _LIBCPP_INTRODUCED_IN_LLVM_16 0166# else167# define _LIBCPP_INTRODUCED_IN_LLVM_16 1168# endif169# define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE \170 __attribute__((availability(macos, strict, introduced = 14.0))) \171 __attribute__((availability(ios, strict, introduced = 17.0))) \172 __attribute__((availability(tvos, strict, introduced = 17.0))) \173 __attribute__((availability(watchos, strict, introduced = 10.0)))174 175// LLVM 15176# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130400) || \177 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160500) || \178 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160500) || \179 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90500)180# define _LIBCPP_INTRODUCED_IN_LLVM_15 0181# else182# define _LIBCPP_INTRODUCED_IN_LLVM_15 1183# endif184# define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE \185 __attribute__((availability(macos, strict, introduced = 13.4))) \186 __attribute__((availability(ios, strict, introduced = 16.5))) \187 __attribute__((availability(tvos, strict, introduced = 16.5))) \188 __attribute__((availability(watchos, strict, introduced = 9.5)))189 190// LLVM 14191# define _LIBCPP_INTRODUCED_IN_LLVM_14 _LIBCPP_INTRODUCED_IN_LLVM_15192# define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE193 194// LLVM 13195# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130000) || \196 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160000) || \197 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160000) || \198 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90000)199# define _LIBCPP_INTRODUCED_IN_LLVM_13 0200# else201# define _LIBCPP_INTRODUCED_IN_LLVM_13 1202# endif203# define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE \204 __attribute__((availability(macos, strict, introduced = 13.0))) \205 __attribute__((availability(ios, strict, introduced = 16.0))) \206 __attribute__((availability(tvos, strict, introduced = 16.0))) \207 __attribute__((availability(watchos, strict, introduced = 9.0)))208 209// LLVM 12210# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120300) || \211 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150300) || \212 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150300) || \213 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80300)214# define _LIBCPP_INTRODUCED_IN_LLVM_12 0215# else216# define _LIBCPP_INTRODUCED_IN_LLVM_12 1217# endif218# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE \219 __attribute__((availability(macos, strict, introduced = 12.3))) \220 __attribute__((availability(ios, strict, introduced = 15.3))) \221 __attribute__((availability(tvos, strict, introduced = 15.3))) \222 __attribute__((availability(watchos, strict, introduced = 8.3)))223 224// LLVM 11225# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \226 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \227 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \228 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)229# define _LIBCPP_INTRODUCED_IN_LLVM_11 0230# else231# define _LIBCPP_INTRODUCED_IN_LLVM_11 1232# endif233# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE \234 __attribute__((availability(macos, strict, introduced = 11.0))) \235 __attribute__((availability(ios, strict, introduced = 14.0))) \236 __attribute__((availability(tvos, strict, introduced = 14.0))) \237 __attribute__((availability(watchos, strict, introduced = 7.0)))238 239// LLVM 10240# define _LIBCPP_INTRODUCED_IN_LLVM_10 _LIBCPP_INTRODUCED_IN_LLVM_11241# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE242 243// LLVM 9244# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \245 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \246 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \247 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)248# define _LIBCPP_INTRODUCED_IN_LLVM_9 0249# else250# define _LIBCPP_INTRODUCED_IN_LLVM_9 1251# endif252# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE \253 __attribute__((availability(macos, strict, introduced = 10.15))) \254 __attribute__((availability(ios, strict, introduced = 13.0))) \255 __attribute__((availability(tvos, strict, introduced = 13.0))) \256 __attribute__((availability(watchos, strict, introduced = 6.0)))257# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH \258 _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \259 _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \260 _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \261 _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")262# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP \263 _Pragma("clang attribute pop") \264 _Pragma("clang attribute pop") \265 _Pragma("clang attribute pop") \266 _Pragma("clang attribute pop")267 268// LLVM 4269# if defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000270# define _LIBCPP_INTRODUCED_IN_LLVM_4 0271# else272# define _LIBCPP_INTRODUCED_IN_LLVM_4 1273# endif274# define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE __attribute__((availability(watchos, strict, introduced = 5.0)))275 276// clang-format on277 278#else279 280// ...New vendors can add availability markup here...281 282# error \283 "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"284 285#endif286 287// These macros control the availability of std::bad_optional_access and288// other exception types. These were put in the shared library to prevent289// code bloat from every user program defining the vtable for these exception290// types.291//292// Note that when exceptions are disabled, the methods that normally throw293// these exceptions can be used even on older deployment targets, but those294// methods will abort instead of throwing.295#define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4296#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE297 298#define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4299#define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE300 301#define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4302#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE303 304// These macros control the availability of all parts of <filesystem> that305// depend on something in the dylib.306#define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9307#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE308#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH309#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP310 311// This controls the availability of the C++20 synchronization library,312// which requires shared library support for various operations313// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,314// <semaphore>, and notification functions on std::atomic.315#define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11316#define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE317 318// Enable additional explicit instantiations of iostreams components. This319// reduces the number of weak definitions generated in programs that use320// iostreams by providing a single strong definition in the shared library.321//322// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,323// or once libc++ doesn't use the attribute anymore.324// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.325#if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)326# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12327#else328# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0329#endif330 331// This controls the availability of floating-point std::to_chars functions.332// These overloads were added later than the integer overloads.333#define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14334#define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE335 336// This controls whether the library claims to provide a default verbose337// termination function, and consequently whether the headers will try338// to use it when the mechanism isn't overriden at compile-time.339#define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15340#define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE341 342// This controls the availability of the C++17 std::pmr library,343// which is implemented in large part in the built library.344//345// TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed346// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support347// it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we348// use availability annotations until that bug has been fixed.349#define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16350#define _LIBCPP_AVAILABILITY_PMR351 352// These macros controls the availability of __cxa_init_primary_exception353// in the built library, which std::make_exception_ptr might use354// (see libcxx/include/__exception/exception_ptr.h).355#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18356#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE357 358// This controls the availability of C++23 <print>, which359// has a dependency on the built library (it needs access to360// the underlying buffer types of std::cout, std::cerr, and std::clog.361#define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18362#define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE363 364// This controls the availability of the C++20 time zone database.365// The parser code is built in the library.366#define _LIBCPP_AVAILABILITY_HAS_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19367#define _LIBCPP_AVAILABILITY_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE368 369// These macros determine whether we assume that std::bad_function_call and370// std::bad_expected_access provide a key function in the dylib. This allows371// centralizing their vtable and typeinfo instead of having all TUs provide372// a weak definition that then gets deduplicated.373#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19374#define _LIBCPP_AVAILABILITY_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE375#define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19376#define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE377 378// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.379// Those are defined in terms of the availability attributes above, and380// should not be vendor-specific.381#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)382# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST383# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS384# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS385#else386# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST387# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS388# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS389#endif390 391// Define availability attributes that depend on both392// _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI.393#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI)394# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION395# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION396# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0397# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION398#endif399 400#endif // _LIBCPP___CXX03___CONFIGURATION_AVAILABILITY_H401