brintos

brintos / llvm-project-archived public Read only

0
0
Text · 44.8 KiB · e758acf Raw
1061 lines · plain
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___CONFIG11#define _LIBCPP___CONFIG12 13#include <__config_site>14#include <__configuration/abi.h>15#include <__configuration/availability.h>16#include <__configuration/compiler.h>17#include <__configuration/experimental.h>18#include <__configuration/hardening.h>19#include <__configuration/language.h>20#include <__configuration/platform.h>21 22#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER23#  pragma GCC system_header24#endif25 26#ifdef __cplusplus27 28// The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html29 30// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.31// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is32// defined to XXYYZZ.33#  define _LIBCPP_VERSION 22000034 35#  define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y36#  define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)37#  define _LIBCPP_CONCAT3(X, Y, Z) _LIBCPP_CONCAT(X, _LIBCPP_CONCAT(Y, Z))38 39#  if __STDC_HOSTED__ == 040#    define _LIBCPP_FREESTANDING41#  endif42 43#  define _LIBCPP_TOSTRING2(x) #x44#  define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)45 46#  ifndef __has_constexpr_builtin47#    define __has_constexpr_builtin(x) 048#  endif49 50// This checks wheter a Clang module is built51#  ifndef __building_module52#    define __building_module(...) 053#  endif54 55// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by56// the compiler and '1' otherwise.57#  ifndef __is_identifier58#    define __is_identifier(__x) 159#  endif60 61#  ifndef __has_declspec_attribute62#    define __has_declspec_attribute(__x) 063#  endif64 65#  define __has_keyword(__x) !(__is_identifier(__x))66 67#  ifndef __has_warning68#    define __has_warning(...) 069#  endif70 71#  if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L72#    error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"73#  endif74 75#  if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)76#    define _LIBCPP_ABI_VCRUNTIME77#  endif78 79#  if defined(__MVS__)80#    include <features.h> // for __NATIVE_ASCII_F81#  endif82 83#  if defined(_WIN32)84#    define _LIBCPP_WIN32API85#    define _LIBCPP_SHORT_WCHAR 186// Both MinGW and native MSVC provide a "MSVC"-like environment87#    define _LIBCPP_MSVCRT_LIKE88// If mingw not explicitly detected, assume using MS C runtime only if89// a MS compatibility version is specified.90#    if defined(_MSC_VER) && !defined(__MINGW32__)91#      define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library92#    endif93#    if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))94#      define _LIBCPP_HAS_BITSCAN64 195#    else96#      define _LIBCPP_HAS_BITSCAN64 097#    endif98#    define _LIBCPP_HAS_OPEN_WITH_WCHAR 199#  else100#    define _LIBCPP_HAS_OPEN_WITH_WCHAR 0101#    define _LIBCPP_HAS_BITSCAN64 0102#  endif // defined(_WIN32)103 104#  if defined(_AIX) && !defined(__64BIT__)105// The size of wchar is 2 byte on 32-bit mode on AIX.106#    define _LIBCPP_SHORT_WCHAR 1107#  endif108 109// Libc++ supports various implementations of std::random_device.110//111// _LIBCPP_USING_DEV_RANDOM112//      Read entropy from the given file, by default `/dev/urandom`.113//      If a token is provided, it is assumed to be the path to a file114//      to read entropy from. This is the default behavior if nothing115//      else is specified. This implementation requires storing state116//      inside `std::random_device`.117//118// _LIBCPP_USING_ARC4_RANDOM119//      Use arc4random(). This allows obtaining random data even when120//      using sandboxing mechanisms. On some platforms like Apple, this121//      is the recommended source of entropy for user-space programs.122//      When this option is used, the token passed to `std::random_device`'s123//      constructor *must* be "/dev/urandom" -- anything else is an error.124//125// _LIBCPP_USING_GETENTROPY126//      Use getentropy().127//      When this option is used, the token passed to `std::random_device`'s128//      constructor *must* be "/dev/urandom" -- anything else is an error.129//130// _LIBCPP_USING_FUCHSIA_CPRNG131//      Use Fuchsia's zx_cprng_draw() system call, which is specified to132//      deliver high-quality entropy and cannot fail.133//      When this option is used, the token passed to `std::random_device`'s134//      constructor *must* be "/dev/urandom" -- anything else is an error.135//136// _LIBCPP_USING_WIN32_RANDOM137//      Use rand_s(), for use on Windows.138//      When this option is used, the token passed to `std::random_device`'s139//      constructor *must* be "/dev/urandom" -- anything else is an error.140#  if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) ||                     \141      defined(__DragonFly__)142#    define _LIBCPP_USING_ARC4_RANDOM143#  elif defined(__wasi__) || defined(__EMSCRIPTEN__)144#    define _LIBCPP_USING_GETENTROPY145#  elif defined(__Fuchsia__)146#    define _LIBCPP_USING_FUCHSIA_CPRNG147#  elif defined(_LIBCPP_WIN32API)148#    define _LIBCPP_USING_WIN32_RANDOM149#  else150#    define _LIBCPP_USING_DEV_RANDOM151#  endif152 153#  ifndef _LIBCPP_CXX03_LANG154 155#    define _LIBCPP_ALIGNOF(...) alignof(__VA_ARGS__)156#    define _ALIGNAS_TYPE(x) alignas(x)157#    define _ALIGNAS(x) alignas(x)158#    define _NOEXCEPT noexcept159#    define _NOEXCEPT_(...) noexcept(__VA_ARGS__)160#    define _LIBCPP_CONSTEXPR constexpr161 162#  else163 164#    define _LIBCPP_ALIGNOF(...) _Alignof(__VA_ARGS__)165#    define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))166#    define _ALIGNAS(x) __attribute__((__aligned__(x)))167#    define nullptr __nullptr168#    define _NOEXCEPT throw()169#    define _NOEXCEPT_(...)170#    define static_assert(...) _Static_assert(__VA_ARGS__)171#    define decltype(...) __decltype(__VA_ARGS__)172#    define _LIBCPP_CONSTEXPR173 174typedef __char16_t char16_t;175typedef __char32_t char32_t;176 177#  endif178 179#  define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)180 181#  if __has_extension(blocks) && defined(__APPLE__)182#    define _LIBCPP_HAS_BLOCKS_RUNTIME 1183#  else184#    define _LIBCPP_HAS_BLOCKS_RUNTIME 0185#  endif186 187#  define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))188 189#  if defined(_LIBCPP_OBJECT_FORMAT_COFF)190 191#    ifdef _DLL192#      define _LIBCPP_CRT_FUNC __declspec(dllimport)193#    else194#      define _LIBCPP_CRT_FUNC195#    endif196 197#    if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY))198#      define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS199#      define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS200#      define _LIBCPP_OVERRIDABLE_FUNC_VIS201#      define _LIBCPP_EXPORTED_FROM_ABI202#    elif defined(_LIBCPP_BUILDING_LIBRARY)203#      if defined(__MINGW32__)204#        define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllexport)205#        define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS206#      else207#        define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS208#        define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __declspec(dllexport)209#      endif210#      define _LIBCPP_OVERRIDABLE_FUNC_VIS __declspec(dllexport)211#      define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)212#    else213#      define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __declspec(dllimport)214#      define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS215#      define _LIBCPP_OVERRIDABLE_FUNC_VIS216#      define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)217#    endif218 219#    define _LIBCPP_HIDDEN220#    define _LIBCPP_TEMPLATE_DATA_VIS221#    define _LIBCPP_NAMESPACE_VISIBILITY222 223#  else224 225#    if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)226#      define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis)))227#    else228#      define _LIBCPP_VISIBILITY(vis)229#    endif230 231#    define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden")232#    define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")233#    define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")234#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")235#    define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS236 237// TODO: Make this a proper customization point or remove the option to override it.238#    ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS239#      define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")240#    endif241 242#    if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)243#      define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__type_visibility__("default")))244#    elif !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)245#      define _LIBCPP_NAMESPACE_VISIBILITY __attribute__((__visibility__("default")))246#    else247#      define _LIBCPP_NAMESPACE_VISIBILITY248#    endif249 250#  endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)251 252#  if __has_attribute(exclude_from_explicit_instantiation)253#    define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__))254#  else255// Try to approximate the effect of exclude_from_explicit_instantiation256// (which is that entities are not assumed to be provided by explicit257// template instantiations in the dylib) by always inlining those entities.258#    define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE259#  endif260 261#  ifdef _LIBCPP_COMPILER_CLANG_BASED262#    define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")263#    define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")264#    define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str))265#    define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)266#  elif defined(_LIBCPP_COMPILER_GCC)267#    define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")268#    define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")269#    define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)270#    define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str))271#  else272#    define _LIBCPP_DIAGNOSTIC_PUSH273#    define _LIBCPP_DIAGNOSTIC_POP274#    define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)275#    define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)276#  endif277 278// Macros to enter and leave a state where deprecation warnings are suppressed.279#  define _LIBCPP_SUPPRESS_DEPRECATED_PUSH                                                                             \280    _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated")                                           \281        _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")282#  define _LIBCPP_SUPPRESS_DEPRECATED_POP _LIBCPP_DIAGNOSTIC_POP283 284#  if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST285#    define _LIBCPP_HARDENING_SIG f286#  elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE287#    define _LIBCPP_HARDENING_SIG s288#  elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG289#    define _LIBCPP_HARDENING_SIG d290#  else291#    define _LIBCPP_HARDENING_SIG n // "none"292#  endif293 294#  if _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_OBSERVE295#    define _LIBCPP_ASSERTION_SEMANTIC_SIG o296#  elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_QUICK_ENFORCE297#    define _LIBCPP_ASSERTION_SEMANTIC_SIG q298#  elif _LIBCPP_ASSERTION_SEMANTIC == _LIBCPP_ASSERTION_SEMANTIC_ENFORCE299#    define _LIBCPP_ASSERTION_SEMANTIC_SIG e300#  else301#    define _LIBCPP_ASSERTION_SEMANTIC_SIG i // `ignore`302#  endif303 304#  if !_LIBCPP_HAS_EXCEPTIONS305#    define _LIBCPP_EXCEPTIONS_SIG n306#  else307#    define _LIBCPP_EXCEPTIONS_SIG e308#  endif309 310#  define _LIBCPP_ODR_SIGNATURE                                                                                        \311    _LIBCPP_CONCAT(                                                                                                    \312        _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG), \313        _LIBCPP_VERSION)314 315// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved316// on two levels:317// 1. The symbol is given hidden visibility, which ensures that users won't start exporting318//    symbols from their dynamic library by means of using the libc++ headers. This ensures319//    that those symbols stay private to the dynamic library in which it is defined.320//321// 2. The symbol is given an ABI tag that encodes the ODR-relevant properties of the library.322//    This ensures that no ODR violation can arise from mixing two TUs compiled with different323//    versions or configurations of libc++ (such as exceptions vs no-exceptions). Indeed, if the324//    program contains two definitions of a function, the ODR requires them to be token-by-token325//    equivalent, and the linker is allowed to pick either definition and discard the other one.326//327//    For example, if a program contains a copy of `vector::at()` compiled with exceptions enabled328//    *and* a copy of `vector::at()` compiled with exceptions disabled (by means of having two TUs329//    compiled with different settings), the two definitions are both visible by the linker and they330//    have the same name, but they have a meaningfully different implementation (one throws an exception331//    and the other aborts the program). This violates the ODR and makes the program ill-formed, and in332//    practice what will happen is that the linker will pick one of the definitions at random and will333//    discard the other one. This can quite clearly lead to incorrect program behavior.334//335//    A similar reasoning holds for many other properties that are ODR-affecting. Essentially any336//    property that causes the code of a function to differ from the code in another configuration337//    can be considered ODR-affecting. In practice, we don't encode all such properties in the ABI338//    tag, but we encode the ones that we think are most important: library version, exceptions, and339//    hardening mode.340//341//    Note that historically, solving this problem has been achieved in various ways, including342//    force-inlining all functions or giving internal linkage to all functions. Both these previous343//    solutions suffer from drawbacks that lead notably to code bloat.344//345// Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend346// on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library.347//348// Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions349// instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled350// name of a virtual function is part of its ABI, since some architectures like arm64e can sign351// the virtual function pointer in the vtable based on the mangled name of the function. Since352// we use an ABI tag that changes with each released version, the mangled name of the virtual353// function would change, which is incorrect. Note that it doesn't make much sense to change354// the implementation of a virtual function in an ABI-incompatible way in the first place,355// since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable.356//357// The macro can be applied to record and enum types. When the tagged type is nested in358// a record this "parent" record needs to have the macro too. Another use case for applying359// this macro to records and unions is to apply an ABI tag to inline constexpr variables.360// This can be useful for inline variables that are implementation details which are expected361// to change in the future.362//363// TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing364//       the length of symbols with an ABI tag. In practice, we should remove the escape hatch and365//       use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.366#  ifndef _LIBCPP_NO_ABI_TAG367#    define _LIBCPP_HIDE_FROM_ABI                                                                                      \368      _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION                                                       \369      __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))370#  else371#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION372#  endif373#  define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION374 375#  ifdef _LIBCPP_BUILDING_LIBRARY376#    if _LIBCPP_ABI_VERSION > 1377#      define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI378#    else379#      define _LIBCPP_HIDE_FROM_ABI_AFTER_V1380#    endif381#  else382#    define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI383#  endif384 385// Clang modules take a significant compile time hit when pushing and popping diagnostics.386// Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can387// simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined.388#  ifdef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER389#    define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS                                                                         \390      _LIBCPP_DIAGNOSTIC_PUSH                                                                                          \391      _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions")                                                           \392      _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++14-extensions")                                                           \393      _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions")                                                           \394      _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions")                                                           \395      _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions")                                                           \396      _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions")                                                             \397      _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions")                                                             \398      _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions")                                                             \399      _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions")400#    define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP401#  else402#    define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS403#    define _LIBCPP_POP_EXTENSION_DIAGNOSTICS404#  endif405 406// clang-format off407 408// The unversioned namespace is used when we want to be ABI compatible with other standard libraries in some way. There409// are two main categories where that's the case:410// - Historically, we have made exception types ABI compatible with libstdc++ to allow throwing them between libstdc++411//   and libc++. This is not used anymore for new exception types, since there is no use-case for it anymore.412// - Types and functions which are used by the compiler are in the unversioned namespace, since the compiler has to know413//   their mangling without the appropriate declaration in some cases.414// If it's not clear whether using the unversioned namespace is the correct thing to do, it's not. The versioned415// namespace (_LIBCPP_BEGIN_NAMESPACE_STD) should almost always be used.416#  define _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD                                                                      \417    _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS namespace _LIBCPP_NAMESPACE_VISIBILITY std {418 419#  define _LIBCPP_END_UNVERSIONED_NAMESPACE_STD } _LIBCPP_POP_EXTENSION_DIAGNOSTICS420 421#  define _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD inline namespace _LIBCPP_ABI_NAMESPACE {422#  define _LIBCPP_END_NAMESPACE_STD } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD423 424// TODO: This should really be in the versioned namespace425#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL _LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD namespace experimental {426#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } _LIBCPP_END_UNVERSIONED_NAMESPACE_STD427 428#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {429#define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL430 431#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {432#define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL433 434#ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE435#  define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem {436#  define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD437#else438#  define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD                                               \439                                             inline namespace __fs { namespace filesystem {440 441#  define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD442#endif443 444// clang-format on445 446#  if __has_attribute(__enable_if__)447#    define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, "")))448#  endif449 450#  if !defined(__SIZEOF_INT128__) || defined(_MSC_VER)451#    define _LIBCPP_HAS_INT128 0452#  else453#    define _LIBCPP_HAS_INT128 1454#  endif455 456#  ifdef _LIBCPP_CXX03_LANG457#    define _LIBCPP_DECLARE_STRONG_ENUM(x)                                                                             \458      struct _LIBCPP_EXPORTED_FROM_ABI x {                                                                             \459        enum __lx460// clang-format off461#    define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)                                                                      \462      __lx __v_;                                                                                                       \463      _LIBCPP_HIDE_FROM_ABI x(__lx __v) : __v_(__v) {}                                                                 \464      _LIBCPP_HIDE_FROM_ABI explicit x(int __v) : __v_(static_cast<__lx>(__v)) {}                                      \465      _LIBCPP_HIDE_FROM_ABI operator int() const { return __v_; }                                                      \466      };467// clang-format on468 469#  else // _LIBCPP_CXX03_LANG470#    define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class x471#    define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)472#  endif // _LIBCPP_CXX03_LANG473 474#  ifdef __FreeBSD__475#    define _DECLARE_C99_LDBL_MATH 1476#  endif477 478// If we are getting operator new from the MSVC CRT, then allocation overloads479// for align_val_t were added in 19.12, aka VS 2017 version 15.3.480#  if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912481#    define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0482#  elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)483// We're deferring to Microsoft's STL to provide aligned new et al. We don't484// have it unless the language feature test macro is defined.485#    define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0486#  elif defined(__MVS__)487#    define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0488#  else489#    define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1490#  endif491 492#  if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)493#    define _LIBCPP_HAS_ALIGNED_ALLOCATION 0494#  else495#    define _LIBCPP_HAS_ALIGNED_ALLOCATION 1496#  endif497 498#  if defined(__APPLE__) || defined(__FreeBSD__)499#    define _LIBCPP_WCTYPE_IS_MASK500#  endif501 502#  if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)503#    define _LIBCPP_HAS_CHAR8_T 0504#  else505#    define _LIBCPP_HAS_CHAR8_T 1506#  endif507 508// Deprecation macros.509//510// Deprecations warnings are always enabled, except when users explicitly opt-out511// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.512#  if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)513#    if __has_attribute(__deprecated__)514#      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))515#      define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m)))516#    elif _LIBCPP_STD_VER >= 14517#      define _LIBCPP_DEPRECATED [[deprecated]]518#      define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]]519#    else520#      define _LIBCPP_DEPRECATED521#      define _LIBCPP_DEPRECATED_(m)522#    endif523#  else524#    define _LIBCPP_DEPRECATED525#    define _LIBCPP_DEPRECATED_(m)526#  endif527 528// FIXME: using `#warning` causes diagnostics from system headers which include deprecated headers. This can only be529// enabled again once https://github.com/llvm/llvm-project/pull/168041 (or a similar feature) has landed, since that530// allows suppression in system headers.531#  if defined(__DEPRECATED) && __DEPRECATED && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) && 0532#    define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 1533#  else534#    define _LIBCPP_DIAGNOSE_DEPRECATED_HEADERS 0535#  endif536 537#  if !defined(_LIBCPP_CXX03_LANG)538#    define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED539#  else540#    define _LIBCPP_DEPRECATED_IN_CXX11541#  endif542 543#  if _LIBCPP_STD_VER >= 14544#    define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED545#  else546#    define _LIBCPP_DEPRECATED_IN_CXX14547#  endif548 549#  if _LIBCPP_STD_VER >= 17550#    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED551#  else552#    define _LIBCPP_DEPRECATED_IN_CXX17553#  endif554 555#  if _LIBCPP_STD_VER >= 20556#    define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED557#  else558#    define _LIBCPP_DEPRECATED_IN_CXX20559#  endif560 561#  if _LIBCPP_STD_VER >= 23562#    define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED563#  else564#    define _LIBCPP_DEPRECATED_IN_CXX23565#  endif566 567#  if _LIBCPP_STD_VER >= 26568#    define _LIBCPP_DEPRECATED_IN_CXX26 _LIBCPP_DEPRECATED569#    define _LIBCPP_DEPRECATED_IN_CXX26_(m) _LIBCPP_DEPRECATED_(m)570#  else571#    define _LIBCPP_DEPRECATED_IN_CXX26572#    define _LIBCPP_DEPRECATED_IN_CXX26_(m)573#  endif574 575#  if _LIBCPP_HAS_CHAR8_T576#    define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED577#  else578#    define _LIBCPP_DEPRECATED_WITH_CHAR8_T579#  endif580 581#  if _LIBCPP_STD_VER <= 11582#    define _LIBCPP_EXPLICIT_SINCE_CXX14583#  else584#    define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit585#  endif586 587#  if _LIBCPP_STD_VER >= 23588#    define _LIBCPP_EXPLICIT_SINCE_CXX23 explicit589#  else590#    define _LIBCPP_EXPLICIT_SINCE_CXX23591#  endif592 593#  if _LIBCPP_STD_VER >= 14594#    define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr595#  else596#    define _LIBCPP_CONSTEXPR_SINCE_CXX14597#  endif598 599#  if _LIBCPP_STD_VER >= 17600#    define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr601#  else602#    define _LIBCPP_CONSTEXPR_SINCE_CXX17603#  endif604 605#  if _LIBCPP_STD_VER >= 20606#    define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr607#  else608#    define _LIBCPP_CONSTEXPR_SINCE_CXX20609#  endif610 611#  if _LIBCPP_STD_VER >= 23612#    define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr613#  else614#    define _LIBCPP_CONSTEXPR_SINCE_CXX23615#  endif616 617#  if _LIBCPP_STD_VER >= 26618#    define _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr619#  else620#    define _LIBCPP_CONSTEXPR_SINCE_CXX26621#  endif622 623#  ifndef _LIBCPP_WEAK624#    define _LIBCPP_WEAK __attribute__((__weak__))625#  endif626 627// Thread API628// clang-format off629#  if _LIBCPP_HAS_THREADS &&                                                                                           \630      !_LIBCPP_HAS_THREAD_API_PTHREAD &&                                                                               \631      !_LIBCPP_HAS_THREAD_API_WIN32 &&                                                                                 \632      !_LIBCPP_HAS_THREAD_API_EXTERNAL633 634#    if defined(__FreeBSD__) ||                                                                                        \635        defined(__wasi__) ||                                                                                           \636        defined(__NetBSD__) ||                                                                                         \637        defined(__OpenBSD__) ||                                                                                        \638        defined(__NuttX__) ||                                                                                          \639        defined(__linux__) ||                                                                                          \640        defined(__GNU__) ||                                                                                            \641        defined(__APPLE__) ||                                                                                          \642        defined(__MVS__) ||                                                                                            \643        defined(_AIX) ||                                                                                               \644        defined(__EMSCRIPTEN__)645// clang-format on646#      undef _LIBCPP_HAS_THREAD_API_PTHREAD647#      define _LIBCPP_HAS_THREAD_API_PTHREAD 1648#    elif defined(__Fuchsia__)649// TODO(44575): Switch to C11 thread API when possible.650#      undef _LIBCPP_HAS_THREAD_API_PTHREAD651#      define _LIBCPP_HAS_THREAD_API_PTHREAD 1652#    elif defined(_LIBCPP_WIN32API)653#      undef _LIBCPP_HAS_THREAD_API_WIN32654#      define _LIBCPP_HAS_THREAD_API_WIN32 1655#    else656#      error "No thread API"657#    endif // _LIBCPP_HAS_THREAD_API658#  endif   // _LIBCPP_HAS_THREADS659 660#  if !_LIBCPP_HAS_THREAD_API_PTHREAD661#    define _LIBCPP_HAS_COND_CLOCKWAIT 0662#  elif (defined(__ANDROID__) && __ANDROID_API__ >= 30) || _LIBCPP_GLIBC_PREREQ(2, 30)663#    define _LIBCPP_HAS_COND_CLOCKWAIT 1664#  else665#    define _LIBCPP_HAS_COND_CLOCKWAIT 0666#  endif667 668#  if !_LIBCPP_HAS_THREADS && _LIBCPP_HAS_THREAD_API_PTHREAD669#    error _LIBCPP_HAS_THREAD_API_PTHREAD may only be true when _LIBCPP_HAS_THREADS is true.670#  endif671 672#  if !_LIBCPP_HAS_THREADS && _LIBCPP_HAS_THREAD_API_EXTERNAL673#    error _LIBCPP_HAS_THREAD_API_EXTERNAL may only be true when _LIBCPP_HAS_THREADS is true.674#  endif675 676#  if !_LIBCPP_HAS_MONOTONIC_CLOCK && _LIBCPP_HAS_THREADS677#    error _LIBCPP_HAS_MONOTONIC_CLOCK may only be false when _LIBCPP_HAS_THREADS is false.678#  endif679 680#  if _LIBCPP_HAS_THREADS && !defined(__STDCPP_THREADS__)681#    define __STDCPP_THREADS__ 1682#  endif683 684// The glibc and Bionic implementation of pthreads implements685// pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32686// mutexes have no destroy mechanism.687//688// This optimization can't be performed on Apple platforms, where689// pthread_mutex_destroy can allow the kernel to release resources.690// See https://llvm.org/D64298 for details.691//692// TODO(EricWF): Enable this optimization on Bionic after speaking to their693//               respective stakeholders.694// clang-format off695#  if (_LIBCPP_HAS_THREAD_API_PTHREAD && defined(__GLIBC__)) ||                                                        \696      (_LIBCPP_HAS_THREAD_API_C11 && defined(__Fuchsia__)) ||                                                          \697       _LIBCPP_HAS_THREAD_API_WIN32698// clang-format on699#    define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION 1700#  else701#    define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION 0702#  endif703 704// Destroying a condvar is a nop on Windows.705//706// This optimization can't be performed on Apple platforms, where707// pthread_cond_destroy can allow the kernel to release resources.708// See https://llvm.org/D64298 for details.709//710// TODO(EricWF): This is potentially true for some pthread implementations711// as well.712#  if (_LIBCPP_HAS_THREAD_API_C11 && defined(__Fuchsia__)) || _LIBCPP_HAS_THREAD_API_WIN32713#    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 1714#  else715#    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 0716#  endif717 718#  if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) ||                        \719      _LIBCPP_HAS_MUSL_LIBC || defined(__OpenBSD__) || defined(__LLVM_LIBC__)720#    define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE721#  endif722 723#  if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)724#    define _LIBCPP_HAS_C_ATOMIC_IMP 1725#    define _LIBCPP_HAS_GCC_ATOMIC_IMP 0726#    define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0727#  elif defined(_LIBCPP_COMPILER_GCC)728#    define _LIBCPP_HAS_C_ATOMIC_IMP 0729#    define _LIBCPP_HAS_GCC_ATOMIC_IMP 1730#    define _LIBCPP_HAS_EXTERNAL_ATOMIC_IMP 0731#  endif732 733#  if !_LIBCPP_HAS_C_ATOMIC_IMP && !_LIBCPP_HAS_GCC_ATOMIC_IMP && !_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP734#    define _LIBCPP_HAS_ATOMIC_HEADER 0735#  else736#    define _LIBCPP_HAS_ATOMIC_HEADER 1737#    ifndef _LIBCPP_ATOMIC_FLAG_TYPE738#      define _LIBCPP_ATOMIC_FLAG_TYPE bool739#    endif740#  endif741 742#  if __has_attribute(__no_thread_safety_analysis__)743#    define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS __attribute__((__no_thread_safety_analysis__))744#  else745#    define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS746#  endif747 748#  if _LIBCPP_STD_VER >= 20749#    define _LIBCPP_CONSTINIT constinit750#  elif __has_attribute(__require_constant_initialization__)751#    define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__))752#  else753#    define _LIBCPP_CONSTINIT754#  endif755 756#  if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)757// The CUDA SDK contains an unfortunate definition for the __noinline__ macro,758// which breaks the regular __attribute__((__noinline__)) syntax. Therefore,759// when compiling for CUDA we use the non-underscored version of the noinline760// attribute.761//762// This is a temporary workaround and we still expect the CUDA SDK team to solve763// this issue properly in the SDK headers.764//765// See https://github.com/llvm/llvm-project/pull/73838 for more details.766#    define _LIBCPP_NOINLINE __attribute__((noinline))767#  elif __has_attribute(__noinline__)768#    define _LIBCPP_NOINLINE __attribute__((__noinline__))769#  else770#    define _LIBCPP_NOINLINE771#  endif772 773// We often repeat things just for handling wide characters in the library.774// When wide characters are disabled, it can be useful to have a quick way of775// disabling it without having to resort to #if-#endif, which has a larger776// impact on readability.777#  if !_LIBCPP_HAS_WIDE_CHARACTERS778#    define _LIBCPP_IF_WIDE_CHARACTERS(...)779#  else780#    define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__781#  endif782 783// clang-format off784#  define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") _Pragma("push_macro(\"refresh\")") _Pragma("push_macro(\"move\")") _Pragma("push_macro(\"erase\")")785#  define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") _Pragma("pop_macro(\"refresh\")") _Pragma("pop_macro(\"move\")") _Pragma("pop_macro(\"erase\")")786// clang-format on787 788#  ifndef _LIBCPP_NO_AUTO_LINK789#    if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)790#      if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)791#        pragma comment(lib, "c++.lib")792#      else793#        pragma comment(lib, "libc++.lib")794#      endif795#    endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)796#  endif   // _LIBCPP_NO_AUTO_LINK797 798// Configures the fopen close-on-exec mode character, if any. This string will799// be appended to any mode string used by fstream for fopen/fdopen.800//801// Not all platforms support this, but it helps avoid fd-leaks on platforms that802// do.803#  if defined(__BIONIC__)804#    define _LIBCPP_FOPEN_CLOEXEC_MODE "e"805#  else806#    define _LIBCPP_FOPEN_CLOEXEC_MODE807#  endif808 809#  if __has_cpp_attribute(msvc::no_unique_address)810// MSVC implements [[no_unique_address]] as a silent no-op currently.811// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.)812// However, MSVC implements [[msvc::no_unique_address]] which does what813// [[no_unique_address]] is supposed to do, in general.814#    define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]815#  else816#    define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]]817#  endif818 819// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these820// functions is gradually being added to existing C libraries. The conditions821// below check for known C library versions and conditions under which these822// functions are declared by the C library.823//824// GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if825// __cpp_char8_t is defined or if C2X extensions are enabled. Determining826// the latter depends on internal GNU libc details that are not appropriate827// to depend on here, so any declarations present when __cpp_char8_t is not828// defined are ignored.829#  if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)830#    define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1831#  else832#    define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0833#  endif834 835// There are a handful of public standard library types that are intended to836// support CTAD but don't need any explicit deduction guides to do so. This837// macro is used to mark them as such, which suppresses the838// '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code839// with these classes.840#  if _LIBCPP_STD_VER >= 17841#    ifdef _LIBCPP_COMPILER_CLANG_BASED842#      define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName)                                                              \843        template <class... _Tag>                                                                                       \844        [[maybe_unused]] _ClassName(typename _Tag::__allow_ctad...)->_ClassName<_Tag...>845#    else846#      define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(ClassName)                                                               \847        template <class... _Tag>                                                                                       \848        ClassName(typename _Tag::__allow_ctad...)->ClassName<_Tag...>849#    endif850#  else851#    define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")852#  endif853 854#  if defined(__OBJC__) && defined(_LIBCPP_APPLE_CLANG_VER)855#    define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS856#  endif857 858#  define _PSTL_PRAGMA(x) _Pragma(#x)859 860// Enable SIMD for compilers that support OpenMP 4.0861#  if (defined(_OPENMP) && _OPENMP >= 201307)862 863#    define _PSTL_UDR_PRESENT864#    define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd)865#    define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd)866#    define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM))867#    define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM))868#    define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM))869#    define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM))870 871// Declaration of reduction functor, where872// NAME - the name of the functor873// OP - type of the callable object with the reduction operation874// omp_in - refers to the local partial result875// omp_out - refers to the final value of the combiner operator876// omp_priv - refers to the private copy of the initial value877// omp_orig - refers to the original variable to be reduced878#    define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)                                                                   \879      _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig))880 881#  elif defined(_LIBCPP_COMPILER_CLANG_BASED)882 883#    define _PSTL_PRAGMA_SIMD _Pragma("clang loop vectorize(enable) interleave(enable)")884#    define _PSTL_PRAGMA_DECLARE_SIMD885#    define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)")886#    define _PSTL_PRAGMA_SIMD_SCAN(PRM) _Pragma("clang loop vectorize(enable) interleave(enable)")887#    define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)888#    define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)889#    define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)890 891#  else // (defined(_OPENMP) && _OPENMP >= 201307)892 893#    define _PSTL_PRAGMA_SIMD894#    define _PSTL_PRAGMA_DECLARE_SIMD895#    define _PSTL_PRAGMA_SIMD_REDUCTION(PRM)896#    define _PSTL_PRAGMA_SIMD_SCAN(PRM)897#    define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM)898#    define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM)899#    define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP)900 901#  endif // (defined(_OPENMP) && _OPENMP >= 201307)902 903#  define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED904 905// Optional attributes - these are useful for a better QoI, but not required to be available906 907#  define _LIBCPP_NOALIAS __attribute__((__malloc__))908#  define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]]909#  define _LIBCPP_NO_SANITIZE(...) __attribute__((__no_sanitize__(__VA_ARGS__)))910#  define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100)))911#  define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index)                             \912    __attribute__((__format__(archetype, format_string_index, first_format_arg_index)))913#  define _LIBCPP_PACKED __attribute__((__packed__))914 915#  if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)916#    define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))917#  else918#    define _LIBCPP_NO_CFI919#  endif920 921#  if __has_attribute(__using_if_exists__)922#    define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__))923#  else924#    define _LIBCPP_USING_IF_EXISTS925#  endif926 927#  if __has_cpp_attribute(_Clang::__no_destroy__)928#    define _LIBCPP_NO_DESTROY [[_Clang::__no_destroy__]]929#  else930#    define _LIBCPP_NO_DESTROY931#  endif932 933#  if __has_attribute(__diagnose_if__)934#    define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning")))935#  else936#    define _LIBCPP_DIAGNOSE_WARNING(...)937#  endif938 939#  if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_APPLE_CLANG_VER) &&                                         \940      (!defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 2001)941#    define _LIBCPP_DIAGNOSE_IF(...) __attribute__((__diagnose_if__(__VA_ARGS__)))942#  else943#    define _LIBCPP_DIAGNOSE_IF(...)944#  endif945 946#  define _LIBCPP_DIAGNOSE_NULLPTR_IF(condition, condition_description)                                                \947    _LIBCPP_DIAGNOSE_IF(                                                                                               \948        condition,                                                                                                     \949        "null passed to callee that requires a non-null argument" condition_description,                               \950        "warning",                                                                                                     \951        "nonnull")952 953#  if __has_cpp_attribute(_Clang::__lifetimebound__)954#    define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]955#  else956#    define _LIBCPP_LIFETIMEBOUND957#  endif958 959// This is to work around https://llvm.org/PR156809960#  ifndef _LIBCPP_CXX03_LANG961#    define _LIBCPP_CTOR_LIFETIMEBOUND _LIBCPP_LIFETIMEBOUND962#  else963#    define _LIBCPP_CTOR_LIFETIMEBOUND964#  endif965 966#  if __has_cpp_attribute(_Clang::__noescape__)967#    define _LIBCPP_NOESCAPE [[_Clang::__noescape__]]968#  else969#    define _LIBCPP_NOESCAPE970#  endif971 972#  if __has_cpp_attribute(_Clang::__no_specializations__)973#    define _LIBCPP_NO_SPECIALIZATIONS                                                                                 \974      [[_Clang::__no_specializations__("Users are not allowed to specialize this standard library entity")]]975#  else976#    define _LIBCPP_NO_SPECIALIZATIONS977#  endif978 979#  if __has_cpp_attribute(_Clang::__preferred_name__)980#    define _LIBCPP_PREFERRED_NAME(x) [[_Clang::__preferred_name__(x)]]981#  else982#    define _LIBCPP_PREFERRED_NAME(x)983#  endif984 985#  if __has_cpp_attribute(_Clang::__scoped_lockable__)986#    define _LIBCPP_SCOPED_LOCKABLE [[_Clang::__scoped_lockable__]]987#  else988#    define _LIBCPP_SCOPED_LOCKABLE989#  endif990 991#  if __has_cpp_attribute(_Clang::__capability__)992#    define _LIBCPP_CAPABILITY(...) [[_Clang::__capability__(__VA_ARGS__)]]993#  else994#    define _LIBCPP_CAPABILITY(...)995#  endif996 997#  if __has_attribute(__acquire_capability__)998#    define _LIBCPP_ACQUIRE_CAPABILITY(...) __attribute__((__acquire_capability__(__VA_ARGS__)))999#  else1000#    define _LIBCPP_ACQUIRE_CAPABILITY(...)1001#  endif1002 1003#  if __has_cpp_attribute(_Clang::__try_acquire_capability__)1004#    define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...) [[_Clang::__try_acquire_capability__(__VA_ARGS__)]]1005#  else1006#    define _LIBCPP_TRY_ACQUIRE_CAPABILITY(...)1007#  endif1008 1009#  if __has_cpp_attribute(_Clang::__acquire_shared_capability__)1010#    define _LIBCPP_ACQUIRE_SHARED_CAPABILITY [[_Clang::__acquire_shared_capability__]]1011#  else1012#    define _LIBCPP_ACQUIRE_SHARED_CAPABILITY1013#  endif1014 1015#  if __has_cpp_attribute(_Clang::__try_acquire_shared_capability__)1016#    define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...) [[_Clang::__try_acquire_shared_capability__(__VA_ARGS__)]]1017#  else1018#    define _LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY(...)1019#  endif1020 1021#  if __has_cpp_attribute(_Clang::__release_capability__)1022#    define _LIBCPP_RELEASE_CAPABILITY [[_Clang::__release_capability__]]1023#  else1024#    define _LIBCPP_RELEASE_CAPABILITY1025#  endif1026 1027#  if __has_cpp_attribute(_Clang::__release_shared_capability__)1028#    define _LIBCPP_RELEASE_SHARED_CAPABILITY [[_Clang::__release_shared_capability__]]1029#  else1030#    define _LIBCPP_RELEASE_SHARED_CAPABILITY1031#  endif1032 1033#  if __has_attribute(__requires_capability__)1034#    define _LIBCPP_REQUIRES_CAPABILITY(...) __attribute__((__requires_capability__(__VA_ARGS__)))1035#  else1036#    define _LIBCPP_REQUIRES_CAPABILITY(...)1037#  endif1038 1039#  if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases)1040#    define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)1041#  else1042#    define _LIBCPP_DECLSPEC_EMPTY_BASES1043#  endif1044 1045// Allow for build-time disabling of unsigned integer sanitization1046#  if __has_attribute(no_sanitize) && !defined(_LIBCPP_COMPILER_GCC)1047#    define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))1048#  else1049#    define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK1050#  endif1051 1052#  if __has_feature(nullability)1053#    define _LIBCPP_DIAGNOSE_NULLPTR _Nonnull1054#  else1055#    define _LIBCPP_DIAGNOSE_NULLPTR1056#  endif1057 1058#endif // __cplusplus1059 1060#endif // _LIBCPP___CONFIG1061