Path: blob/main/contrib/llvm-project/libcxx/include/__configuration/availability.h
35260 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___CONFIGURATION_AVAILABILITY_H10#define _LIBCPP___CONFIGURATION_AVAILABILITY_H1112#include <__configuration/compiler.h>13#include <__configuration/language.h>1415#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16# pragma GCC system_header17#endif1819// Libc++ is shipped by various vendors. In particular, it is used as a system20// library on macOS, iOS and other Apple platforms. In order for users to be21// able to compile a binary that is intended to be deployed to an older version22// of a platform, Clang provides availability attributes [1]. These attributes23// can be placed on declarations and are used to describe the life cycle of a24// symbol in the library.25//26// The main goal is to ensure a compile-time error if a symbol that hasn't been27// introduced in a previously released library is used in a program that targets28// that previously released library. Normally, this would be a load-time error29// when one tries to launch the program against the older library.30//31// For example, the filesystem library was introduced in the dylib in LLVM 9.32// On Apple platforms, this corresponds to macOS 10.15. If a user compiles on33// a macOS 10.15 host but targets macOS 10.13 with their program, the compiler34// would normally not complain (because the required declarations are in the35// headers), but the dynamic loader would fail to find the symbols when actually36// trying to launch the program on macOS 10.13. To turn this into a compile-time37// issue instead, declarations are annotated with when they were introduced, and38// the compiler can produce a diagnostic if the program references something that39// isn't available on the deployment target.40//41// This mechanism is general in nature, and any vendor can add their markup to42// the library (see below). Whenever a new feature is added that requires support43// in the shared library, two macros are added below to allow marking the feature44// as unavailable:45// 1. A macro named `_LIBCPP_AVAILABILITY_HAS_<feature>` which must be defined46// to `_LIBCPP_INTRODUCED_IN_<version>` for the appropriate LLVM version.47// 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must be defined to48// `_LIBCPP_INTRODUCED_IN_<version>_MARKUP` for the appropriate LLVM version.49//50// When vendors decide to ship the feature as part of their shared library, they51// can update the `_LIBCPP_INTRODUCED_IN_<version>` macro (and the markup counterpart)52// based on the platform version they shipped that version of LLVM in. The library53// will then use this markup to provide an optimal user experience on these platforms.54//55// Furthermore, many features in the standard library have corresponding56// feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_<feature>` macros57// are checked by the corresponding feature-test macros generated by58// generate_feature_test_macro_components.py to ensure that the library59// doesn't announce a feature as being implemented if it is unavailable on60// the deployment target.61//62// Note that this mechanism is disabled by default in the "upstream" libc++.63// Availability annotations are only meaningful when shipping libc++ inside64// a platform (i.e. as a system library), and so vendors that want them should65// turn those annotations on at CMake configuration time.66//67// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability6869// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY70// for a while.71#if defined(_LIBCPP_DISABLE_AVAILABILITY)72# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)73# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS74# endif75#endif7677// Availability markup is disabled when building the library, or when a non-Clang78// 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# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)81# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS82# endif83#endif8485// When availability annotations are disabled, we take for granted that features introduced86// in all versions of the library are available.87#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)8889# define _LIBCPP_INTRODUCED_IN_LLVM_19 190# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE /* nothing */9192# define _LIBCPP_INTRODUCED_IN_LLVM_18 193# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE /* nothing */9495# define _LIBCPP_INTRODUCED_IN_LLVM_17 196# define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE /* nothing */9798# define _LIBCPP_INTRODUCED_IN_LLVM_16 199# define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE /* nothing */100101# define _LIBCPP_INTRODUCED_IN_LLVM_15 1102# define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE /* nothing */103104# define _LIBCPP_INTRODUCED_IN_LLVM_14 1105# define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE /* nothing */106107# define _LIBCPP_INTRODUCED_IN_LLVM_13 1108# define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE /* nothing */109110# define _LIBCPP_INTRODUCED_IN_LLVM_12 1111# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */112113# define _LIBCPP_INTRODUCED_IN_LLVM_11 1114# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */115116# define _LIBCPP_INTRODUCED_IN_LLVM_10 1117# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE /* nothing */118119# define _LIBCPP_INTRODUCED_IN_LLVM_9 1120# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE /* nothing */121# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */122# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP /* nothing */123124# define _LIBCPP_INTRODUCED_IN_LLVM_8 1125# define _LIBCPP_INTRODUCED_IN_LLVM_8_ATTRIBUTE /* nothing */126127# define _LIBCPP_INTRODUCED_IN_LLVM_4 1128# define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE /* nothing */129130#elif defined(__APPLE__)131132// clang-format off133134// LLVM 19135// TODO: Fill this in136# define _LIBCPP_INTRODUCED_IN_LLVM_19 0137# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))138139// LLVM 18140// TODO: Fill this in141# define _LIBCPP_INTRODUCED_IN_LLVM_18 0142# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE __attribute__((unavailable))143144// LLVM 17145# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140400) || \146(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170400) || \147(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170400) || \148(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100400)149# define _LIBCPP_INTRODUCED_IN_LLVM_17 0150# else151# define _LIBCPP_INTRODUCED_IN_LLVM_17 1152# endif153# define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE \154__attribute__((availability(macos, strict, introduced = 14.4))) \155__attribute__((availability(ios, strict, introduced = 17.4))) \156__attribute__((availability(tvos, strict, introduced = 17.4))) \157__attribute__((availability(watchos, strict, introduced = 10.4)))158159// LLVM 16160# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \161(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \162(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \163(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000)164# define _LIBCPP_INTRODUCED_IN_LLVM_16 0165# else166# define _LIBCPP_INTRODUCED_IN_LLVM_16 1167# endif168# define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE \169__attribute__((availability(macos, strict, introduced = 14.0))) \170__attribute__((availability(ios, strict, introduced = 17.0))) \171__attribute__((availability(tvos, strict, introduced = 17.0))) \172__attribute__((availability(watchos, strict, introduced = 10.0)))173174// LLVM 15175# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130400) || \176(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160500) || \177(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160500) || \178(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90500)179# define _LIBCPP_INTRODUCED_IN_LLVM_15 0180# else181# define _LIBCPP_INTRODUCED_IN_LLVM_15 1182# endif183# define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE \184__attribute__((availability(macos, strict, introduced = 13.4))) \185__attribute__((availability(ios, strict, introduced = 16.5))) \186__attribute__((availability(tvos, strict, introduced = 16.5))) \187__attribute__((availability(watchos, strict, introduced = 9.5)))188189// LLVM 14190# define _LIBCPP_INTRODUCED_IN_LLVM_14 _LIBCPP_INTRODUCED_IN_LLVM_15191# define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE192193// LLVM 13194# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130000) || \195(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160000) || \196(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160000) || \197(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90000)198# define _LIBCPP_INTRODUCED_IN_LLVM_13 0199# else200# define _LIBCPP_INTRODUCED_IN_LLVM_13 1201# endif202# define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE \203__attribute__((availability(macos, strict, introduced = 13.0))) \204__attribute__((availability(ios, strict, introduced = 16.0))) \205__attribute__((availability(tvos, strict, introduced = 16.0))) \206__attribute__((availability(watchos, strict, introduced = 9.0)))207208// LLVM 12209# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120300) || \210(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150300) || \211(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150300) || \212(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80300)213# define _LIBCPP_INTRODUCED_IN_LLVM_12 0214# else215# define _LIBCPP_INTRODUCED_IN_LLVM_12 1216# endif217# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE \218__attribute__((availability(macos, strict, introduced = 12.3))) \219__attribute__((availability(ios, strict, introduced = 15.3))) \220__attribute__((availability(tvos, strict, introduced = 15.3))) \221__attribute__((availability(watchos, strict, introduced = 8.3)))222223// LLVM 11224# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \225(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \226(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \227(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)228# define _LIBCPP_INTRODUCED_IN_LLVM_11 0229# else230# define _LIBCPP_INTRODUCED_IN_LLVM_11 1231# endif232# define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE \233__attribute__((availability(macos, strict, introduced = 11.0))) \234__attribute__((availability(ios, strict, introduced = 14.0))) \235__attribute__((availability(tvos, strict, introduced = 14.0))) \236__attribute__((availability(watchos, strict, introduced = 7.0)))237238// LLVM 10239# define _LIBCPP_INTRODUCED_IN_LLVM_10 _LIBCPP_INTRODUCED_IN_LLVM_11240# define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE241242// LLVM 9243# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \244(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \245(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \246(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)247# define _LIBCPP_INTRODUCED_IN_LLVM_9 0248# else249# define _LIBCPP_INTRODUCED_IN_LLVM_9 1250# endif251# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE \252__attribute__((availability(macos, strict, introduced = 10.15))) \253__attribute__((availability(ios, strict, introduced = 13.0))) \254__attribute__((availability(tvos, strict, introduced = 13.0))) \255__attribute__((availability(watchos, strict, introduced = 6.0)))256# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH \257_Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \258_Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \259_Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \260_Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")261# define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP \262_Pragma("clang attribute pop") \263_Pragma("clang attribute pop") \264_Pragma("clang attribute pop") \265_Pragma("clang attribute pop")266267// LLVM 4268# if defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000269# define _LIBCPP_INTRODUCED_IN_LLVM_4 0270# else271# define _LIBCPP_INTRODUCED_IN_LLVM_4 1272# endif273# define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE __attribute__((availability(watchos, strict, introduced = 5.0)))274275// clang-format on276277#else278279// ...New vendors can add availability markup here...280281# error \282"It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"283284#endif285286// These macros control the availability of std::bad_optional_access and287// other exception types. These were put in the shared library to prevent288// code bloat from every user program defining the vtable for these exception289// types.290//291// Note that when exceptions are disabled, the methods that normally throw292// these exceptions can be used even on older deployment targets, but those293// methods will abort instead of throwing.294#define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4295#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE296297#define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4298#define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE299300#define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4301#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE302303// These macros control the availability of all parts of <filesystem> that304// depend on something in the dylib.305#define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9306#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE307#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH308#define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP309310// This controls the availability of the C++20 synchronization library,311// which requires shared library support for various operations312// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,313// <semaphore>, and notification functions on std::atomic.314#define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11315#define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE316317// Enable additional explicit instantiations of iostreams components. This318// reduces the number of weak definitions generated in programs that use319// iostreams by providing a single strong definition in the shared library.320//321// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,322// or once libc++ doesn't use the attribute anymore.323// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.324#if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)325# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12326#else327# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0328#endif329330// This controls the availability of floating-point std::to_chars functions.331// These overloads were added later than the integer overloads.332#define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14333#define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE334335// This controls whether the library claims to provide a default verbose336// termination function, and consequently whether the headers will try337// to use it when the mechanism isn't overriden at compile-time.338#define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15339#define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE340341// This controls the availability of the C++17 std::pmr library,342// which is implemented in large part in the built library.343//344// TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed345// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support346// it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we347// use availability annotations until that bug has been fixed.348#define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16349#define _LIBCPP_AVAILABILITY_PMR350351// These macros controls the availability of __cxa_init_primary_exception352// in the built library, which std::make_exception_ptr might use353// (see libcxx/include/__exception/exception_ptr.h).354#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18355#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE356357// This controls the availability of C++23 <print>, which358// has a dependency on the built library (it needs access to359// the underlying buffer types of std::cout, std::cerr, and std::clog.360#define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18361#define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE362363// This controls the availability of the C++20 time zone database.364// The parser code is built in the library.365#define _LIBCPP_AVAILABILITY_HAS_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19366#define _LIBCPP_AVAILABILITY_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE367368// These macros determine whether we assume that std::bad_function_call and369// std::bad_expected_access provide a key function in the dylib. This allows370// centralizing their vtable and typeinfo instead of having all TUs provide371// a weak definition that then gets deduplicated.372#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19373#define _LIBCPP_AVAILABILITY_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE374#define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19375#define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE376377// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.378// Those are defined in terms of the availability attributes above, and379// should not be vendor-specific.380#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)381# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST382# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS383# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS384#else385# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST386# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS387# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS388#endif389390// Define availability attributes that depend on both391// _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI.392#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI)393# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION394# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION395# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0396# define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION397#endif398399#endif // _LIBCPP___CONFIGURATION_AVAILABILITY_H400401402