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