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