Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:17

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CONFIGURATION_AVAILABILITY_H
0011 #define _LIBCPP___CONFIGURATION_AVAILABILITY_H
0012 
0013 #include <__configuration/compiler.h>
0014 #include <__configuration/language.h>
0015 
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 #  pragma GCC system_header
0018 #endif
0019 
0020 // Libc++ is shipped by various vendors. In particular, it is used as a system
0021 // library on macOS, iOS and other Apple platforms. In order for users to be
0022 // able to compile a binary that is intended to be deployed to an older version
0023 // of a platform, Clang provides availability attributes [1]. These attributes
0024 // can be placed on declarations and are used to describe the life cycle of a
0025 // symbol in the library.
0026 //
0027 // The main goal is to ensure a compile-time error if a symbol that hasn't been
0028 // introduced in a previously released library is used in a program that targets
0029 // that previously released library. Normally, this would be a load-time error
0030 // when one tries to launch the program against the older library.
0031 //
0032 // For example, the filesystem library was introduced in the dylib in LLVM 9.
0033 // On Apple platforms, this corresponds to macOS 10.15. If a user compiles on
0034 // a macOS 10.15 host but targets macOS 10.13 with their program, the compiler
0035 // would normally not complain (because the required declarations are in the
0036 // headers), but the dynamic loader would fail to find the symbols when actually
0037 // trying to launch the program on macOS 10.13. To turn this into a compile-time
0038 // issue instead, declarations are annotated with when they were introduced, and
0039 // the compiler can produce a diagnostic if the program references something that
0040 // isn't available on the deployment target.
0041 //
0042 // This mechanism is general in nature, and any vendor can add their markup to
0043 // the library (see below). Whenever a new feature is added that requires support
0044 // in the shared library, two macros are added below to allow marking the feature
0045 // as unavailable:
0046 // 1. A macro named `_LIBCPP_AVAILABILITY_HAS_<feature>` which must be defined
0047 //    to `_LIBCPP_INTRODUCED_IN_<version>` for the appropriate LLVM version.
0048 // 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must be defined to
0049 //    `_LIBCPP_INTRODUCED_IN_<version>_MARKUP` for the appropriate LLVM version.
0050 //
0051 // When vendors decide to ship the feature as part of their shared library, they
0052 // can update the `_LIBCPP_INTRODUCED_IN_<version>` macro (and the markup counterpart)
0053 // based on the platform version they shipped that version of LLVM in. The library
0054 // will then use this markup to provide an optimal user experience on these platforms.
0055 //
0056 // Furthermore, many features in the standard library have corresponding
0057 // feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_<feature>` macros
0058 // are checked by the corresponding feature-test macros generated by
0059 // generate_feature_test_macro_components.py to ensure that the library
0060 // doesn't announce a feature as being implemented if it is unavailable on
0061 // the deployment target.
0062 //
0063 // Note that this mechanism is disabled by default in the "upstream" libc++.
0064 // Availability annotations are only meaningful when shipping libc++ inside
0065 // a platform (i.e. as a system library), and so vendors that want them should
0066 // turn those annotations on at CMake configuration time.
0067 //
0068 // [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
0069 
0070 // Availability markup is disabled when building the library, or when a non-Clang
0071 // compiler is used because only Clang supports the necessary attributes.
0072 //
0073 // We also allow users to force-disable availability markup via the `_LIBCPP_DISABLE_AVAILABILITY`
0074 // macro because that is the only way to work around a Clang bug related to availability
0075 // attributes: https://github.com/llvm/llvm-project/issues/134151.
0076 // Once that bug has been fixed, we should remove the macro.
0077 #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) ||                                       \
0078     !defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_DISABLE_AVAILABILITY)
0079 #  undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
0080 #  define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
0081 #endif
0082 
0083 // When availability annotations are disabled, we take for granted that features introduced
0084 // in all versions of the library are available.
0085 #if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
0086 
0087 #  define _LIBCPP_INTRODUCED_IN_LLVM_20 1
0088 #  define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE /* nothing */
0089 
0090 #  define _LIBCPP_INTRODUCED_IN_LLVM_19 1
0091 #  define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE /* nothing */
0092 
0093 #  define _LIBCPP_INTRODUCED_IN_LLVM_18 1
0094 #  define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE /* nothing */
0095 
0096 #  define _LIBCPP_INTRODUCED_IN_LLVM_16 1
0097 #  define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE /* nothing */
0098 
0099 #  define _LIBCPP_INTRODUCED_IN_LLVM_15 1
0100 #  define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE /* nothing */
0101 
0102 #  define _LIBCPP_INTRODUCED_IN_LLVM_14 1
0103 #  define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE /* nothing */
0104 
0105 #  define _LIBCPP_INTRODUCED_IN_LLVM_12 1
0106 #  define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */
0107 
0108 #  define _LIBCPP_INTRODUCED_IN_LLVM_11 1
0109 #  define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */
0110 
0111 #  define _LIBCPP_INTRODUCED_IN_LLVM_9 1
0112 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE      /* nothing */
0113 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */
0114 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP  /* nothing */
0115 
0116 #  define _LIBCPP_INTRODUCED_IN_LLVM_4 1
0117 #  define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE /* nothing */
0118 
0119 #elif defined(__APPLE__)
0120 
0121 // clang-format off
0122 
0123 // LLVM 20
0124 // TODO: Fill this in
0125 #  define _LIBCPP_INTRODUCED_IN_LLVM_20 0
0126 #  define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE __attribute__((unavailable))
0127 
0128 // LLVM 19
0129 // TODO: Fill this in
0130 #  define _LIBCPP_INTRODUCED_IN_LLVM_19 0
0131 #  define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))
0132 
0133 // LLVM 18
0134 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) ||       \
0135       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180000) ||     \
0136       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180000) ||             \
0137       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110000) ||       \
0138       (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90000) ||      \
0139       (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 240000)
0140 #    define _LIBCPP_INTRODUCED_IN_LLVM_18 0
0141 #  else
0142 #    define _LIBCPP_INTRODUCED_IN_LLVM_18 1
0143 #  endif
0144 #  define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE                                                                 \
0145     __attribute__((availability(macos, strict, introduced = 15.0)))                                               \
0146     __attribute__((availability(ios, strict, introduced = 18.0)))                                                 \
0147     __attribute__((availability(tvos, strict, introduced = 18.0)))                                                \
0148     __attribute__((availability(watchos, strict, introduced = 11.0)))                                             \
0149     __attribute__((availability(bridgeos, strict, introduced = 9.0)))                                             \
0150     __attribute__((availability(driverkit, strict, introduced = 24.0)))
0151 
0152 // LLVM 16
0153 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) ||       \
0154       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) ||     \
0155       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) ||             \
0156       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000) ||       \
0157       (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 80000) ||      \
0158       (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 230000)
0159 #    define _LIBCPP_INTRODUCED_IN_LLVM_16 0
0160 #  else
0161 #    define _LIBCPP_INTRODUCED_IN_LLVM_16 1
0162 #  endif
0163 #  define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE                                                                 \
0164     __attribute__((availability(macos, strict, introduced = 14.0)))                                               \
0165     __attribute__((availability(ios, strict, introduced = 17.0)))                                                 \
0166     __attribute__((availability(tvos, strict, introduced = 17.0)))                                                \
0167     __attribute__((availability(watchos, strict, introduced = 10.0)))                                             \
0168     __attribute__((availability(bridgeos, strict, introduced = 8.0)))                                             \
0169     __attribute__((availability(driverkit, strict, introduced = 23.0)))
0170 
0171 // LLVM 15
0172 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) ||   \
0173       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \
0174       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) ||         \
0175       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300) ||    \
0176       (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 70500) ||  \
0177       (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 220400)
0178 #    define _LIBCPP_INTRODUCED_IN_LLVM_15 0
0179 #  else
0180 #    define _LIBCPP_INTRODUCED_IN_LLVM_15 1
0181 #  endif
0182 #  define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE                                                                 \
0183     __attribute__((availability(macos, strict, introduced = 13.3)))                                               \
0184     __attribute__((availability(ios, strict, introduced = 16.3)))                                                 \
0185     __attribute__((availability(tvos, strict, introduced = 16.3)))                                                \
0186     __attribute__((availability(watchos, strict, introduced = 9.3)))                                              \
0187     __attribute__((availability(bridgeos, strict, introduced = 7.5)))                                             \
0188     __attribute__((availability(driverkit, strict, introduced = 22.4)))
0189 
0190 // LLVM 14
0191 #  define _LIBCPP_INTRODUCED_IN_LLVM_14 _LIBCPP_INTRODUCED_IN_LLVM_15
0192 #  define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
0193 
0194 // LLVM 12
0195 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120300)   ||     \
0196       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150300) ||     \
0197       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150300)         ||     \
0198       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80300)    ||     \
0199       (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 60000)  ||     \
0200       (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 210300)
0201 #    define _LIBCPP_INTRODUCED_IN_LLVM_12 0
0202 #  else
0203 #    define _LIBCPP_INTRODUCED_IN_LLVM_12 1
0204 #  endif
0205 #  define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE                                                                 \
0206     __attribute__((availability(macos, strict, introduced = 12.3)))                                               \
0207     __attribute__((availability(ios, strict, introduced = 15.3)))                                                 \
0208     __attribute__((availability(tvos, strict, introduced = 15.3)))                                                \
0209     __attribute__((availability(watchos, strict, introduced = 8.3)))                                              \
0210     __attribute__((availability(bridgeos, strict, introduced = 6.0)))                                             \
0211     __attribute__((availability(driverkit, strict, introduced = 21.3)))
0212 
0213 // LLVM 11
0214 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) ||   \
0215       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
0216       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) ||         \
0217       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
0218 #    define _LIBCPP_INTRODUCED_IN_LLVM_11 0
0219 #  else
0220 #    define _LIBCPP_INTRODUCED_IN_LLVM_11 1
0221 #  endif
0222 #  define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE                                                                 \
0223     __attribute__((availability(macos, strict, introduced = 11.0)))                                               \
0224     __attribute__((availability(ios, strict, introduced = 14.0)))                                                 \
0225     __attribute__((availability(tvos, strict, introduced = 14.0)))                                                \
0226     __attribute__((availability(watchos, strict, introduced = 7.0)))
0227 
0228 // LLVM 9
0229 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) ||   \
0230       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
0231       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) ||         \
0232       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
0233 #    define _LIBCPP_INTRODUCED_IN_LLVM_9 0
0234 #  else
0235 #    define _LIBCPP_INTRODUCED_IN_LLVM_9 1
0236 #  endif
0237 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE                                                                  \
0238     __attribute__((availability(macos, strict, introduced = 10.15)))                                              \
0239     __attribute__((availability(ios, strict, introduced = 13.0)))                                                 \
0240     __attribute__((availability(tvos, strict, introduced = 13.0)))                                                \
0241     __attribute__((availability(watchos, strict, introduced = 6.0)))
0242 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH                                                                            \
0243     _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
0244     _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))")    \
0245     _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))")   \
0246     _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
0247 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP                                                                    \
0248     _Pragma("clang attribute pop") \
0249     _Pragma("clang attribute pop") \
0250     _Pragma("clang attribute pop") \
0251     _Pragma("clang attribute pop")
0252 
0253 // LLVM 4
0254 #  if defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000
0255 #    define _LIBCPP_INTRODUCED_IN_LLVM_4 0
0256 #  else
0257 #    define _LIBCPP_INTRODUCED_IN_LLVM_4 1
0258 #  endif
0259 #  define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE __attribute__((availability(watchos, strict, introduced = 5.0)))
0260 
0261 // clang-format on
0262 
0263 #else
0264 
0265 // ...New vendors can add availability markup here...
0266 
0267 #  error                                                                                                               \
0268       "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
0269 
0270 #endif
0271 
0272 // These macros control the availability of std::bad_optional_access and
0273 // other exception types. These were put in the shared library to prevent
0274 // code bloat from every user program defining the vtable for these exception
0275 // types.
0276 //
0277 // Note that when exceptions are disabled, the methods that normally throw
0278 // these exceptions can be used even on older deployment targets, but those
0279 // methods will abort instead of throwing.
0280 #define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4
0281 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
0282 
0283 #define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4
0284 #define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
0285 
0286 #define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4
0287 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
0288 
0289 // These macros control the availability of all parts of <filesystem> that
0290 // depend on something in the dylib.
0291 #define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9
0292 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE
0293 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH
0294 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP
0295 
0296 // This controls the availability of the C++20 synchronization library,
0297 // which requires shared library support for various operations
0298 // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
0299 // <semaphore>, and notification functions on std::atomic.
0300 #define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11
0301 #define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
0302 
0303 // Enable additional explicit instantiations of iostreams components. This
0304 // reduces the number of weak definitions generated in programs that use
0305 // iostreams by providing a single strong definition in the shared library.
0306 //
0307 // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
0308 //       or once libc++ doesn't use the attribute anymore.
0309 // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
0310 #if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
0311 #  define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12
0312 #else
0313 #  define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
0314 #endif
0315 
0316 // This controls the availability of floating-point std::to_chars functions.
0317 // These overloads were added later than the integer overloads.
0318 #define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14
0319 #define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE
0320 
0321 // This controls whether the library claims to provide a default verbose
0322 // termination function, and consequently whether the headers will try
0323 // to use it when the mechanism isn't overriden at compile-time.
0324 #define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15
0325 #define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
0326 
0327 // This controls the availability of the C++17 std::pmr library,
0328 // which is implemented in large part in the built library.
0329 //
0330 // TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed
0331 //       Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
0332 //       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
0333 //       use availability annotations until that bug has been fixed.
0334 #define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16
0335 #define _LIBCPP_AVAILABILITY_PMR
0336 
0337 // These macros controls the availability of __cxa_init_primary_exception
0338 // in the built library, which std::make_exception_ptr might use
0339 // (see libcxx/include/__exception/exception_ptr.h).
0340 #define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
0341 #define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
0342 
0343 // This controls the availability of C++23 <print>, which
0344 // has a dependency on the built library (it needs access to
0345 // the underlying buffer types of std::cout, std::cerr, and std::clog.
0346 #define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18
0347 #define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
0348 
0349 // This controls the availability of the C++20 time zone database.
0350 // The parser code is built in the library.
0351 #define _LIBCPP_AVAILABILITY_HAS_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19
0352 #define _LIBCPP_AVAILABILITY_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
0353 
0354 // These macros determine whether we assume that std::bad_function_call and
0355 // std::bad_expected_access provide a key function in the dylib. This allows
0356 // centralizing their vtable and typeinfo instead of having all TUs provide
0357 // a weak definition that then gets deduplicated.
0358 #define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
0359 #define _LIBCPP_AVAILABILITY_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
0360 #define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
0361 #define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
0362 
0363 // This controls the availability of floating-point std::from_chars functions.
0364 // These overloads were added later than the integer overloads.
0365 #define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20
0366 #define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE
0367 
0368 // Define availability attributes that depend on _LIBCPP_HAS_EXCEPTIONS.
0369 // Those are defined in terms of the availability attributes above, and
0370 // should not be vendor-specific.
0371 #if !_LIBCPP_HAS_EXCEPTIONS
0372 #  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
0373 #  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
0374 #  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
0375 #else
0376 #  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
0377 #  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
0378 #  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
0379 #endif
0380 
0381 // Define availability attributes that depend on both
0382 // _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
0383 #if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI
0384 #  undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
0385 #  undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
0386 #  define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0
0387 #  define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
0388 #endif
0389 
0390 #endif // _LIBCPP___CONFIGURATION_AVAILABILITY_H