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// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme 29// introduced in GCC 5.0. 30#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) 31#else 32#define _GNUC_VER 0 33#define _GNUC_VER_NEW 0 34#endif 35 36#define _LIBCPP_VERSION 7000 37 38#ifndef _LIBCPP_ABI_VERSION 39#define _LIBCPP_ABI_VERSION 1 40#endif 41 42#if defined(__ELF__) 43#define _LIBCPP_OBJECT_FORMAT_ELF 1 44#elif defined(__MACH__) 45#define _LIBCPP_OBJECT_FORMAT_MACHO 1 46#elif defined(_WIN32) 47#define _LIBCPP_OBJECT_FORMAT_COFF 1 48#elif defined(__wasm__) 49#define _LIBCPP_OBJECT_FORMAT_WASM 1 50#else 51#error Unknown object file format 52#endif 53 54#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 55// Change short string representation so that string data starts at offset 0, 56// improving its alignment in some cases. 57#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 58// Fix deque iterator type in order to support incomplete types. 59#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE 60// Fix undefined behavior in how std::list stores its linked nodes. 61#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB 62// Fix undefined behavior in how __tree stores its end and parent nodes. 63#define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB 64// Fix undefined behavior in how __hash_table stores its pointer types. 65#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB 66#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB 67#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE 68// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr 69// provided under the alternate keyword __nullptr, which changes the mangling 70// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. 71#define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR 72// Define the `pointer_safety` enum as a C++11 strongly typed enumeration 73// instead of as a class simulating an enum. If this option is enabled 74// `pointer_safety` and `get_pointer_safety()` will no longer be available 75// in C++03. 76#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE 77// Define a key function for `bad_function_call` in the library, to centralize 78// its vtable and typeinfo to libc++ rather than having all other libraries 79// using that class define their own copies. 80#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION 81// Enable optimized version of __do_get_(un)signed which avoids redundant copies. 82#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET 83// Use the smallest possible integer type to represent the index of the variant. 84// Previously libc++ used "unsigned int" exclusivly. 85#define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION 86#elif _LIBCPP_ABI_VERSION == 1 87#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) 88// Enable compiling copies of now inline methods into the dylib to support 89// applications compiled against older libraries. This is unnecessary with 90// COFF dllexport semantics, since dllexport forces a non-inline definition 91// of inline functions to be emitted anyway. Our own non-inline copy would 92// conflict with the dllexport-emitted copy, so we disable it. 93#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS 94#endif 95// Feature macros for disabling pre ABI v1 features. All of these options 96// are deprecated. 97#if defined(__FreeBSD__) 98#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR 99#endif 100#endif 101 102#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 103#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \ 104 use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead 105#endif 106 107#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y 108#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) 109 110#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) 111 112#if __cplusplus < 201103L 113#define _LIBCPP_CXX03_LANG 114#endif 115 116#ifndef __has_attribute 117#define __has_attribute(__x) 0 118#endif 119#ifndef __has_builtin 120#define __has_builtin(__x) 0 121#endif 122#ifndef __has_extension 123#define __has_extension(__x) 0 124#endif 125#ifndef __has_feature 126#define __has_feature(__x) 0 127#endif 128#ifndef __has_cpp_attribute 129#define __has_cpp_attribute(__x) 0 130#endif 131// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by 132// the compiler and '1' otherwise. 133#ifndef __is_identifier 134#define __is_identifier(__x) 1 135#endif 136#ifndef __has_declspec_attribute 137#define __has_declspec_attribute(__x) 0 138#endif 139 140#define __has_keyword(__x) !(__is_identifier(__x)) 141 142#ifdef __has_include 143#define __libcpp_has_include(__x) __has_include(__x) 144#else 145#define __libcpp_has_include(__x) 0 146#endif 147 148#if defined(__clang__) 149#define _LIBCPP_COMPILER_CLANG 150# ifndef __apple_build_version__ 151# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) 152# endif 153#elif defined(__GNUC__) 154#define _LIBCPP_COMPILER_GCC 155#elif defined(_MSC_VER) 156#define _LIBCPP_COMPILER_MSVC 157#elif defined(__IBMCPP__) 158#define _LIBCPP_COMPILER_IBM 159#endif 160 161#ifndef _LIBCPP_CLANG_VER 162#define _LIBCPP_CLANG_VER 0 163#endif 164 165// FIXME: ABI detection should be done via compiler builtin macros. This 166// is just a placeholder until Clang implements such macros. For now assume 167// that Windows compilers pretending to be MSVC++ target the Microsoft ABI, 168// and allow the user to explicitly specify the ABI to handle cases where this 169// heuristic falls short. 170#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) 171# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" 172#elif defined(_LIBCPP_ABI_FORCE_ITANIUM) 173# define _LIBCPP_ABI_ITANIUM 174#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) 175# define _LIBCPP_ABI_MICROSOFT 176#else 177# if defined(_WIN32) && defined(_MSC_VER) 178# define _LIBCPP_ABI_MICROSOFT 179# else 180# define _LIBCPP_ABI_ITANIUM 181# endif 182#endif 183 184// Need to detect which libc we're using if we're on Linux. 185#if defined(__linux__) 186#include <features.h> 187#if defined(__GLIBC_PREREQ) 188#define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) 189#else 190#define _LIBCPP_GLIBC_PREREQ(a, b) 0 191#endif // defined(__GLIBC_PREREQ) 192#endif // defined(__linux__) 193 194#ifdef __LITTLE_ENDIAN__ 195#if __LITTLE_ENDIAN__ 196#define _LIBCPP_LITTLE_ENDIAN 197#endif // __LITTLE_ENDIAN__ 198#endif // __LITTLE_ENDIAN__ 199 200#ifdef __BIG_ENDIAN__ 201#if __BIG_ENDIAN__ 202#define _LIBCPP_BIG_ENDIAN 203#endif // __BIG_ENDIAN__ 204#endif // __BIG_ENDIAN__ 205 206#ifdef __BYTE_ORDER__ 207#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 208#define _LIBCPP_LITTLE_ENDIAN 209#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 210#define _LIBCPP_BIG_ENDIAN 211#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 212#endif // __BYTE_ORDER__ 213 214#ifdef __FreeBSD__ 215# include <sys/endian.h> 216# if _BYTE_ORDER == _LITTLE_ENDIAN 217# define _LIBCPP_LITTLE_ENDIAN 218# else // _BYTE_ORDER == _LITTLE_ENDIAN 219# define _LIBCPP_BIG_ENDIAN 220# endif // _BYTE_ORDER == _LITTLE_ENDIAN 221# ifndef __LONG_LONG_SUPPORTED 222# define _LIBCPP_HAS_NO_LONG_LONG 223# endif // __LONG_LONG_SUPPORTED 224#endif // __FreeBSD__ 225 226#ifdef __NetBSD__ 227# include <sys/endian.h> 228# if _BYTE_ORDER == _LITTLE_ENDIAN 229# define _LIBCPP_LITTLE_ENDIAN 230# else // _BYTE_ORDER == _LITTLE_ENDIAN 231# define _LIBCPP_BIG_ENDIAN 232# endif // _BYTE_ORDER == _LITTLE_ENDIAN 233# define _LIBCPP_HAS_QUICK_EXIT 234#endif // __NetBSD__ 235 236#if defined(_WIN32) 237# define _LIBCPP_WIN32API 238# define _LIBCPP_LITTLE_ENDIAN 239# define _LIBCPP_SHORT_WCHAR 1 240// Both MinGW and native MSVC provide a "MSVC"-like enviroment 241# define _LIBCPP_MSVCRT_LIKE 242// If mingw not explicitly detected, assume using MS C runtime only if 243// a MS compatibility version is specified. 244# if defined(_MSC_VER) && !defined(__MINGW32__) 245# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library 246# endif 247# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__)) 248# define _LIBCPP_HAS_BITSCAN64 249# endif 250# define _LIBCPP_HAS_OPEN_WITH_WCHAR 251# if defined(_LIBCPP_MSVCRT) 252# define _LIBCPP_HAS_QUICK_EXIT 253# endif 254 255// Some CRT APIs are unavailable to store apps 256#if defined(WINAPI_FAMILY) 257#include <winapifamily.h> 258#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ 259 (!defined(WINAPI_PARTITION_SYSTEM) || \ 260 !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) 261#define _LIBCPP_WINDOWS_STORE_APP 262#endif 263#endif 264#endif // defined(_WIN32) 265 266#ifdef __sun__ 267# include <sys/isa_defs.h> 268# ifdef _LITTLE_ENDIAN 269# define _LIBCPP_LITTLE_ENDIAN 270# else 271# define _LIBCPP_BIG_ENDIAN 272# endif 273#endif // __sun__ 274 275#if defined(__CloudABI__) 276 // Certain architectures provide arc4random(). Prefer using 277 // arc4random() over /dev/{u,}random to make it possible to obtain 278 // random data even when using sandboxing mechanisms such as chroots, 279 // Capsicum, etc. 280# define _LIBCPP_USING_ARC4_RANDOM 281#elif defined(__Fuchsia__) 282# define _LIBCPP_USING_GETENTROPY 283#elif defined(__native_client__) 284 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, 285 // including accesses to the special files under /dev. C++11's 286 // std::random_device is instead exposed through a NaCl syscall. 287# define _LIBCPP_USING_NACL_RANDOM 288#elif defined(_LIBCPP_WIN32API) 289# define _LIBCPP_USING_WIN32_RANDOM 290#else 291# define _LIBCPP_USING_DEV_RANDOM 292#endif 293 294#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) 295# include <endian.h> 296# if __BYTE_ORDER == __LITTLE_ENDIAN 297# define _LIBCPP_LITTLE_ENDIAN 298# elif __BYTE_ORDER == __BIG_ENDIAN 299# define _LIBCPP_BIG_ENDIAN 300# else // __BYTE_ORDER == __BIG_ENDIAN 301# error unable to determine endian 302# endif 303#endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) 304 305#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) 306#define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) 307#else 308#define _LIBCPP_NO_CFI 309#endif 310 311#if defined(_LIBCPP_COMPILER_CLANG) 312 313// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for 314// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. 315#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ 316 (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \ 317 defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) 318#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 319#endif 320 321#if __has_feature(cxx_alignas) 322# define _ALIGNAS_TYPE(x) alignas(x) 323# define _ALIGNAS(x) alignas(x) 324#else 325# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 326# define _ALIGNAS(x) __attribute__((__aligned__(x))) 327#endif 328 329#if __cplusplus < 201103L 330typedef __char16_t char16_t; 331typedef __char32_t char32_t; 332#endif 333 334#if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS) 335#define _LIBCPP_NO_EXCEPTIONS 336#endif 337 338#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI) 339#define _LIBCPP_NO_RTTI 340#endif 341 342#if !(__has_feature(cxx_strong_enums)) 343#define _LIBCPP_HAS_NO_STRONG_ENUMS 344#endif 345 346#if !(__has_feature(cxx_decltype)) 347#define _LIBCPP_HAS_NO_DECLTYPE 348#endif 349 350#if __has_feature(cxx_attributes) 351# define _LIBCPP_NORETURN [[noreturn]] 352#else 353# define _LIBCPP_NORETURN __attribute__ ((noreturn)) 354#endif 355 356#if !(__has_feature(cxx_lambdas)) 357#define _LIBCPP_HAS_NO_LAMBDAS 358#endif 359 360#if !(__has_feature(cxx_nullptr)) 361# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) 362# define nullptr __nullptr 363# else 364# define _LIBCPP_HAS_NO_NULLPTR 365# endif 366#endif 367 368#if !(__has_feature(cxx_rvalue_references)) 369#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 370#endif 371 372#if !(__has_feature(cxx_auto_type)) 373#define _LIBCPP_HAS_NO_AUTO_TYPE 374#endif 375 376#if !(__has_feature(cxx_variadic_templates)) 377#define _LIBCPP_HAS_NO_VARIADICS 378#endif 379 380#if !(__has_feature(cxx_generalized_initializers)) 381#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 382#endif 383 384#if __has_feature(is_base_of) 385# define _LIBCPP_HAS_IS_BASE_OF 386#endif 387 388#if __has_feature(is_final) 389# define _LIBCPP_HAS_IS_FINAL 390#endif 391 392// Objective-C++ features (opt-in) 393#if __has_feature(objc_arc) 394#define _LIBCPP_HAS_OBJC_ARC 395#endif 396 397#if __has_feature(objc_arc_weak) 398#define _LIBCPP_HAS_OBJC_ARC_WEAK 399#endif 400 401#if !(__has_feature(cxx_constexpr)) 402#define _LIBCPP_HAS_NO_CONSTEXPR 403#endif 404 405#if !(__has_feature(cxx_relaxed_constexpr)) 406#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR 407#endif 408 409#if !(__has_feature(cxx_variable_templates)) 410#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 411#endif 412 413#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L 414#if defined(__FreeBSD__) 415#define _LIBCPP_HAS_QUICK_EXIT 416#define _LIBCPP_HAS_C11_FEATURES 417#elif defined(__Fuchsia__) 418#define _LIBCPP_HAS_QUICK_EXIT 419#define _LIBCPP_HAS_C11_FEATURES 420#elif defined(__linux__) 421#if !defined(_LIBCPP_HAS_MUSL_LIBC) 422#if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) 423#define _LIBCPP_HAS_QUICK_EXIT 424#endif 425#if _LIBCPP_GLIBC_PREREQ(2, 17) 426#define _LIBCPP_HAS_C11_FEATURES 427#endif 428#else // defined(_LIBCPP_HAS_MUSL_LIBC) 429#define _LIBCPP_HAS_QUICK_EXIT 430#define _LIBCPP_HAS_C11_FEATURES 431#endif 432#endif // __linux__ 433#endif 434 435#if !(__has_feature(cxx_noexcept)) 436#define _LIBCPP_HAS_NO_NOEXCEPT 437#endif 438 439#if __has_feature(underlying_type) 440# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) 441#endif 442 443#if __has_feature(is_literal) 444# define _LIBCPP_IS_LITERAL(T) __is_literal(T) 445#endif 446 447// Inline namespaces are available in Clang regardless of C++ dialect. 448#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { 449#define _LIBCPP_END_NAMESPACE_STD } } 450#define _VSTD std::_LIBCPP_NAMESPACE 451 452namespace std { 453 inline namespace _LIBCPP_NAMESPACE { 454 } 455} 456 457#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) 458#define _LIBCPP_HAS_NO_ASAN 459#endif 460 461// Allow for build-time disabling of unsigned integer sanitization 462#if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize) 463#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) 464#endif 465 466#if __has_builtin(__builtin_launder) 467#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER 468#endif 469 470#if !__is_identifier(__has_unique_object_representations) 471#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS 472#endif 473 474#elif defined(_LIBCPP_COMPILER_GCC) 475 476#define _ALIGNAS(x) __attribute__((__aligned__(x))) 477#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 478 479#define _LIBCPP_NORETURN __attribute__((noreturn)) 480 481#if _GNUC_VER >= 407 482#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) 483#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) 484#define _LIBCPP_HAS_IS_FINAL 485#endif 486 487#if defined(__GNUC__) && _GNUC_VER >= 403 488# define _LIBCPP_HAS_IS_BASE_OF 489#endif 490 491#if !__EXCEPTIONS 492#define _LIBCPP_NO_EXCEPTIONS 493#endif 494 495// constexpr was added to GCC in 4.6. 496#if _GNUC_VER < 406 497#define _LIBCPP_HAS_NO_CONSTEXPR 498// Can only use constexpr in c++11 mode. 499#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L 500#define _LIBCPP_HAS_NO_CONSTEXPR 501#endif 502 503// Determine if GCC supports relaxed constexpr 504#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L 505#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR 506#endif 507 508// GCC 5 will support variable templates 509#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L 510#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 511#endif 512 513#ifndef __GXX_EXPERIMENTAL_CXX0X__ 514#define _LIBCPP_HAS_NO_DECLTYPE 515#define _LIBCPP_HAS_NO_NULLPTR 516#define _LIBCPP_HAS_NO_UNICODE_CHARS 517#define _LIBCPP_HAS_NO_VARIADICS 518#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 519#define _LIBCPP_HAS_NO_STRONG_ENUMS 520#define _LIBCPP_HAS_NO_NOEXCEPT 521 522#else // __GXX_EXPERIMENTAL_CXX0X__ 523 524#if _GNUC_VER < 403 525#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 526#endif 527 528 529#if _GNUC_VER < 404 530#define _LIBCPP_HAS_NO_DECLTYPE 531#define _LIBCPP_HAS_NO_UNICODE_CHARS 532#define _LIBCPP_HAS_NO_VARIADICS 533#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 534#endif // _GNUC_VER < 404 535 536#if _GNUC_VER < 406 537#define _LIBCPP_HAS_NO_NOEXCEPT 538#define _LIBCPP_HAS_NO_NULLPTR 539#endif 540 541#endif // __GXX_EXPERIMENTAL_CXX0X__ 542 543#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE { 544#define _LIBCPP_END_NAMESPACE_STD } } 545#define _VSTD std::_LIBCPP_NAMESPACE 546 547namespace std { 548 inline namespace _LIBCPP_NAMESPACE { 549 } 550} 551 552#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) 553#define _LIBCPP_HAS_NO_ASAN 554#endif 555 556#if _GNUC_VER >= 700 557#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER 558#endif 559 560#if _GNUC_VER >= 700 561#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS 562#endif 563 564#elif defined(_LIBCPP_COMPILER_MSVC) 565 566#define _LIBCPP_TOSTRING2(x) #x 567#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) 568#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) 569 570#if _MSC_VER < 1900 571#error "MSVC versions prior to Visual Studio 2015 are not supported" 572#endif 573 574#define _LIBCPP_HAS_IS_BASE_OF 575#define _LIBCPP_HAS_NO_CONSTEXPR 576#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR 577#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 578#if _MSC_VER <= 1800 579#define _LIBCPP_HAS_NO_UNICODE_CHARS 580#endif 581#define _LIBCPP_HAS_NO_NOEXCEPT 582#define __alignof__ __alignof 583#define _LIBCPP_NORETURN __declspec(noreturn) 584#define _ALIGNAS(x) __declspec(align(x)) 585#define _LIBCPP_HAS_NO_VARIADICS 586 587#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { 588#define _LIBCPP_END_NAMESPACE_STD } 589#define _VSTD std 590 591# define _LIBCPP_WEAK 592namespace std { 593} 594 595#define _LIBCPP_HAS_NO_ASAN 596 597#elif defined(_LIBCPP_COMPILER_IBM) 598 599#define _ALIGNAS(x) __attribute__((__aligned__(x))) 600#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 601#define _ATTRIBUTE(x) __attribute__((x)) 602#define _LIBCPP_NORETURN __attribute__((noreturn)) 603 604#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 605#define _LIBCPP_HAS_NO_NOEXCEPT 606#define _LIBCPP_HAS_NO_NULLPTR 607#define _LIBCPP_HAS_NO_UNICODE_CHARS 608#define _LIBCPP_HAS_IS_BASE_OF 609#define _LIBCPP_HAS_IS_FINAL 610#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 611 612#if defined(_AIX) 613#define __MULTILOCALE_API 614#endif 615 616#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { 617#define _LIBCPP_END_NAMESPACE_STD } } 618#define _VSTD std::_LIBCPP_NAMESPACE 619 620namespace std { 621 inline namespace _LIBCPP_NAMESPACE { 622 } 623} 624 625#define _LIBCPP_HAS_NO_ASAN 626 627#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] 628 629#if defined(_LIBCPP_OBJECT_FORMAT_COFF) 630#ifdef _DLL 631# define _LIBCPP_CRT_FUNC __declspec(dllimport) 632#else 633# define _LIBCPP_CRT_FUNC 634#endif 635 636#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 637# define _LIBCPP_DLL_VIS 638# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS 639# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS 640# define _LIBCPP_OVERRIDABLE_FUNC_VIS 641#elif defined(_LIBCPP_BUILDING_LIBRARY) 642# define _LIBCPP_DLL_VIS __declspec(dllexport) 643# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS 644# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS 645# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS 646#else 647# define _LIBCPP_DLL_VIS __declspec(dllimport) 648# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS 649# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS 650# define _LIBCPP_OVERRIDABLE_FUNC_VIS 651#endif 652 653#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS 654#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS 655#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS 656#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS 657#define _LIBCPP_HIDDEN 658#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS 659#define _LIBCPP_TEMPLATE_VIS 660#define _LIBCPP_ENUM_VIS 661 662#if defined(_LIBCPP_COMPILER_MSVC) 663# define _LIBCPP_INLINE_VISIBILITY __forceinline 664# define _LIBCPP_ALWAYS_INLINE __forceinline 665# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline 666#else 667# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) 668# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) 669# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__)) 670#endif 671#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) 672 673#ifndef _LIBCPP_HIDDEN 674#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 675#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) 676#else 677#define _LIBCPP_HIDDEN 678#endif 679#endif 680 681#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS 682#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 683// The inline should be removed once PR32114 is resolved 684#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN 685#else 686#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS 687#endif 688#endif 689 690#ifndef _LIBCPP_FUNC_VIS 691#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 692#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) 693#else 694#define _LIBCPP_FUNC_VIS 695#endif 696#endif 697 698#ifndef _LIBCPP_TYPE_VIS 699# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 700# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) 701# else 702# define _LIBCPP_TYPE_VIS 703# endif 704#endif 705 706#ifndef _LIBCPP_TEMPLATE_VIS 707# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 708# if __has_attribute(__type_visibility__) 709# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) 710# else 711# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) 712# endif 713# else 714# define _LIBCPP_TEMPLATE_VIS 715# endif 716#endif 717 718#ifndef _LIBCPP_EXTERN_VIS 719# define _LIBCPP_EXTERN_VIS 720#endif 721 722#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS 723# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS 724#endif 725 726#ifndef _LIBCPP_EXCEPTION_ABI 727#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 728#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) 729#else 730#define _LIBCPP_EXCEPTION_ABI 731#endif 732#endif 733 734#ifndef _LIBCPP_ENUM_VIS 735# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) 736# define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) 737# else 738# define _LIBCPP_ENUM_VIS 739# endif 740#endif 741 742#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS 743# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) 744# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default"))) 745# else 746# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS 747# endif 748#endif 749 750#ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS 751# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS 752#endif 753 754#ifndef _LIBCPP_INLINE_VISIBILITY 755#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 756#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) 757#else 758#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) 759#endif 760#endif 761 762#ifndef _LIBCPP_ALWAYS_INLINE 763#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 764#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) 765#else 766#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) 767#endif 768#endif 769 770#ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY 771# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) 772# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) 773# else 774# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) 775# endif 776#endif 777 778#ifndef _LIBCPP_PREFERRED_OVERLOAD 779# if __has_attribute(__enable_if__) 780# define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) 781# endif 782#endif 783 784#ifndef _LIBCPP_HAS_NO_NOEXCEPT 785# define _NOEXCEPT noexcept 786# define _NOEXCEPT_(x) noexcept(x) 787#else 788# define _NOEXCEPT throw() 789# define _NOEXCEPT_(x) 790#endif 791 792#if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS) 793# if !defined(_LIBCPP_DEBUG) 794# error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined 795# endif 796# ifdef _LIBCPP_HAS_NO_NOEXCEPT 797# define _NOEXCEPT_DEBUG 798# define _NOEXCEPT_DEBUG_(x) 799# else 800# define _NOEXCEPT_DEBUG noexcept(false) 801# define _NOEXCEPT_DEBUG_(x) noexcept(false) 802#endif 803#else 804# define _NOEXCEPT_DEBUG _NOEXCEPT 805# define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) 806#endif 807 808#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS 809typedef unsigned short char16_t; 810typedef unsigned int char32_t; 811#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 812 813#ifndef __SIZEOF_INT128__ 814#define _LIBCPP_HAS_NO_INT128 815#endif 816 817#ifdef _LIBCPP_CXX03_LANG 818# if __has_extension(c_static_assert) 819# define static_assert(__b, __m) _Static_assert(__b, __m) 820# else 821extern "C++" { 822template <bool> struct __static_assert_test; 823template <> struct __static_assert_test<true> {}; 824template <unsigned> struct __static_assert_check {}; 825} 826#define static_assert(__b, __m) \ 827 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ 828 _LIBCPP_CONCAT(__t, __LINE__) 829# endif // __has_extension(c_static_assert) 830#endif // _LIBCPP_CXX03_LANG 831 832#ifdef _LIBCPP_HAS_NO_DECLTYPE 833// GCC 4.6 provides __decltype in all standard modes. 834#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 835# define decltype(__x) __decltype(__x) 836#else 837# define decltype(__x) __typeof__(__x) 838#endif 839#endif 840 841#ifdef _LIBCPP_HAS_NO_CONSTEXPR 842#define _LIBCPP_CONSTEXPR 843#else 844#define _LIBCPP_CONSTEXPR constexpr 845#endif 846 847#ifdef _LIBCPP_CXX03_LANG 848#define _LIBCPP_DEFAULT {} 849#else 850#define _LIBCPP_DEFAULT = default; 851#endif 852 853#ifdef _LIBCPP_CXX03_LANG 854#define _LIBCPP_EQUAL_DELETE 855#else 856#define _LIBCPP_EQUAL_DELETE = delete 857#endif 858 859#ifdef __GNUC__ 860#define _NOALIAS __attribute__((__malloc__)) 861#else 862#define _NOALIAS 863#endif 864 865#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \ 866 (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions 867# define _LIBCPP_EXPLICIT explicit 868#else 869# define _LIBCPP_EXPLICIT 870#endif 871 872#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) 873# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE 874#endif 875 876#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS 877#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx 878#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ 879 __lx __v_; \ 880 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ 881 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ 882 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ 883 }; 884#else // _LIBCPP_HAS_NO_STRONG_ENUMS 885#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x 886#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) 887#endif // _LIBCPP_HAS_NO_STRONG_ENUMS 888 889#ifdef _LIBCPP_DEBUG 890# if _LIBCPP_DEBUG == 0 891# define _LIBCPP_DEBUG_LEVEL 1 892# elif _LIBCPP_DEBUG == 1 893# define _LIBCPP_DEBUG_LEVEL 2 894# else 895# error Supported values for _LIBCPP_DEBUG are 0 and 1 896# endif 897# if !defined(_LIBCPP_BUILDING_LIBRARY) 898# define _LIBCPP_EXTERN_TEMPLATE(...) 899# endif 900#endif 901 902#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE 903#define _LIBCPP_EXTERN_TEMPLATE(...) 904#define _LIBCPP_EXTERN_TEMPLATE2(...) 905#endif 906 907#ifndef _LIBCPP_EXTERN_TEMPLATE 908#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; 909#endif 910 911#ifndef _LIBCPP_EXTERN_TEMPLATE2 912#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__; 913#endif 914 915#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) 916#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63) 917#endif 918 919#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \ 920 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) 921#define _LIBCPP_LOCALE__L_EXTENSIONS 1 922#endif 923 924#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) 925// Most unix variants have catopen. These are the specific ones that don't. 926#if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) 927#define _LIBCPP_HAS_CATOPEN 1 928#endif 929#endif 930 931#ifdef __FreeBSD__ 932#define _DECLARE_C99_LDBL_MATH 1 933#endif 934 935#if defined(__APPLE__) 936# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ 937 defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) 938# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 939# endif 940# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) 941# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 942# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION 943# endif 944# endif 945#endif // defined(__APPLE__) 946 947#if defined(__APPLE__) || defined(__FreeBSD__) 948#define _LIBCPP_HAS_DEFAULTRUNELOCALE 949#endif 950 951#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) 952#define _LIBCPP_WCTYPE_IS_MASK 953#endif 954 955#ifndef _LIBCPP_STD_VER 956# if __cplusplus <= 201103L 957# define _LIBCPP_STD_VER 11 958# elif __cplusplus <= 201402L 959# define _LIBCPP_STD_VER 14 960# elif __cplusplus <= 201703L 961# define _LIBCPP_STD_VER 17 962# else 963# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification 964# endif 965#endif // _LIBCPP_STD_VER 966 967#if _LIBCPP_STD_VER > 11 968#define _LIBCPP_DEPRECATED [[deprecated]] 969#else 970#define _LIBCPP_DEPRECATED 971#endif 972 973#if _LIBCPP_STD_VER <= 11 974#define _LIBCPP_EXPLICIT_AFTER_CXX11 975#define _LIBCPP_DEPRECATED_AFTER_CXX11 976#else 977#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit 978#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] 979#endif 980 981#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) 982#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr 983#else 984#define _LIBCPP_CONSTEXPR_AFTER_CXX11 985#endif 986 987#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) 988#define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr 989#else 990#define _LIBCPP_CONSTEXPR_AFTER_CXX14 991#endif 992 993#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) 994#define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr 995#else 996#define _LIBCPP_CONSTEXPR_AFTER_CXX17 997#endif 998 999#if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) 1000#define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]] 1001#else 1002#define _LIBCPP_NODISCARD_AFTER_CXX17 1003#endif 1004 1005#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) 1006# define _LIBCPP_INLINE_VAR inline 1007#else 1008# define _LIBCPP_INLINE_VAR 1009#endif 1010 1011#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1012# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) 1013#else 1014# define _LIBCPP_EXPLICIT_MOVE(x) (x) 1015#endif 1016 1017#ifndef _LIBCPP_HAS_NO_ASAN 1018_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( 1019 const void *, const void *, const void *, const void *); 1020#endif 1021 1022// Try to find out if RTTI is disabled. 1023// g++ and cl.exe have RTTI on by default and define a macro when it is. 1024// g++ only defines the macro in 4.3.2 and onwards. 1025#if !defined(_LIBCPP_NO_RTTI) 1026# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ 1027 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) 1028# define _LIBCPP_NO_RTTI 1029# elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) 1030# define _LIBCPP_NO_RTTI 1031# endif 1032#endif 1033 1034#ifndef _LIBCPP_WEAK 1035# define _LIBCPP_WEAK __attribute__((__weak__)) 1036#endif 1037 1038// Thread API 1039#if !defined(_LIBCPP_HAS_NO_THREADS) && \ 1040 !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ 1041 !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ 1042 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) 1043# if defined(__FreeBSD__) || \ 1044 defined(__Fuchsia__) || \ 1045 defined(__NetBSD__) || \ 1046 defined(__linux__) || \ 1047 defined(__APPLE__) || \ 1048 defined(__CloudABI__) || \ 1049 defined(__sun__) || \ 1050 (defined(__MINGW32__) && __libcpp_has_include(<pthread.h>)) 1051# define _LIBCPP_HAS_THREAD_API_PTHREAD 1052# elif defined(_LIBCPP_WIN32API) 1053# define _LIBCPP_HAS_THREAD_API_WIN32 1054# else 1055# error "No thread API" 1056# endif // _LIBCPP_HAS_THREAD_API 1057#endif // _LIBCPP_HAS_NO_THREADS 1058 1059#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) 1060# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ 1061 _LIBCPP_HAS_NO_THREADS is not defined. 1062#endif 1063 1064#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) 1065# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ 1066 _LIBCPP_HAS_NO_THREADS is defined. 1067#endif 1068 1069#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) 1070# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ 1071 _LIBCPP_HAS_NO_THREADS is defined. 1072#endif 1073 1074// Systems that use capability-based security (FreeBSD with Capsicum, 1075// Nuxi CloudABI) may only provide local filesystem access (using *at()). 1076// Functions like open(), rename(), unlink() and stat() should not be 1077// used, as they attempt to access the global filesystem namespace. 1078#ifdef __CloudABI__ 1079#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE 1080#endif 1081 1082// CloudABI is intended for running networked services. Processes do not 1083// have standard input and output channels. 1084#ifdef __CloudABI__ 1085#define _LIBCPP_HAS_NO_STDIN 1086#define _LIBCPP_HAS_NO_STDOUT 1087#endif 1088 1089#if defined(__BIONIC__) || defined(__CloudABI__) || \ 1090 defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC) 1091#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE 1092#endif 1093 1094// Thread-unsafe functions such as strtok() and localtime() 1095// are not available. 1096#ifdef __CloudABI__ 1097#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS 1098#endif 1099 1100#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) 1101#define _LIBCPP_HAS_C_ATOMIC_IMP 1102#elif _GNUC_VER > 407 1103#define _LIBCPP_HAS_GCC_ATOMIC_IMP 1104#endif 1105 1106#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ 1107 || defined(_LIBCPP_HAS_NO_THREADS) 1108#define _LIBCPP_HAS_NO_ATOMIC_HEADER 1109#endif 1110 1111#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK 1112#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK 1113#endif 1114 1115#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) 1116#if defined(__clang__) && __has_attribute(acquire_capability) 1117// Work around the attribute handling in clang. When both __declspec and 1118// __attribute__ are present, the processing goes awry preventing the definition 1119// of the types. 1120#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) 1121#define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS 1122#endif 1123#endif 1124#endif 1125 1126#if __has_attribute(require_constant_initialization) 1127#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) 1128#else 1129#define _LIBCPP_SAFE_STATIC 1130#endif 1131 1132#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 1133# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF 1134#endif 1135 1136#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) 1137#if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION) 1138#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS 1139#endif 1140#endif 1141 1142#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) 1143# define _LIBCPP_DIAGNOSE_WARNING(...) \ 1144 __attribute__((diagnose_if(__VA_ARGS__, "warning"))) 1145# define _LIBCPP_DIAGNOSE_ERROR(...) \ 1146 __attribute__((diagnose_if(__VA_ARGS__, "error"))) 1147#else 1148# define _LIBCPP_DIAGNOSE_WARNING(...) 1149# define _LIBCPP_DIAGNOSE_ERROR(...) 1150#endif 1151 1152#if __has_attribute(fallthough) || _GNUC_VER >= 700 1153// Use a function like macro to imply that it must be followed by a semicolon 1154#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) 1155#else 1156#define _LIBCPP_FALLTHROUGH() ((void)0) 1157#endif 1158 1159#if defined(_LIBCPP_ABI_MICROSOFT) && \ 1160 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) 1161# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) 1162#else 1163# define _LIBCPP_DECLSPEC_EMPTY_BASES 1164#endif 1165 1166#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) 1167# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR 1168# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS 1169# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE 1170# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS 1171#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES 1172 1173#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 1174# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES 1175#endif 1176 1177#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) 1178# define _LIBCPP_HAS_NO_IS_AGGREGATE 1179#endif 1180 1181#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L 1182# define _LIBCPP_HAS_NO_COROUTINES 1183#endif 1184 1185// Decide whether to use availability macros. 1186#if !defined(_LIBCPP_BUILDING_LIBRARY) && \ 1187 !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ 1188 __has_feature(attribute_availability_with_strict) && \ 1189 __has_feature(attribute_availability_in_templates) 1190#ifdef __APPLE__ 1191#define _LIBCPP_USE_AVAILABILITY_APPLE 1192#endif 1193#endif 1194 1195// Define availability macros. 1196#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) 1197#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ 1198 __attribute__((availability(macosx,strict,introduced=10.12))) \ 1199 __attribute__((availability(ios,strict,introduced=10.0))) \ 1200 __attribute__((availability(tvos,strict,introduced=10.0))) \ 1201 __attribute__((availability(watchos,strict,introduced=3.0))) 1202#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable)) 1203#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable)) 1204#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable)) 1205#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ 1206 __attribute__((availability(macosx,strict,introduced=10.12))) \ 1207 __attribute__((availability(ios,strict,introduced=10.0))) \ 1208 __attribute__((availability(tvos,strict,introduced=10.0))) \ 1209 __attribute__((availability(watchos,strict,introduced=3.0))) 1210#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ 1211 __attribute__((availability(macosx,strict,introduced=10.12))) \ 1212 __attribute__((availability(ios,strict,introduced=10.0))) \ 1213 __attribute__((availability(tvos,strict,introduced=10.0))) \ 1214 __attribute__((availability(watchos,strict,introduced=3.0))) 1215#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ 1216 __attribute__((availability(ios,strict,introduced=6.0))) 1217#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ 1218 __attribute__((availability(macosx,strict,introduced=10.9))) \ 1219 __attribute__((availability(ios,strict,introduced=7.0))) 1220#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ 1221 __attribute__((availability(macosx,strict,introduced=10.9))) \ 1222 __attribute__((availability(ios,strict,introduced=7.0))) 1223#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ 1224 __attribute__((availability(macosx,strict,introduced=10.9))) \ 1225 __attribute__((availability(ios,strict,introduced=7.0))) 1226#else 1227#define _LIBCPP_AVAILABILITY_SHARED_MUTEX 1228#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS 1229#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH 1230#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST 1231#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS 1232#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE 1233#define _LIBCPP_AVAILABILITY_FUTURE_ERROR 1234#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE 1235#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY 1236#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR 1237#endif 1238 1239// Define availability that depends on _LIBCPP_NO_EXCEPTIONS. 1240#ifdef _LIBCPP_NO_EXCEPTIONS 1241#define _LIBCPP_AVAILABILITY_DYNARRAY 1242#define _LIBCPP_AVAILABILITY_FUTURE 1243#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST 1244#else 1245#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH 1246#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR 1247#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \ 1248 _LIBCPP_AVAILABILITY_BAD_ANY_CAST 1249#endif 1250 1251// Availability of stream API in the dylib got dropped and re-added. The 1252// extern template should effectively be available at: 1253// availability(macosx,introduced=10.9) 1254// availability(ios,introduced=7.0) 1255#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \ 1256 ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ 1257 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \ 1258 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \ 1259 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000)) 1260#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE 1261#endif 1262 1263#if defined(_LIBCPP_COMPILER_IBM) 1264#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO 1265#endif 1266 1267#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) 1268# define _LIBCPP_PUSH_MACROS 1269# define _LIBCPP_POP_MACROS 1270#else 1271 // Don't warn about macro conflicts when we can restore them at the 1272 // end of the header. 1273# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS 1274# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS 1275# endif 1276# if defined(_LIBCPP_COMPILER_MSVC) 1277# define _LIBCPP_PUSH_MACROS \ 1278 __pragma(push_macro("min")) \ 1279 __pragma(push_macro("max")) 1280# define _LIBCPP_POP_MACROS \ 1281 __pragma(pop_macro("min")) \ 1282 __pragma(pop_macro("max")) 1283# else 1284# define _LIBCPP_PUSH_MACROS \ 1285 _Pragma("push_macro(\"min\")") \ 1286 _Pragma("push_macro(\"max\")") 1287# define _LIBCPP_POP_MACROS \ 1288 _Pragma("pop_macro(\"min\")") \ 1289 _Pragma("pop_macro(\"max\")") 1290# endif 1291#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) 1292 1293#ifndef _LIBCPP_NO_AUTO_LINK 1294# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) 1295# if defined(_DLL) 1296# pragma comment(lib, "c++.lib") 1297# else 1298# pragma comment(lib, "libc++.lib") 1299# endif 1300# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) 1301#endif // _LIBCPP_NO_AUTO_LINK 1302 1303#endif // __cplusplus 1304 1305#endif // _LIBCPP_CONFIG 1306