Back to home page

EIC code displayed by LXR

 
 

    


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

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___CXX03___CONFIGURATION_AVAILABILITY_H
0011 #define _LIBCPP___CXX03___CONFIGURATION_AVAILABILITY_H
0012 
0013 #include <__cxx03/__configuration/compiler.h>
0014 #include <__cxx03/__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 // For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
0071 // for a while.
0072 #if defined(_LIBCPP_DISABLE_AVAILABILITY)
0073 #  if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
0074 #    define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
0075 #  endif
0076 #endif
0077 
0078 // Availability markup is disabled when building the library, or when a non-Clang
0079 // compiler is used because only Clang supports the necessary attributes.
0080 #if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || !defined(_LIBCPP_COMPILER_CLANG_BASED)
0081 #  if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
0082 #    define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
0083 #  endif
0084 #endif
0085 
0086 // When availability annotations are disabled, we take for granted that features introduced
0087 // in all versions of the library are available.
0088 #if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
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_17 1
0097 #  define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE /* nothing */
0098 
0099 #  define _LIBCPP_INTRODUCED_IN_LLVM_16 1
0100 #  define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE /* nothing */
0101 
0102 #  define _LIBCPP_INTRODUCED_IN_LLVM_15 1
0103 #  define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE /* nothing */
0104 
0105 #  define _LIBCPP_INTRODUCED_IN_LLVM_14 1
0106 #  define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE /* nothing */
0107 
0108 #  define _LIBCPP_INTRODUCED_IN_LLVM_13 1
0109 #  define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE /* nothing */
0110 
0111 #  define _LIBCPP_INTRODUCED_IN_LLVM_12 1
0112 #  define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */
0113 
0114 #  define _LIBCPP_INTRODUCED_IN_LLVM_11 1
0115 #  define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE /* nothing */
0116 
0117 #  define _LIBCPP_INTRODUCED_IN_LLVM_10 1
0118 #  define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE /* nothing */
0119 
0120 #  define _LIBCPP_INTRODUCED_IN_LLVM_9 1
0121 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE      /* nothing */
0122 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH /* nothing */
0123 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP  /* nothing */
0124 
0125 #  define _LIBCPP_INTRODUCED_IN_LLVM_8 1
0126 #  define _LIBCPP_INTRODUCED_IN_LLVM_8_ATTRIBUTE /* nothing */
0127 
0128 #  define _LIBCPP_INTRODUCED_IN_LLVM_4 1
0129 #  define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE /* nothing */
0130 
0131 #elif defined(__APPLE__)
0132 
0133 // clang-format off
0134 
0135 // LLVM 19
0136 // TODO: Fill this in
0137 #  define _LIBCPP_INTRODUCED_IN_LLVM_19 0
0138 #  define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable))
0139 
0140 // LLVM 18
0141 // TODO: Fill this in
0142 #  define _LIBCPP_INTRODUCED_IN_LLVM_18 0
0143 #  define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE __attribute__((unavailable))
0144 
0145 // LLVM 17
0146 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140400) ||       \
0147       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170400) ||     \
0148       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170400) ||             \
0149       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100400)
0150 #    define _LIBCPP_INTRODUCED_IN_LLVM_17 0
0151 #  else
0152 #    define _LIBCPP_INTRODUCED_IN_LLVM_17 1
0153 #  endif
0154 #  define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE                                                                 \
0155     __attribute__((availability(macos, strict, introduced = 14.4)))                                               \
0156     __attribute__((availability(ios, strict, introduced = 17.4)))                                                 \
0157     __attribute__((availability(tvos, strict, introduced = 17.4)))                                                \
0158     __attribute__((availability(watchos, strict, introduced = 10.4)))
0159 
0160 // LLVM 16
0161 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) ||       \
0162       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) ||     \
0163       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) ||             \
0164       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000)
0165 #    define _LIBCPP_INTRODUCED_IN_LLVM_16 0
0166 #  else
0167 #    define _LIBCPP_INTRODUCED_IN_LLVM_16 1
0168 #  endif
0169 #  define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE                                                                 \
0170     __attribute__((availability(macos, strict, introduced = 14.0)))                                               \
0171     __attribute__((availability(ios, strict, introduced = 17.0)))                                                 \
0172     __attribute__((availability(tvos, strict, introduced = 17.0)))                                                \
0173     __attribute__((availability(watchos, strict, introduced = 10.0)))
0174 
0175 // LLVM 15
0176 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130400) ||   \
0177       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160500) || \
0178       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160500) ||         \
0179       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90500)
0180 #    define _LIBCPP_INTRODUCED_IN_LLVM_15 0
0181 #  else
0182 #    define _LIBCPP_INTRODUCED_IN_LLVM_15 1
0183 #  endif
0184 #  define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE                                                                 \
0185     __attribute__((availability(macos, strict, introduced = 13.4)))                                               \
0186     __attribute__((availability(ios, strict, introduced = 16.5)))                                                 \
0187     __attribute__((availability(tvos, strict, introduced = 16.5)))                                                \
0188     __attribute__((availability(watchos, strict, introduced = 9.5)))
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 13
0195 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130000) ||   \
0196       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160000) || \
0197       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160000) ||         \
0198       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90000)
0199 #    define _LIBCPP_INTRODUCED_IN_LLVM_13 0
0200 #  else
0201 #    define _LIBCPP_INTRODUCED_IN_LLVM_13 1
0202 #  endif
0203 #  define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE                                                                 \
0204     __attribute__((availability(macos, strict, introduced = 13.0)))                                               \
0205     __attribute__((availability(ios, strict, introduced = 16.0)))                                                 \
0206     __attribute__((availability(tvos, strict, introduced = 16.0)))                                                \
0207     __attribute__((availability(watchos, strict, introduced = 9.0)))
0208 
0209 // LLVM 12
0210 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120300)   ||     \
0211       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150300) ||     \
0212       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150300)         ||     \
0213       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80300)
0214 #    define _LIBCPP_INTRODUCED_IN_LLVM_12 0
0215 #  else
0216 #    define _LIBCPP_INTRODUCED_IN_LLVM_12 1
0217 #  endif
0218 #  define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE                                                                 \
0219     __attribute__((availability(macos, strict, introduced = 12.3)))                                               \
0220     __attribute__((availability(ios, strict, introduced = 15.3)))                                                 \
0221     __attribute__((availability(tvos, strict, introduced = 15.3)))                                                \
0222     __attribute__((availability(watchos, strict, introduced = 8.3)))
0223 
0224 // LLVM 11
0225 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) ||   \
0226       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
0227       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) ||         \
0228       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
0229 #    define _LIBCPP_INTRODUCED_IN_LLVM_11 0
0230 #  else
0231 #    define _LIBCPP_INTRODUCED_IN_LLVM_11 1
0232 #  endif
0233 #  define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE                                                                 \
0234     __attribute__((availability(macos, strict, introduced = 11.0)))                                               \
0235     __attribute__((availability(ios, strict, introduced = 14.0)))                                                 \
0236     __attribute__((availability(tvos, strict, introduced = 14.0)))                                                \
0237     __attribute__((availability(watchos, strict, introduced = 7.0)))
0238 
0239 // LLVM 10
0240 #  define _LIBCPP_INTRODUCED_IN_LLVM_10 _LIBCPP_INTRODUCED_IN_LLVM_11
0241 #  define _LIBCPP_INTRODUCED_IN_LLVM_10_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
0242 
0243 // LLVM 9
0244 #  if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) ||   \
0245       (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
0246       (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) ||         \
0247       (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
0248 #    define _LIBCPP_INTRODUCED_IN_LLVM_9 0
0249 #  else
0250 #    define _LIBCPP_INTRODUCED_IN_LLVM_9 1
0251 #  endif
0252 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE                                                                  \
0253     __attribute__((availability(macos, strict, introduced = 10.15)))                                              \
0254     __attribute__((availability(ios, strict, introduced = 13.0)))                                                 \
0255     __attribute__((availability(tvos, strict, introduced = 13.0)))                                                \
0256     __attribute__((availability(watchos, strict, introduced = 6.0)))
0257 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH                                                                            \
0258     _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \
0259     _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))")    \
0260     _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))")   \
0261     _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
0262 #  define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP                                                                    \
0263     _Pragma("clang attribute pop") \
0264     _Pragma("clang attribute pop") \
0265     _Pragma("clang attribute pop") \
0266     _Pragma("clang attribute pop")
0267 
0268 // LLVM 4
0269 #  if defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000
0270 #    define _LIBCPP_INTRODUCED_IN_LLVM_4 0
0271 #  else
0272 #    define _LIBCPP_INTRODUCED_IN_LLVM_4 1
0273 #  endif
0274 #  define _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE __attribute__((availability(watchos, strict, introduced = 5.0)))
0275 
0276 // clang-format on
0277 
0278 #else
0279 
0280 // ...New vendors can add availability markup here...
0281 
0282 #  error                                                                                                               \
0283       "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
0284 
0285 #endif
0286 
0287 // These macros control the availability of std::bad_optional_access and
0288 // other exception types. These were put in the shared library to prevent
0289 // code bloat from every user program defining the vtable for these exception
0290 // types.
0291 //
0292 // Note that when exceptions are disabled, the methods that normally throw
0293 // these exceptions can be used even on older deployment targets, but those
0294 // methods will abort instead of throwing.
0295 #define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4
0296 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
0297 
0298 #define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4
0299 #define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
0300 
0301 #define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4
0302 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_INTRODUCED_IN_LLVM_4_ATTRIBUTE
0303 
0304 // These macros control the availability of all parts of <filesystem> that
0305 // depend on something in the dylib.
0306 #define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9
0307 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE
0308 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH
0309 #define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_POP
0310 
0311 // This controls the availability of the C++20 synchronization library,
0312 // which requires shared library support for various operations
0313 // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
0314 // <semaphore>, and notification functions on std::atomic.
0315 #define _LIBCPP_AVAILABILITY_HAS_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11
0316 #define _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE
0317 
0318 // Enable additional explicit instantiations of iostreams components. This
0319 // reduces the number of weak definitions generated in programs that use
0320 // iostreams by providing a single strong definition in the shared library.
0321 //
0322 // TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
0323 //       or once libc++ doesn't use the attribute anymore.
0324 // TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
0325 #if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
0326 #  define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12
0327 #else
0328 #  define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
0329 #endif
0330 
0331 // This controls the availability of floating-point std::to_chars functions.
0332 // These overloads were added later than the integer overloads.
0333 #define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14
0334 #define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE
0335 
0336 // This controls whether the library claims to provide a default verbose
0337 // termination function, and consequently whether the headers will try
0338 // to use it when the mechanism isn't overriden at compile-time.
0339 #define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15
0340 #define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
0341 
0342 // This controls the availability of the C++17 std::pmr library,
0343 // which is implemented in large part in the built library.
0344 //
0345 // TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed
0346 //       Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
0347 //       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
0348 //       use availability annotations until that bug has been fixed.
0349 #define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16
0350 #define _LIBCPP_AVAILABILITY_PMR
0351 
0352 // These macros controls the availability of __cxa_init_primary_exception
0353 // in the built library, which std::make_exception_ptr might use
0354 // (see libcxx/include/__exception/exception_ptr.h).
0355 #define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
0356 #define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
0357 
0358 // This controls the availability of C++23 <print>, which
0359 // has a dependency on the built library (it needs access to
0360 // the underlying buffer types of std::cout, std::cerr, and std::clog.
0361 #define _LIBCPP_AVAILABILITY_HAS_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18
0362 #define _LIBCPP_AVAILABILITY_PRINT _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
0363 
0364 // This controls the availability of the C++20 time zone database.
0365 // The parser code is built in the library.
0366 #define _LIBCPP_AVAILABILITY_HAS_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19
0367 #define _LIBCPP_AVAILABILITY_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
0368 
0369 // These macros determine whether we assume that std::bad_function_call and
0370 // std::bad_expected_access provide a key function in the dylib. This allows
0371 // centralizing their vtable and typeinfo instead of having all TUs provide
0372 // a weak definition that then gets deduplicated.
0373 #define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
0374 #define _LIBCPP_AVAILABILITY_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
0375 #define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
0376 #define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
0377 
0378 // Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.
0379 // Those are defined in terms of the availability attributes above, and
0380 // should not be vendor-specific.
0381 #if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
0382 #  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
0383 #  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
0384 #  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
0385 #else
0386 #  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
0387 #  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
0388 #  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
0389 #endif
0390 
0391 // Define availability attributes that depend on both
0392 // _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI.
0393 #if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI)
0394 #  undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
0395 #  undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
0396 #  define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0
0397 #  define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
0398 #endif
0399 
0400 #endif // _LIBCPP___CXX03___CONFIGURATION_AVAILABILITY_H