Home | History | Annotate | Download | only in v1
      1 // -*- C++ -*-
      2 //===--------------------------- __config ---------------------------------===//
      3 //
      4 //                     The LLVM Compiler Infrastructure
      5 //
      6 // This file is dual licensed under the MIT and the University of Illinois Open
      7 // Source Licenses. See LICENSE.TXT for details.
      8 //
      9 //===----------------------------------------------------------------------===//
     10 
     11 #ifndef _LIBCPP_CONFIG
     12 #define _LIBCPP_CONFIG
     13 
     14 #if defined(_MSC_VER) && !defined(__clang__)
     15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
     16 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
     17 #endif
     18 #endif
     19 
     20 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
     21 #pragma GCC system_header
     22 #endif
     23 
     24 #ifdef __cplusplus
     25 
     26 #ifdef __GNUC__
     27 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
     28 #else
     29 #define _GNUC_VER 0
     30 #endif
     31 
     32 #define _LIBCPP_VERSION 5000
     33 
     34 #ifndef _LIBCPP_ABI_VERSION
     35 #define _LIBCPP_ABI_VERSION 1
     36 #endif
     37 
     38 #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
     39 // Change short string representation so that string data starts at offset 0,
     40 // improving its alignment in some cases.
     41 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
     42 // Fix deque iterator type in order to support incomplete types.
     43 #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
     44 // Fix undefined behavior in how std::list stores it's linked nodes.
     45 #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
     46 // Fix undefined behavior in  how __tree stores its end and parent nodes.
     47 #define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
     48 // Fix undefined behavior in how __hash_table stores it's pointer types
     49 #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
     50 #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
     51 #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
     52 #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
     53 // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
     54 // provided under the alternate keyword __nullptr, which changes the mangling
     55 // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
     56 #define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
     57 // Define the `pointer_safety` enum as a C++11 strongly typed enumeration
     58 // instead of as a class simulating an enum. If this option is enabled
     59 // `pointer_safety` and `get_pointer_safety()` will no longer be available
     60 // in C++03.
     61 #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
     62 #elif _LIBCPP_ABI_VERSION == 1
     63 #if !defined(_WIN32)
     64 // Enable compiling copies of now inline methods into the dylib to support
     65 // applications compiled against older libraries.
     66 #define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
     67 #endif
     68 // Feature macros for disabling pre ABI v1 features. All of these options
     69 // are deprecated.
     70 #if defined(__FreeBSD__)
     71 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
     72 #endif
     73 #endif
     74 
     75 #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
     76 #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
     77        use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
     78 #endif
     79 
     80 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
     81 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
     82 
     83 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
     84 
     85 #if __cplusplus < 201103L
     86 #define _LIBCPP_CXX03_LANG
     87 #endif
     88 
     89 #ifndef __has_attribute
     90 #define __has_attribute(__x) 0
     91 #endif
     92 #ifndef __has_builtin
     93 #define __has_builtin(__x) 0
     94 #endif
     95 #ifndef __has_extension
     96 #define __has_extension(__x) 0
     97 #endif
     98 #ifndef __has_feature
     99 #define __has_feature(__x) 0
    100 #endif
    101 // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
    102 // the compiler and '1' otherwise.
    103 #ifndef __is_identifier
    104 #define __is_identifier(__x) 1
    105 #endif
    106 #ifndef __has_declspec_attribute
    107 #define __has_declspec_attribute(__x) 0
    108 #endif
    109 
    110 #define __has_keyword(__x) !(__is_identifier(__x))
    111 
    112 #if defined(__clang__)
    113 #define _LIBCPP_COMPILER_CLANG
    114 # ifndef __apple_build_version__
    115 #   define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
    116 # endif
    117 #elif defined(__GNUC__)
    118 #define _LIBCPP_COMPILER_GCC
    119 #elif defined(_MSC_VER)
    120 #define _LIBCPP_COMPILER_MSVC
    121 #elif defined(__IBMCPP__)
    122 #define _LIBCPP_COMPILER_IBM
    123 #endif
    124 
    125 #ifndef _LIBCPP_CLANG_VER
    126 #define _LIBCPP_CLANG_VER 0
    127 #endif
    128 
    129 // FIXME: ABI detection should be done via compiler builtin macros. This
    130 // is just a placeholder until Clang implements such macros. For now assume
    131 // that Windows compilers pretending to be MSVC++ target the microsoft ABI.
    132 #if defined(_WIN32) && defined(_MSC_VER)
    133 # define _LIBCPP_ABI_MICROSOFT
    134 #else
    135 # define _LIBCPP_ABI_ITANIUM
    136 #endif
    137 
    138 // Need to detect which libc we're using if we're on Linux.
    139 #if defined(__linux__)
    140 #include <features.h>
    141 #if !defined(__GLIBC_PREREQ)
    142 #define __GLIBC_PREREQ(a, b) 0
    143 #endif // !defined(__GLIBC_PREREQ)
    144 #endif // defined(__linux__)
    145 
    146 #ifdef __LITTLE_ENDIAN__
    147 #if __LITTLE_ENDIAN__
    148 #define _LIBCPP_LITTLE_ENDIAN 1
    149 #define _LIBCPP_BIG_ENDIAN    0
    150 #endif  // __LITTLE_ENDIAN__
    151 #endif  // __LITTLE_ENDIAN__
    152 
    153 #ifdef __BIG_ENDIAN__
    154 #if __BIG_ENDIAN__
    155 #define _LIBCPP_LITTLE_ENDIAN 0
    156 #define _LIBCPP_BIG_ENDIAN    1
    157 #endif  // __BIG_ENDIAN__
    158 #endif  // __BIG_ENDIAN__
    159 
    160 #ifdef __BYTE_ORDER__
    161 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
    162 #define _LIBCPP_LITTLE_ENDIAN 1
    163 #define _LIBCPP_BIG_ENDIAN 0
    164 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
    165 #define _LIBCPP_LITTLE_ENDIAN 0
    166 #define _LIBCPP_BIG_ENDIAN 1
    167 #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
    168 #endif // __BYTE_ORDER__
    169 
    170 #ifdef __FreeBSD__
    171 # include <sys/endian.h>
    172 #  if _BYTE_ORDER == _LITTLE_ENDIAN
    173 #   define _LIBCPP_LITTLE_ENDIAN 1
    174 #   define _LIBCPP_BIG_ENDIAN    0
    175 # else  // _BYTE_ORDER == _LITTLE_ENDIAN
    176 #   define _LIBCPP_LITTLE_ENDIAN 0
    177 #   define _LIBCPP_BIG_ENDIAN    1
    178 # endif  // _BYTE_ORDER == _LITTLE_ENDIAN
    179 # ifndef __LONG_LONG_SUPPORTED
    180 #  define _LIBCPP_HAS_NO_LONG_LONG
    181 # endif  // __LONG_LONG_SUPPORTED
    182 #endif  // __FreeBSD__
    183 
    184 #ifdef __NetBSD__
    185 # include <sys/endian.h>
    186 #  if _BYTE_ORDER == _LITTLE_ENDIAN
    187 #   define _LIBCPP_LITTLE_ENDIAN 1
    188 #   define _LIBCPP_BIG_ENDIAN    0
    189 # else  // _BYTE_ORDER == _LITTLE_ENDIAN
    190 #   define _LIBCPP_LITTLE_ENDIAN 0
    191 #   define _LIBCPP_BIG_ENDIAN    1
    192 # endif  // _BYTE_ORDER == _LITTLE_ENDIAN
    193 # define _LIBCPP_HAS_QUICK_EXIT
    194 #endif  // __NetBSD__
    195 
    196 #if defined(_WIN32)
    197 #  define _LIBCPP_WIN32API      1
    198 #  define _LIBCPP_LITTLE_ENDIAN 1
    199 #  define _LIBCPP_BIG_ENDIAN    0
    200 #  define _LIBCPP_SHORT_WCHAR   1
    201 // If mingw not explicitly detected, assume using MS C runtime only.
    202 #  ifndef __MINGW32__
    203 #    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
    204 #  endif
    205 #  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
    206 #    define _LIBCPP_HAS_BITSCAN64
    207 #  endif
    208 # if defined(_LIBCPP_MSVCRT)
    209 #   define _LIBCPP_HAS_QUICK_EXIT
    210 # endif
    211 #endif // defined(_WIN32)
    212 
    213 #ifdef __sun__
    214 # include <sys/isa_defs.h>
    215 # ifdef _LITTLE_ENDIAN
    216 #   define _LIBCPP_LITTLE_ENDIAN 1
    217 #   define _LIBCPP_BIG_ENDIAN    0
    218 # else
    219 #   define _LIBCPP_LITTLE_ENDIAN 0
    220 #   define _LIBCPP_BIG_ENDIAN    1
    221 # endif
    222 #endif // __sun__
    223 
    224 #if defined(__CloudABI__)
    225   // Certain architectures provide arc4random(). Prefer using
    226   // arc4random() over /dev/{u,}random to make it possible to obtain
    227   // random data even when using sandboxing mechanisms such as chroots,
    228   // Capsicum, etc.
    229 # define _LIBCPP_USING_ARC4_RANDOM
    230 #elif defined(__native_client__)
    231   // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
    232   // including accesses to the special files under /dev. C++11's
    233   // std::random_device is instead exposed through a NaCl syscall.
    234 # define _LIBCPP_USING_NACL_RANDOM
    235 #elif defined(_LIBCPP_WIN32API)
    236 # define _LIBCPP_USING_WIN32_RANDOM
    237 #else
    238 # define _LIBCPP_USING_DEV_RANDOM
    239 #endif
    240 
    241 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
    242 # include <endian.h>
    243 # if __BYTE_ORDER == __LITTLE_ENDIAN
    244 #  define _LIBCPP_LITTLE_ENDIAN 1
    245 #  define _LIBCPP_BIG_ENDIAN    0
    246 # elif __BYTE_ORDER == __BIG_ENDIAN
    247 #  define _LIBCPP_LITTLE_ENDIAN 0
    248 #  define _LIBCPP_BIG_ENDIAN    1
    249 # else  // __BYTE_ORDER == __BIG_ENDIAN
    250 #  error unable to determine endian
    251 # endif
    252 #endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
    253 
    254 #if __has_attribute(__no_sanitize__)
    255 #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
    256 #else
    257 #define _LIBCPP_NO_CFI
    258 #endif
    259 
    260 #if defined(_LIBCPP_COMPILER_CLANG)
    261 
    262 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
    263 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
    264 #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&       \
    265      !defined(__arm__)) ||                                                     \
    266     defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
    267 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
    268 #endif
    269 
    270 #if __has_feature(cxx_alignas)
    271 #  define _ALIGNAS_TYPE(x) alignas(x)
    272 #  define _ALIGNAS(x) alignas(x)
    273 #else
    274 #  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
    275 #  define _ALIGNAS(x) __attribute__((__aligned__(x)))
    276 #endif
    277 
    278 #if __cplusplus < 201103L
    279 typedef __char16_t char16_t;
    280 typedef __char32_t char32_t;
    281 #endif
    282 
    283 #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
    284 #define _LIBCPP_NO_EXCEPTIONS
    285 #endif
    286 
    287 #if !(__has_feature(cxx_rtti))
    288 #define _LIBCPP_NO_RTTI
    289 #endif
    290 
    291 #if !(__has_feature(cxx_strong_enums))
    292 #define _LIBCPP_HAS_NO_STRONG_ENUMS
    293 #endif
    294 
    295 #if !(__has_feature(cxx_decltype))
    296 #define _LIBCPP_HAS_NO_DECLTYPE
    297 #endif
    298 
    299 #if __has_feature(cxx_attributes)
    300 #  define _LIBCPP_NORETURN [[noreturn]]
    301 #else
    302 #  define _LIBCPP_NORETURN __attribute__ ((noreturn))
    303 #endif
    304 
    305 #if !(__has_feature(cxx_lambdas))
    306 #define _LIBCPP_HAS_NO_LAMBDAS
    307 #endif
    308 
    309 #if !(__has_feature(cxx_nullptr))
    310 # if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
    311 #   define nullptr __nullptr
    312 # else
    313 #   define _LIBCPP_HAS_NO_NULLPTR
    314 # endif
    315 #endif
    316 
    317 #if !(__has_feature(cxx_rvalue_references))
    318 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
    319 #endif
    320 
    321 #if !(__has_feature(cxx_auto_type))
    322 #define _LIBCPP_HAS_NO_AUTO_TYPE
    323 #endif
    324 
    325 #if !(__has_feature(cxx_variadic_templates))
    326 #define _LIBCPP_HAS_NO_VARIADICS
    327 #endif
    328 
    329 #if !(__has_feature(cxx_generalized_initializers))
    330 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
    331 #endif
    332 
    333 #if __has_feature(is_base_of)
    334 #  define _LIBCPP_HAS_IS_BASE_OF
    335 #endif
    336 
    337 #if __has_feature(is_final)
    338 #  define _LIBCPP_HAS_IS_FINAL
    339 #endif
    340 
    341 // Objective-C++ features (opt-in)
    342 #if __has_feature(objc_arc)
    343 #define _LIBCPP_HAS_OBJC_ARC
    344 #endif
    345 
    346 #if __has_feature(objc_arc_weak)
    347 #define _LIBCPP_HAS_OBJC_ARC_WEAK
    348 #define _LIBCPP_HAS_NO_STRONG_ENUMS
    349 #endif
    350 
    351 #if !(__has_feature(cxx_constexpr))
    352 #define _LIBCPP_HAS_NO_CONSTEXPR
    353 #endif
    354 
    355 #if !(__has_feature(cxx_relaxed_constexpr))
    356 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
    357 #endif
    358 
    359 #if !(__has_feature(cxx_variable_templates))
    360 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
    361 #endif
    362 
    363 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
    364 #if defined(__FreeBSD__)
    365 #define _LIBCPP_HAS_QUICK_EXIT
    366 #define _LIBCPP_HAS_C11_FEATURES
    367 #elif defined(__Fuchsia__)
    368 #define _LIBCPP_HAS_QUICK_EXIT
    369 #define _LIBCPP_HAS_C11_FEATURES
    370 #elif defined(__linux__)
    371 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
    372 #if __GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
    373 #define _LIBCPP_HAS_QUICK_EXIT
    374 #endif
    375 #if __GLIBC_PREREQ(2, 17)
    376 #define _LIBCPP_HAS_C11_FEATURES
    377 #endif
    378 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
    379 #define _LIBCPP_HAS_QUICK_EXIT
    380 #define _LIBCPP_HAS_C11_FEATURES
    381 #endif
    382 #endif // __linux__
    383 #endif
    384 
    385 #if !(__has_feature(cxx_noexcept))
    386 #define _LIBCPP_HAS_NO_NOEXCEPT
    387 #endif
    388 
    389 #if __has_feature(underlying_type)
    390 #  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
    391 #endif
    392 
    393 #if __has_feature(is_literal)
    394 #  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
    395 #endif
    396 
    397 // Inline namespaces are available in Clang regardless of C++ dialect.
    398 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
    399 #define _LIBCPP_END_NAMESPACE_STD  } }
    400 #define _VSTD std::_LIBCPP_NAMESPACE
    401 
    402 namespace std {
    403   inline namespace _LIBCPP_NAMESPACE {
    404   }
    405 }
    406 
    407 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
    408 #define _LIBCPP_HAS_NO_ASAN
    409 #endif
    410 
    411 // Allow for build-time disabling of unsigned integer sanitization
    412 #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
    413 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
    414 #endif 
    415 
    416 #elif defined(_LIBCPP_COMPILER_GCC)
    417 
    418 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
    419 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
    420 
    421 #define _LIBCPP_NORETURN __attribute__((noreturn))
    422 
    423 #if _GNUC_VER >= 407
    424 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
    425 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
    426 #define _LIBCPP_HAS_IS_FINAL
    427 #endif
    428 
    429 #if defined(__GNUC__) && _GNUC_VER >= 403
    430 #  define _LIBCPP_HAS_IS_BASE_OF
    431 #endif
    432 
    433 #if !__EXCEPTIONS
    434 #define _LIBCPP_NO_EXCEPTIONS
    435 #endif
    436 
    437 // constexpr was added to GCC in 4.6.
    438 #if _GNUC_VER < 406
    439 #define _LIBCPP_HAS_NO_CONSTEXPR
    440 // Can only use constexpr in c++11 mode.
    441 #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
    442 #define _LIBCPP_HAS_NO_CONSTEXPR
    443 #endif
    444 
    445 // Determine if GCC supports relaxed constexpr
    446 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
    447 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
    448 #endif
    449 
    450 // GCC 5 will support variable templates
    451 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
    452 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
    453 #endif
    454 
    455 #ifndef __GXX_EXPERIMENTAL_CXX0X__
    456 #define _LIBCPP_HAS_NO_DECLTYPE
    457 #define _LIBCPP_HAS_NO_NULLPTR
    458 #define _LIBCPP_HAS_NO_UNICODE_CHARS
    459 #define _LIBCPP_HAS_NO_VARIADICS
    460 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
    461 #define _LIBCPP_HAS_NO_STRONG_ENUMS
    462 #define _LIBCPP_HAS_NO_NOEXCEPT
    463 
    464 #else  // __GXX_EXPERIMENTAL_CXX0X__
    465 
    466 #if _GNUC_VER < 403
    467 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
    468 #endif
    469 
    470 
    471 #if _GNUC_VER < 404
    472 #define _LIBCPP_HAS_NO_DECLTYPE
    473 #define _LIBCPP_HAS_NO_UNICODE_CHARS
    474 #define _LIBCPP_HAS_NO_VARIADICS
    475 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
    476 #endif  // _GNUC_VER < 404
    477 
    478 #if _GNUC_VER < 406
    479 #define _LIBCPP_HAS_NO_NOEXCEPT
    480 #define _LIBCPP_HAS_NO_NULLPTR
    481 #endif
    482 
    483 #endif  // __GXX_EXPERIMENTAL_CXX0X__
    484 
    485 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
    486 #define _LIBCPP_END_NAMESPACE_STD  } }
    487 #define _VSTD std::_LIBCPP_NAMESPACE
    488 
    489 namespace std {
    490   inline namespace _LIBCPP_NAMESPACE {
    491   }
    492 }
    493 
    494 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
    495 #define _LIBCPP_HAS_NO_ASAN
    496 #endif
    497 
    498 #elif defined(_LIBCPP_COMPILER_MSVC)
    499 
    500 #define _LIBCPP_TOSTRING2(x) #x
    501 #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
    502 #define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
    503 
    504 #if _MSC_VER < 1900
    505 #error "MSVC versions prior to Visual Studio 2015 are not supported"
    506 #endif
    507 
    508 #define _LIBCPP_HAS_IS_BASE_OF
    509 #define _LIBCPP_HAS_NO_CONSTEXPR
    510 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
    511 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
    512 #if _MSC_VER <= 1800
    513 #define _LIBCPP_HAS_NO_UNICODE_CHARS
    514 #endif
    515 #define _LIBCPP_HAS_NO_NOEXCEPT
    516 #define __alignof__ __alignof
    517 #define _LIBCPP_NORETURN __declspec(noreturn)
    518 #define _ALIGNAS(x) __declspec(align(x))
    519 #define _LIBCPP_HAS_NO_VARIADICS
    520 
    521 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
    522 #define _LIBCPP_END_NAMESPACE_STD  }
    523 #define _VSTD std
    524 
    525 #  define _LIBCPP_WEAK
    526 namespace std {
    527 }
    528 
    529 #define _LIBCPP_HAS_NO_ASAN
    530 
    531 #elif defined(_LIBCPP_COMPILER_IBM)
    532 
    533 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
    534 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
    535 #define _ATTRIBUTE(x) __attribute__((x))
    536 #define _LIBCPP_NORETURN __attribute__((noreturn))
    537 
    538 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
    539 #define _LIBCPP_HAS_NO_NOEXCEPT
    540 #define _LIBCPP_HAS_NO_NULLPTR
    541 #define _LIBCPP_HAS_NO_UNICODE_CHARS
    542 #define _LIBCPP_HAS_IS_BASE_OF
    543 #define _LIBCPP_HAS_IS_FINAL
    544 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
    545 
    546 #if defined(_AIX)
    547 #define __MULTILOCALE_API
    548 #endif
    549 
    550 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
    551 #define _LIBCPP_END_NAMESPACE_STD  } }
    552 #define _VSTD std::_LIBCPP_NAMESPACE
    553 
    554 namespace std {
    555   inline namespace _LIBCPP_NAMESPACE {
    556   }
    557 }
    558 
    559 #define _LIBCPP_HAS_NO_ASAN
    560 
    561 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
    562 
    563 #if defined(__ELF__)
    564 #define _LIBCPP_OBJECT_FORMAT_ELF   1
    565 #elif defined(__MACH__)
    566 #define _LIBCPP_OBJECT_FORMAT_MACHO 1
    567 #else
    568 #define _LIBCPP_OBJECT_FORMAT_COFF  1
    569 #endif
    570 
    571 #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
    572 #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    573 # define _LIBCPP_DLL_VIS
    574 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
    575 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
    576 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
    577 #elif defined(_LIBCPP_BUILDING_LIBRARY)
    578 # define _LIBCPP_DLL_VIS __declspec(dllexport)
    579 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
    580 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
    581 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
    582 #else
    583 # define _LIBCPP_DLL_VIS __declspec(dllimport)
    584 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
    585 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
    586 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
    587 #endif
    588 
    589 #define _LIBCPP_TYPE_VIS            _LIBCPP_DLL_VIS
    590 #define _LIBCPP_FUNC_VIS            _LIBCPP_DLL_VIS
    591 #define _LIBCPP_EXTERN_VIS          _LIBCPP_DLL_VIS
    592 #define _LIBCPP_EXCEPTION_ABI       _LIBCPP_DLL_VIS
    593 #define _LIBCPP_HIDDEN
    594 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
    595 #define _LIBCPP_TEMPLATE_VIS
    596 #define _LIBCPP_FUNC_VIS_ONLY
    597 #define _LIBCPP_ENUM_VIS
    598 
    599 #if defined(_LIBCPP_COMPILER_MSVC)
    600 # define _LIBCPP_INLINE_VISIBILITY __forceinline
    601 # define _LIBCPP_ALWAYS_INLINE     __forceinline
    602 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
    603 #else
    604 # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
    605 # define _LIBCPP_ALWAYS_INLINE     __attribute__ ((__always_inline__))
    606 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
    607 #endif
    608 #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
    609 
    610 #ifndef _LIBCPP_HIDDEN
    611 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    612 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
    613 #else
    614 #define _LIBCPP_HIDDEN
    615 #endif
    616 #endif
    617 
    618 #ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
    619 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    620 // The inline should be removed once PR32114 is resolved
    621 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
    622 #else
    623 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
    624 #endif
    625 #endif
    626 
    627 #ifndef _LIBCPP_FUNC_VIS
    628 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    629 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
    630 #else
    631 #define _LIBCPP_FUNC_VIS
    632 #endif
    633 #endif
    634 
    635 #ifndef _LIBCPP_TYPE_VIS
    636 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    637 #    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
    638 #  else
    639 #    define _LIBCPP_TYPE_VIS
    640 #  endif
    641 #endif
    642 
    643 #ifndef _LIBCPP_TEMPLATE_VIS
    644 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    645 #    if __has_attribute(__type_visibility__)
    646 #      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
    647 #    else
    648 #      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
    649 #    endif
    650 #  else
    651 #    define _LIBCPP_TEMPLATE_VIS
    652 #  endif
    653 #endif
    654 
    655 #ifndef _LIBCPP_FUNC_VIS_ONLY
    656 # define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
    657 #endif
    658 
    659 #ifndef _LIBCPP_EXTERN_VIS
    660 # define _LIBCPP_EXTERN_VIS
    661 #endif
    662 
    663 #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
    664 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
    665 #endif
    666 
    667 #ifndef _LIBCPP_EXCEPTION_ABI
    668 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    669 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
    670 #else
    671 #define _LIBCPP_EXCEPTION_ABI
    672 #endif
    673 #endif
    674 
    675 #ifndef _LIBCPP_ENUM_VIS
    676 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
    677 #    define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default")))
    678 #  else
    679 #    define _LIBCPP_ENUM_VIS
    680 #  endif
    681 #endif
    682 
    683 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
    684 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
    685 #    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
    686 #  else
    687 #    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
    688 #  endif
    689 #endif
    690 
    691 #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
    692 #  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
    693 #endif
    694 
    695 #ifndef _LIBCPP_INLINE_VISIBILITY
    696 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    697 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
    698 #else
    699 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
    700 #endif
    701 #endif
    702 
    703 #ifndef _LIBCPP_ALWAYS_INLINE
    704 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    705 #define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
    706 #else
    707 #define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__always_inline__))
    708 #endif
    709 #endif
    710 
    711 #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
    712 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
    713 #  define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__))
    714 # else
    715 #  define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__))
    716 # endif
    717 #endif
    718 
    719 #ifndef _LIBCPP_PREFERRED_OVERLOAD
    720 #  if __has_attribute(__enable_if__)
    721 #    define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
    722 #  endif
    723 #endif
    724 
    725 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
    726 #  define _NOEXCEPT noexcept
    727 #  define _NOEXCEPT_(x) noexcept(x)
    728 #else
    729 #  define _NOEXCEPT throw()
    730 #  define _NOEXCEPT_(x)
    731 #endif
    732 
    733 #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
    734 # if !defined(_LIBCPP_DEBUG)
    735 #   error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
    736 # endif
    737 # define _NOEXCEPT_DEBUG noexcept(false)
    738 # define _NOEXCEPT_DEBUG_(x) noexcept(false)
    739 #else
    740 # define _NOEXCEPT_DEBUG _NOEXCEPT
    741 # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
    742 #endif
    743 
    744 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
    745 typedef unsigned short char16_t;
    746 typedef unsigned int   char32_t;
    747 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
    748 
    749 #ifndef __SIZEOF_INT128__
    750 #define _LIBCPP_HAS_NO_INT128
    751 #endif
    752 
    753 #ifdef _LIBCPP_CXX03_LANG
    754 # if __has_extension(c_static_assert)
    755 #   define static_assert(__b, __m) _Static_assert(__b, __m)
    756 # else
    757 extern "C++" {
    758 template <bool> struct __static_assert_test;
    759 template <> struct __static_assert_test<true> {};
    760 template <unsigned> struct __static_assert_check {};
    761 }
    762 #define static_assert(__b, __m) \
    763     typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
    764     _LIBCPP_CONCAT(__t, __LINE__)
    765 # endif // __has_extension(c_static_assert)
    766 #endif  // _LIBCPP_CXX03_LANG
    767 
    768 #ifdef _LIBCPP_HAS_NO_DECLTYPE
    769 // GCC 4.6 provides __decltype in all standard modes.
    770 #if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
    771 #  define decltype(__x) __decltype(__x)
    772 #else
    773 #  define decltype(__x) __typeof__(__x)
    774 #endif
    775 #endif
    776 
    777 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
    778 #define _LIBCPP_CONSTEXPR
    779 #else
    780 #define _LIBCPP_CONSTEXPR constexpr
    781 #endif
    782 
    783 #ifdef _LIBCPP_CXX03_LANG
    784 #define _LIBCPP_DEFAULT {}
    785 #else
    786 #define _LIBCPP_DEFAULT = default;
    787 #endif
    788 
    789 #ifdef _LIBCPP_CXX03_LANG
    790 #define _LIBCPP_EQUAL_DELETE
    791 #else
    792 #define _LIBCPP_EQUAL_DELETE = delete
    793 #endif
    794 
    795 #ifdef __GNUC__
    796 #define _NOALIAS __attribute__((__malloc__))
    797 #else
    798 #define _NOALIAS
    799 #endif
    800 
    801 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
    802     (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions
    803 #   define _LIBCPP_EXPLICIT explicit
    804 #else
    805 #   define _LIBCPP_EXPLICIT
    806 #endif
    807 
    808 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
    809 #   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
    810 #endif
    811 
    812 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
    813 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
    814 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
    815     __lx __v_; \
    816     _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
    817     _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
    818     _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
    819     };
    820 #else  // _LIBCPP_HAS_NO_STRONG_ENUMS
    821 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
    822 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
    823 #endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
    824 
    825 #ifdef _LIBCPP_DEBUG
    826 #   if _LIBCPP_DEBUG == 0
    827 #       define _LIBCPP_DEBUG_LEVEL 1
    828 #   elif _LIBCPP_DEBUG == 1
    829 #       define _LIBCPP_DEBUG_LEVEL 2
    830 #   else
    831 #       error Supported values for _LIBCPP_DEBUG are 0 and 1
    832 #   endif
    833 # if !defined(_LIBCPP_BUILDING_LIBRARY)
    834 #   define _LIBCPP_EXTERN_TEMPLATE(...)
    835 # endif
    836 #endif
    837 
    838 #ifndef _LIBCPP_EXTERN_TEMPLATE
    839 #define _LIBCPP_EXTERN_TEMPLATE(...)
    840 #endif
    841 
    842 #ifndef _LIBCPP_EXTERN_TEMPLATE2
    843 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
    844 #endif
    845 
    846 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
    847 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
    848 #endif
    849 
    850 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT) ||   \
    851     defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
    852 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
    853 #endif
    854 
    855 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
    856 // Most unix variants have catopen.  These are the specific ones that don't.
    857 #if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
    858 #define _LIBCPP_HAS_CATOPEN 1
    859 #endif
    860 #endif
    861 
    862 #ifdef __FreeBSD__
    863 #define _DECLARE_C99_LDBL_MATH 1
    864 #endif
    865 
    866 #if defined(__APPLE__)
    867 # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
    868      defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
    869 #   define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
    870 # endif
    871 # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
    872 #   if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
    873 #     define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
    874 #   endif
    875 # endif
    876 #endif // defined(__APPLE__)
    877 
    878 #if defined(__APPLE__) || defined(__FreeBSD__)
    879 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
    880 #endif
    881 
    882 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
    883 #define _LIBCPP_WCTYPE_IS_MASK
    884 #endif
    885 
    886 #ifndef _LIBCPP_STD_VER
    887 #  if  __cplusplus <= 201103L
    888 #    define _LIBCPP_STD_VER 11
    889 #  elif __cplusplus <= 201402L
    890 #    define _LIBCPP_STD_VER 14
    891 #  else
    892 #    define _LIBCPP_STD_VER 16  // current year, or date of c++17 ratification
    893 #  endif
    894 #endif  // _LIBCPP_STD_VER
    895 
    896 #if _LIBCPP_STD_VER > 11
    897 #define _LIBCPP_DEPRECATED [[deprecated]]
    898 #else
    899 #define _LIBCPP_DEPRECATED
    900 #endif
    901 
    902 #if _LIBCPP_STD_VER <= 11
    903 #define _LIBCPP_EXPLICIT_AFTER_CXX11
    904 #define _LIBCPP_DEPRECATED_AFTER_CXX11
    905 #else
    906 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
    907 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
    908 #endif
    909 
    910 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
    911 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
    912 #else
    913 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
    914 #endif
    915 
    916 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
    917 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
    918 #else
    919 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
    920 #endif
    921 
    922 // FIXME: Remove all usages of this macro once compilers catch up.
    923 #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606L)
    924 # define _LIBCPP_HAS_NO_INLINE_VARIABLES
    925 #endif
    926 
    927 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
    928 #  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
    929 #else
    930 #  define _LIBCPP_EXPLICIT_MOVE(x) (x)
    931 #endif
    932 
    933 #ifndef _LIBCPP_HAS_NO_ASAN
    934 _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
    935   const void *, const void *, const void *, const void *);
    936 #endif
    937 
    938 // Try to find out if RTTI is disabled.
    939 // g++ and cl.exe have RTTI on by default and define a macro when it is.
    940 // g++ only defines the macro in 4.3.2 and onwards.
    941 #if !defined(_LIBCPP_NO_RTTI)
    942 #  if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
    943    (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
    944 #    define _LIBCPP_NO_RTTI
    945 #  elif defined(_LIBCPP_MSVC) && !defined(_CPPRTTI)
    946 #    define _LIBCPP_NO_RTTI
    947 #  endif
    948 #endif
    949 
    950 #ifndef _LIBCPP_WEAK
    951 #  define _LIBCPP_WEAK __attribute__((__weak__))
    952 #endif
    953 
    954 // Thread API
    955 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
    956     !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
    957     !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
    958 # if defined(__FreeBSD__) || \
    959     defined(__Fuchsia__) || \
    960     defined(__NetBSD__) || \
    961     defined(__linux__) || \
    962     defined(__APPLE__) || \
    963     defined(__CloudABI__) || \
    964     defined(__sun__)
    965 #   define _LIBCPP_HAS_THREAD_API_PTHREAD
    966 # elif defined(_LIBCPP_WIN32API)
    967 #  define _LIBCPP_HAS_THREAD_API_WIN32
    968 # else
    969 #  error "No thread API"
    970 # endif // _LIBCPP_HAS_THREAD_API
    971 #endif // _LIBCPP_HAS_NO_THREADS
    972 
    973 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
    974 #  error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
    975          _LIBCPP_HAS_NO_THREADS is not defined.
    976 #endif
    977 
    978 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
    979 #  error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
    980          _LIBCPP_HAS_NO_THREADS is defined.
    981 #endif
    982 
    983 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
    984 #  error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
    985          _LIBCPP_HAS_NO_THREADS is defined.
    986 #endif
    987 
    988 // Systems that use capability-based security (FreeBSD with Capsicum,
    989 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
    990 // Functions like open(), rename(), unlink() and stat() should not be
    991 // used, as they attempt to access the global filesystem namespace.
    992 #ifdef __CloudABI__
    993 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
    994 #endif
    995 
    996 // CloudABI is intended for running networked services. Processes do not
    997 // have standard input and output channels.
    998 #ifdef __CloudABI__
    999 #define _LIBCPP_HAS_NO_STDIN
   1000 #define _LIBCPP_HAS_NO_STDOUT
   1001 #endif
   1002 
   1003 #if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
   1004     defined(_LIBCPP_HAS_MUSL_LIBC)
   1005 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
   1006 #endif
   1007 
   1008 // Thread-unsafe functions such as strtok() and localtime()
   1009 // are not available.
   1010 #ifdef __CloudABI__
   1011 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
   1012 #endif
   1013 
   1014 #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
   1015 #define _LIBCPP_HAS_C_ATOMIC_IMP
   1016 #elif _GNUC_VER > 407
   1017 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
   1018 #endif
   1019 
   1020 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
   1021      || defined(_LIBCPP_HAS_NO_THREADS)
   1022 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
   1023 #endif
   1024 
   1025 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
   1026 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
   1027 #endif
   1028 
   1029 #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
   1030 #if defined(__clang__) && __has_attribute(acquire_capability)
   1031 // Work around the attribute handling in clang.  When both __declspec and
   1032 // __attribute__ are present, the processing goes awry preventing the definition
   1033 // of the types.
   1034 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
   1035 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
   1036 #endif
   1037 #endif
   1038 #endif
   1039 
   1040 #if __has_attribute(require_constant_initialization)
   1041 #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
   1042 #else
   1043 #define _LIBCPP_SAFE_STATIC
   1044 #endif
   1045 
   1046 #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
   1047 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
   1048 #endif
   1049 
   1050 #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
   1051 #if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
   1052 #define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
   1053 #endif
   1054 #endif
   1055 
   1056 #if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
   1057 # define _LIBCPP_DIAGNOSE_WARNING(...) \
   1058     __attribute__((diagnose_if(__VA_ARGS__, "warning")))
   1059 # define _LIBCPP_DIAGNOSE_ERROR(...) \
   1060     __attribute__((diagnose_if(__VA_ARGS__, "error")))
   1061 #else
   1062 # define _LIBCPP_DIAGNOSE_WARNING(...)
   1063 # define _LIBCPP_DIAGNOSE_ERROR(...)
   1064 #endif
   1065 
   1066 #if defined(_LIBCPP_ABI_MICROSOFT) && \
   1067    (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
   1068 # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
   1069 #else
   1070 # define _LIBCPP_DECLSPEC_EMPTY_BASES
   1071 #endif
   1072 
   1073 #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
   1074 # define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
   1075 # define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
   1076 #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
   1077 
   1078 #endif // __cplusplus
   1079 
   1080 #endif // _LIBCPP_CONFIG
   1081