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#pragma GCC system_header 16#endif 17 18#ifdef __GNUC__ 19#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) 20#else 21#define _GNUC_VER 0 22#endif 23 24#define _LIBCPP_VERSION 3800 25 26#ifndef _LIBCPP_ABI_VERSION 27#define _LIBCPP_ABI_VERSION 1 28#endif 29 30#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 31#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 32#endif 33 34#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y 35#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) 36 37#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) 38 39 40#ifndef __has_attribute 41#define __has_attribute(__x) 0 42#endif 43#ifndef __has_builtin 44#define __has_builtin(__x) 0 45#endif 46#ifndef __has_extension 47#define __has_extension(__x) 0 48#endif 49#ifndef __has_feature 50#define __has_feature(__x) 0 51#endif 52// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by 53// the compiler and '1' otherwise. 54#ifndef __is_identifier 55#define __is_identifier(__x) 1 56#endif 57 58 59#ifdef __LITTLE_ENDIAN__ 60#if __LITTLE_ENDIAN__ 61#define _LIBCPP_LITTLE_ENDIAN 1 62#define _LIBCPP_BIG_ENDIAN 0 63#endif // __LITTLE_ENDIAN__ 64#endif // __LITTLE_ENDIAN__ 65 66#ifdef __BIG_ENDIAN__ 67#if __BIG_ENDIAN__ 68#define _LIBCPP_LITTLE_ENDIAN 0 69#define _LIBCPP_BIG_ENDIAN 1 70#endif // __BIG_ENDIAN__ 71#endif // __BIG_ENDIAN__ 72 73#ifdef __BYTE_ORDER__ 74#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 75#define _LIBCPP_LITTLE_ENDIAN 1 76#define _LIBCPP_BIG_ENDIAN 0 77#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 78#define _LIBCPP_LITTLE_ENDIAN 0 79#define _LIBCPP_BIG_ENDIAN 1 80#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 81#endif // __BYTE_ORDER__ 82 83#ifdef __FreeBSD__ 84# include <sys/endian.h> 85# if _BYTE_ORDER == _LITTLE_ENDIAN 86# define _LIBCPP_LITTLE_ENDIAN 1 87# define _LIBCPP_BIG_ENDIAN 0 88# else // _BYTE_ORDER == _LITTLE_ENDIAN 89# define _LIBCPP_LITTLE_ENDIAN 0 90# define _LIBCPP_BIG_ENDIAN 1 91# endif // _BYTE_ORDER == _LITTLE_ENDIAN 92# ifndef __LONG_LONG_SUPPORTED 93# define _LIBCPP_HAS_NO_LONG_LONG 94# endif // __LONG_LONG_SUPPORTED 95#endif // __FreeBSD__ 96 97#ifdef __NetBSD__ 98# include <sys/endian.h> 99# if _BYTE_ORDER == _LITTLE_ENDIAN 100# define _LIBCPP_LITTLE_ENDIAN 1 101# define _LIBCPP_BIG_ENDIAN 0 102# else // _BYTE_ORDER == _LITTLE_ENDIAN 103# define _LIBCPP_LITTLE_ENDIAN 0 104# define _LIBCPP_BIG_ENDIAN 1 105# endif // _BYTE_ORDER == _LITTLE_ENDIAN 106# define _LIBCPP_HAS_QUICK_EXIT 107#endif // __NetBSD__ 108 109#ifdef _WIN32 110# define _LIBCPP_LITTLE_ENDIAN 1 111# define _LIBCPP_BIG_ENDIAN 0 112// Compiler intrinsics (MSVC) 113#if defined(_MSC_VER) && _MSC_VER >= 1400 114# define _LIBCPP_HAS_IS_BASE_OF 115# endif 116# if defined(_MSC_VER) && !defined(__clang__) 117# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler 118# define _LIBCPP_TOSTRING2(x) #x 119# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) 120# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) 121# endif 122# // If mingw not explicitly detected, assume using MS C runtime only. 123# ifndef __MINGW32__ 124# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library 125# endif 126#endif // _WIN32 127 128#ifdef __sun__ 129# include <sys/isa_defs.h> 130# ifdef _LITTLE_ENDIAN 131# define _LIBCPP_LITTLE_ENDIAN 1 132# define _LIBCPP_BIG_ENDIAN 0 133# else 134# define _LIBCPP_LITTLE_ENDIAN 0 135# define _LIBCPP_BIG_ENDIAN 1 136# endif 137#endif // __sun__ 138 139#if defined(__CloudABI__) 140 // Certain architectures provide arc4random(). Prefer using 141 // arc4random() over /dev/{u,}random to make it possible to obtain 142 // random data even when using sandboxing mechanisms such as chroots, 143 // Capsicum, etc. 144# define _LIBCPP_USING_ARC4_RANDOM 145#elif defined(__native_client__) 146 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, 147 // including accesses to the special files under /dev. C++11's 148 // std::random_device is instead exposed through a NaCl syscall. 149# define _LIBCPP_USING_NACL_RANDOM 150#elif defined(_WIN32) 151# define _LIBCPP_USING_WIN32_RANDOM 152#else 153# define _LIBCPP_USING_DEV_RANDOM 154#endif 155 156#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) 157# include <endian.h> 158# if __BYTE_ORDER == __LITTLE_ENDIAN 159# define _LIBCPP_LITTLE_ENDIAN 1 160# define _LIBCPP_BIG_ENDIAN 0 161# elif __BYTE_ORDER == __BIG_ENDIAN 162# define _LIBCPP_LITTLE_ENDIAN 0 163# define _LIBCPP_BIG_ENDIAN 1 164# else // __BYTE_ORDER == __BIG_ENDIAN 165# error unable to determine endian 166# endif 167#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) 168 169#ifdef _WIN32 170 171// only really useful for a DLL 172#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally... 173# ifdef cxx_EXPORTS 174# define _LIBCPP_HIDDEN 175# define _LIBCPP_FUNC_VIS __declspec(dllexport) 176# define _LIBCPP_TYPE_VIS __declspec(dllexport) 177# else 178# define _LIBCPP_HIDDEN 179# define _LIBCPP_FUNC_VIS __declspec(dllimport) 180# define _LIBCPP_TYPE_VIS __declspec(dllimport) 181# endif 182#else 183# define _LIBCPP_HIDDEN 184# define _LIBCPP_FUNC_VIS 185# define _LIBCPP_TYPE_VIS 186#endif 187 188#define _LIBCPP_TYPE_VIS_ONLY 189#define _LIBCPP_FUNC_VIS_ONLY 190 191#ifndef _LIBCPP_INLINE_VISIBILITY 192# ifdef _LIBCPP_MSVC 193# define _LIBCPP_INLINE_VISIBILITY __forceinline 194# else // MinGW GCC and Clang 195# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) 196# endif 197#endif 198 199#ifndef _LIBCPP_EXCEPTION_ABI 200#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS 201#endif 202 203#ifndef _LIBCPP_ALWAYS_INLINE 204# ifdef _LIBCPP_MSVC 205# define _LIBCPP_ALWAYS_INLINE __forceinline 206# endif 207#endif 208 209#endif // _WIN32 210 211#ifndef _LIBCPP_HIDDEN 212#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) 213#endif 214 215#ifndef _LIBCPP_FUNC_VIS 216#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) 217#endif 218 219#ifndef _LIBCPP_TYPE_VIS 220# if __has_attribute(__type_visibility__) 221# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) 222# else 223# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) 224# endif 225#endif 226 227#ifndef _LIBCPP_TYPE_VIS_ONLY 228# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS 229#endif 230 231#ifndef _LIBCPP_FUNC_VIS_ONLY 232# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS 233#endif 234 235#ifndef _LIBCPP_INLINE_VISIBILITY 236#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) 237#endif 238 239#ifndef _LIBCPP_EXCEPTION_ABI 240#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) 241#endif 242 243#ifndef _LIBCPP_ALWAYS_INLINE 244#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) 245#endif 246 247#if defined(__clang__) 248 249// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for 250// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. 251#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ 252 !defined(__arm__)) || \ 253 defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) 254#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT 255#endif 256 257#if __has_feature(cxx_alignas) 258# define _ALIGNAS_TYPE(x) alignas(x) 259# define _ALIGNAS(x) alignas(x) 260#else 261# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 262# define _ALIGNAS(x) __attribute__((__aligned__(x))) 263#endif 264 265#if !__has_feature(cxx_alias_templates) 266#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 267#endif 268 269#if __cplusplus < 201103L 270typedef __char16_t char16_t; 271typedef __char32_t char32_t; 272#endif 273 274#if !(__has_feature(cxx_exceptions)) 275#define _LIBCPP_NO_EXCEPTIONS 276#endif 277 278#if !(__has_feature(cxx_rtti)) 279#define _LIBCPP_NO_RTTI 280#endif 281 282#if !(__has_feature(cxx_strong_enums)) 283#define _LIBCPP_HAS_NO_STRONG_ENUMS 284#endif 285 286#if !(__has_feature(cxx_decltype)) 287#define _LIBCPP_HAS_NO_DECLTYPE 288#endif 289 290#if __has_feature(cxx_attributes) 291# define _LIBCPP_NORETURN [[noreturn]] 292#else 293# define _LIBCPP_NORETURN __attribute__ ((noreturn)) 294#endif 295 296#define _LIBCPP_UNUSED __attribute__((__unused__)) 297 298#if !(__has_feature(cxx_defaulted_functions)) 299#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 300#endif // !(__has_feature(cxx_defaulted_functions)) 301 302#if !(__has_feature(cxx_deleted_functions)) 303#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 304#endif // !(__has_feature(cxx_deleted_functions)) 305 306#if !(__has_feature(cxx_lambdas)) 307#define _LIBCPP_HAS_NO_LAMBDAS 308#endif 309 310#if !(__has_feature(cxx_nullptr)) 311#define _LIBCPP_HAS_NO_NULLPTR 312#endif 313 314#if !(__has_feature(cxx_rvalue_references)) 315#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 316#endif 317 318#if !(__has_feature(cxx_static_assert)) 319#define _LIBCPP_HAS_NO_STATIC_ASSERT 320#endif 321 322#if !(__has_feature(cxx_auto_type)) 323#define _LIBCPP_HAS_NO_AUTO_TYPE 324#endif 325 326#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return) 327#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 328#endif 329 330#if !(__has_feature(cxx_variadic_templates)) 331#define _LIBCPP_HAS_NO_VARIADICS 332#endif 333 334#if !(__has_feature(cxx_trailing_return)) 335#define _LIBCPP_HAS_NO_TRAILING_RETURN 336#endif 337 338#if !(__has_feature(cxx_generalized_initializers)) 339#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 340#endif 341 342#if __has_feature(is_base_of) 343# define _LIBCPP_HAS_IS_BASE_OF 344#endif 345 346#if __has_feature(is_final) 347# define _LIBCPP_HAS_IS_FINAL 348#endif 349 350// Objective-C++ features (opt-in) 351#if __has_feature(objc_arc) 352#define _LIBCPP_HAS_OBJC_ARC 353#endif 354 355#if __has_feature(objc_arc_weak) 356#define _LIBCPP_HAS_OBJC_ARC_WEAK 357#define _LIBCPP_HAS_NO_STRONG_ENUMS 358#endif 359 360#if !(__has_feature(cxx_constexpr)) 361#define _LIBCPP_HAS_NO_CONSTEXPR 362#endif 363 364#if !(__has_feature(cxx_relaxed_constexpr)) 365#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR 366#endif 367 368#if !(__has_feature(cxx_variable_templates)) 369#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 370#endif 371 372#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L 373#if defined(__FreeBSD__) 374#define _LIBCPP_HAS_QUICK_EXIT 375#define _LIBCPP_HAS_C11_FEATURES 376#elif defined(__ANDROID__) 377#define _LIBCPP_HAS_QUICK_EXIT 378#elif defined(__linux__) 379#include <features.h> 380#if __GLIBC_PREREQ(2, 15) 381#define _LIBCPP_HAS_QUICK_EXIT 382#endif 383#if __GLIBC_PREREQ(2, 17) 384#define _LIBCPP_HAS_C11_FEATURES 385#endif 386#endif 387#endif 388 389#if (__has_feature(cxx_noexcept)) 390# define _NOEXCEPT noexcept 391# define _NOEXCEPT_(x) noexcept(x) 392# define _NOEXCEPT_OR_FALSE(x) noexcept(x) 393#else 394# define _NOEXCEPT throw() 395# define _NOEXCEPT_(x) 396# define _NOEXCEPT_OR_FALSE(x) false 397#endif 398 399#if __has_feature(underlying_type) 400# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) 401#endif 402 403#if __has_feature(is_literal) 404# define _LIBCPP_IS_LITERAL(T) __is_literal(T) 405#endif 406 407// Inline namespaces are available in Clang regardless of C++ dialect. 408#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { 409#define _LIBCPP_END_NAMESPACE_STD } } 410#define _VSTD std::_LIBCPP_NAMESPACE 411 412namespace std { 413 inline namespace _LIBCPP_NAMESPACE { 414 } 415} 416 417#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) 418#define _LIBCPP_HAS_NO_ASAN 419#endif 420 421#elif defined(__GNUC__) 422 423#define _ALIGNAS(x) __attribute__((__aligned__(x))) 424#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 425 426#define _LIBCPP_NORETURN __attribute__((noreturn)) 427 428#define _LIBCPP_UNUSED __attribute__((__unused__)) 429 430#if _GNUC_VER >= 407 431#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) 432#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) 433#define _LIBCPP_HAS_IS_FINAL 434#endif 435 436#if defined(__GNUC__) && _GNUC_VER >= 403 437# define _LIBCPP_HAS_IS_BASE_OF 438#endif 439 440#if !__EXCEPTIONS 441#define _LIBCPP_NO_EXCEPTIONS 442#endif 443 444#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 445 446// constexpr was added to GCC in 4.6. 447#if _GNUC_VER < 406 448#define _LIBCPP_HAS_NO_CONSTEXPR 449// Can only use constexpr in c++11 mode. 450#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L 451#define _LIBCPP_HAS_NO_CONSTEXPR 452#endif 453 454// Determine if GCC supports relaxed constexpr 455#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L 456#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR 457#endif 458 459// GCC 5 will support variable templates 460#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 461 462#define _NOEXCEPT throw() 463#define _NOEXCEPT_(x) 464#define _NOEXCEPT_OR_FALSE(x) false 465 466#ifndef __GXX_EXPERIMENTAL_CXX0X__ 467 468#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 469#define _LIBCPP_HAS_NO_DECLTYPE 470#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 471#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 472#define _LIBCPP_HAS_NO_NULLPTR 473#define _LIBCPP_HAS_NO_STATIC_ASSERT 474#define _LIBCPP_HAS_NO_UNICODE_CHARS 475#define _LIBCPP_HAS_NO_VARIADICS 476#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 477#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 478#define _LIBCPP_HAS_NO_STRONG_ENUMS 479 480#else // __GXX_EXPERIMENTAL_CXX0X__ 481 482#define _LIBCPP_HAS_NO_TRAILING_RETURN 483#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 484 485#if _GNUC_VER < 403 486#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 487#endif 488 489#if _GNUC_VER < 403 490#define _LIBCPP_HAS_NO_STATIC_ASSERT 491#endif 492 493#if _GNUC_VER < 404 494#define _LIBCPP_HAS_NO_DECLTYPE 495#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 496#define _LIBCPP_HAS_NO_UNICODE_CHARS 497#define _LIBCPP_HAS_NO_VARIADICS 498#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 499#endif // _GNUC_VER < 404 500 501#if _GNUC_VER < 406 502#define _LIBCPP_HAS_NO_NULLPTR 503#endif 504 505#if _GNUC_VER < 407 506#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 507#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 508#endif 509 510#endif // __GXX_EXPERIMENTAL_CXX0X__ 511 512#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { 513#define _LIBCPP_END_NAMESPACE_STD } } 514#define _VSTD std::_LIBCPP_NAMESPACE 515 516namespace std { 517namespace _LIBCPP_NAMESPACE { 518} 519using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); 520} 521 522#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) 523#define _LIBCPP_HAS_NO_ASAN 524#endif 525 526#elif defined(_LIBCPP_MSVC) 527 528#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 529#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 530#define _LIBCPP_HAS_NO_CONSTEXPR 531#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR 532#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 533#define _LIBCPP_HAS_NO_UNICODE_CHARS 534#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 535#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 536#define __alignof__ __alignof 537#define _LIBCPP_NORETURN __declspec(noreturn) 538#define _LIBCPP_UNUSED 539#define _ALIGNAS(x) __declspec(align(x)) 540#define _LIBCPP_HAS_NO_VARIADICS 541 542#define _NOEXCEPT throw () 543#define _NOEXCEPT_(x) 544#define _NOEXCEPT_OR_FALSE(x) false 545 546#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { 547#define _LIBCPP_END_NAMESPACE_STD } 548#define _VSTD std 549 550# define _LIBCPP_WEAK 551namespace std { 552} 553 554#define _LIBCPP_HAS_NO_ASAN 555 556#elif defined(__IBMCPP__) 557 558#define _ALIGNAS(x) __attribute__((__aligned__(x))) 559#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) 560#define _ATTRIBUTE(x) __attribute__((x)) 561#define _LIBCPP_NORETURN __attribute__((noreturn)) 562#define _LIBCPP_UNUSED 563 564#define _NOEXCEPT throw() 565#define _NOEXCEPT_(x) 566#define _NOEXCEPT_OR_FALSE(x) false 567 568#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 569#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 570#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 571#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 572#define _LIBCPP_HAS_NO_NULLPTR 573#define _LIBCPP_HAS_NO_UNICODE_CHARS 574#define _LIBCPP_HAS_IS_BASE_OF 575#define _LIBCPP_HAS_IS_FINAL 576#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 577 578#if defined(_AIX) 579#define __MULTILOCALE_API 580#endif 581 582#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { 583#define _LIBCPP_END_NAMESPACE_STD } } 584#define _VSTD std::_LIBCPP_NAMESPACE 585 586namespace std { 587 inline namespace _LIBCPP_NAMESPACE { 588 } 589} 590 591#define _LIBCPP_HAS_NO_ASAN 592 593#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ 594 595#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS 596typedef unsigned short char16_t; 597typedef unsigned int char32_t; 598#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 599 600#ifndef __SIZEOF_INT128__ 601#define _LIBCPP_HAS_NO_INT128 602#endif 603 604#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT 605 606extern "C++" { 607template <bool> struct __static_assert_test; 608template <> struct __static_assert_test<true> {}; 609template <unsigned> struct __static_assert_check {}; 610} 611#define static_assert(__b, __m) \ 612 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ 613 _LIBCPP_CONCAT(__t, __LINE__) 614 615#endif // _LIBCPP_HAS_NO_STATIC_ASSERT 616 617#ifdef _LIBCPP_HAS_NO_DECLTYPE 618// GCC 4.6 provides __decltype in all standard modes. 619#if !__is_identifier(__decltype) || _GNUC_VER >= 406 620# define decltype(__x) __decltype(__x) 621#else 622# define decltype(__x) __typeof__(__x) 623#endif 624#endif 625 626#ifdef _LIBCPP_HAS_NO_CONSTEXPR 627#define _LIBCPP_CONSTEXPR 628#else 629#define _LIBCPP_CONSTEXPR constexpr 630#endif 631 632#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 633#define _LIBCPP_DEFAULT {} 634#else 635#define _LIBCPP_DEFAULT = default; 636#endif 637 638#ifdef __GNUC__ 639#define _NOALIAS __attribute__((__malloc__)) 640#else 641#define _NOALIAS 642#endif 643 644#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) 645# define _LIBCPP_EXPLICIT explicit 646#else 647# define _LIBCPP_EXPLICIT 648#endif 649 650#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) 651# define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE 652#endif 653 654#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS 655#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx 656#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ 657 __lx __v_; \ 658 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ 659 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ 660 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ 661 }; 662#else // _LIBCPP_HAS_NO_STRONG_ENUMS 663#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x 664#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) 665#endif // _LIBCPP_HAS_NO_STRONG_ENUMS 666 667#ifdef _LIBCPP_DEBUG 668# if _LIBCPP_DEBUG == 0 669# define _LIBCPP_DEBUG_LEVEL 1 670# elif _LIBCPP_DEBUG == 1 671# define _LIBCPP_DEBUG_LEVEL 2 672# else 673# error Supported values for _LIBCPP_DEBUG are 0 and 1 674# endif 675# define _LIBCPP_EXTERN_TEMPLATE(...) 676#endif 677 678#ifndef _LIBCPP_EXTERN_TEMPLATE 679#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; 680#endif 681 682#ifndef _LIBCPP_EXTERN_TEMPLATE2 683#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__; 684#endif 685 686#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) 687#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63) 688#endif 689 690#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \ 691 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) 692#define _LIBCPP_LOCALE__L_EXTENSIONS 1 693#endif 694 695#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \ 696 !defined(__CloudABI__) 697#define _LIBCPP_HAS_CATOPEN 1 698#endif 699 700#ifdef __FreeBSD__ 701#define _DECLARE_C99_LDBL_MATH 1 702#endif 703 704#if defined(__APPLE__) || defined(__FreeBSD__) 705#define _LIBCPP_HAS_DEFAULTRUNELOCALE 706#endif 707 708#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) 709#define _LIBCPP_WCTYPE_IS_MASK 710#endif 711 712#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 713# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1 714#endif 715 716#ifndef _LIBCPP_STD_VER 717# if __cplusplus <= 201103L 718# define _LIBCPP_STD_VER 11 719# elif __cplusplus <= 201402L 720# define _LIBCPP_STD_VER 14 721# else 722# define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification 723# endif 724#endif // _LIBCPP_STD_VER 725 726#if _LIBCPP_STD_VER > 11 727#define _LIBCPP_DEPRECATED [[deprecated]] 728#else 729#define _LIBCPP_DEPRECATED 730#endif 731 732#if _LIBCPP_STD_VER <= 11 733#define _LIBCPP_EXPLICIT_AFTER_CXX11 734#define _LIBCPP_DEPRECATED_AFTER_CXX11 735#else 736#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit 737#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] 738#endif 739 740#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) 741#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr 742#else 743#define _LIBCPP_CONSTEXPR_AFTER_CXX11 744#endif 745 746#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES 747# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) 748#else 749# define _LIBCPP_EXPLICIT_MOVE(x) (x) 750#endif 751 752#ifndef _LIBCPP_HAS_NO_ASAN 753extern "C" void __sanitizer_annotate_contiguous_container( 754 const void *, const void *, const void *, const void *); 755#endif 756 757// Try to find out if RTTI is disabled. 758// g++ and cl.exe have RTTI on by default and define a macro when it is. 759// g++ only defines the macro in 4.3.2 and onwards. 760#if !defined(_LIBCPP_NO_RTTI) 761# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ 762 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) 763# define _LIBCPP_NO_RTTI 764# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI) 765# define _LIBCPP_NO_RTTI 766# endif 767#endif 768 769#ifndef _LIBCPP_WEAK 770# define _LIBCPP_WEAK __attribute__((__weak__)) 771#endif 772 773#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) 774# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ 775 _LIBCPP_HAS_NO_THREADS is defined. 776#endif 777 778// Systems that use capability-based security (FreeBSD with Capsicum, 779// Nuxi CloudABI) may only provide local filesystem access (using *at()). 780// Functions like open(), rename(), unlink() and stat() should not be 781// used, as they attempt to access the global filesystem namespace. 782#ifdef __CloudABI__ 783#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE 784#endif 785 786// CloudABI is intended for running networked services. Processes do not 787// have standard input and output channels. 788#ifdef __CloudABI__ 789#define _LIBCPP_HAS_NO_STDIN 790#define _LIBCPP_HAS_NO_STDOUT 791#endif 792 793#if defined(__ANDROID__) || defined(__CloudABI__) 794#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE 795#endif 796 797// Thread-unsafe functions such as strtok(), mbtowc() and localtime() 798// are not available. 799#ifdef __CloudABI__ 800#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS 801#endif 802 803#if __has_feature(cxx_atomic) || __has_extension(c_atomic) 804#define _LIBCPP_HAS_C_ATOMIC_IMP 805#elif _GNUC_VER > 407 806#define _LIBCPP_HAS_GCC_ATOMIC_IMP 807#endif 808 809#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ 810 || defined(_LIBCPP_HAS_NO_THREADS) 811#define _LIBCPP_HAS_NO_ATOMIC_HEADER 812#endif 813 814#endif // _LIBCPP_CONFIG 815