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