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