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