1 // Predefined symbols and macros -*- C++ -*- 2 3 // Copyright (C) 1997-2024 Free Software Foundation, Inc. 4 // 5 // This file is part of the GNU ISO C++ Library. This library is free 6 // software; you can redistribute it and/or modify it under the 7 // terms of the GNU General Public License as published by the 8 // Free Software Foundation; either version 3, or (at your option) 9 // any later version. 10 11 // This library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 16 // Under Section 7 of GPL version 3, you are granted additional 17 // permissions described in the GCC Runtime Library Exception, version 18 // 3.1, as published by the Free Software Foundation. 19 20 // You should have received a copy of the GNU General Public License and 21 // a copy of the GCC Runtime Library Exception along with this program; 22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 // <http://www.gnu.org/licenses/>. 24 25 /** @file bits/c++config.h 26 * This is an internal header file, included by other library headers. 27 * Do not attempt to use it directly. @headername{version} 28 */ 29 30 #ifndef _GLIBCXX_CXX_CONFIG_H 31 #define _GLIBCXX_CXX_CONFIG_H 1 32 33 #pragma GCC system_header 34 35 // The major release number for the GCC release the C++ library belongs to. 36 #define _GLIBCXX_RELEASE 37 38 // The datestamp of the C++ library in compressed ISO date format. 39 #define __GLIBCXX__ 40 41 // Macros for various attributes. 42 // _GLIBCXX_PURE 43 // _GLIBCXX_CONST 44 // _GLIBCXX_NORETURN 45 // _GLIBCXX_NOTHROW 46 // _GLIBCXX_VISIBILITY 47 #ifndef _GLIBCXX_PURE 48 # define _GLIBCXX_PURE __attribute__ ((__pure__)) 49 #endif 50 51 #ifndef _GLIBCXX_CONST 52 # define _GLIBCXX_CONST __attribute__ ((__const__)) 53 #endif 54 55 #ifndef _GLIBCXX_NORETURN 56 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) 57 #endif 58 59 // See below for C++ 60 #ifndef _GLIBCXX_NOTHROW 61 # ifndef __cplusplus 62 # define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) 63 # endif 64 #endif 65 66 // Macros for visibility attributes. 67 // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 68 // _GLIBCXX_VISIBILITY 69 #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 70 71 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 72 # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) 73 #else 74 // If this is not supplied by the OS-specific or CPU-specific 75 // headers included below, it will be defined to an empty default. 76 # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) 77 #endif 78 79 // Macros for deprecated attributes. 80 // _GLIBCXX_USE_DEPRECATED 81 // _GLIBCXX_DEPRECATED 82 // _GLIBCXX_DEPRECATED_SUGGEST( string-literal ) 83 // _GLIBCXX11_DEPRECATED 84 // _GLIBCXX11_DEPRECATED_SUGGEST( string-literal ) 85 // _GLIBCXX14_DEPRECATED 86 // _GLIBCXX14_DEPRECATED_SUGGEST( string-literal ) 87 // _GLIBCXX17_DEPRECATED 88 // _GLIBCXX17_DEPRECATED_SUGGEST( string-literal ) 89 // _GLIBCXX20_DEPRECATED 90 // _GLIBCXX20_DEPRECATED_SUGGEST( string-literal ) 91 // _GLIBCXX23_DEPRECATED 92 // _GLIBCXX23_DEPRECATED_SUGGEST( string-literal ) 93 #ifndef _GLIBCXX_USE_DEPRECATED 94 # define _GLIBCXX_USE_DEPRECATED 1 95 #endif 96 97 #if defined(__DEPRECATED) 98 # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) 99 # define _GLIBCXX_DEPRECATED_SUGGEST(ALT) \ 100 __attribute__ ((__deprecated__ ("use '" ALT "' instead"))) 101 #else 102 # define _GLIBCXX_DEPRECATED 103 # define _GLIBCXX_DEPRECATED_SUGGEST(ALT) 104 #endif 105 106 #if defined(__DEPRECATED) && (__cplusplus >= 201103L) 107 # define _GLIBCXX11_DEPRECATED _GLIBCXX_DEPRECATED 108 # define _GLIBCXX11_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) 109 #else 110 # define _GLIBCXX11_DEPRECATED 111 # define _GLIBCXX11_DEPRECATED_SUGGEST(ALT) 112 #endif 113 114 #if defined(__DEPRECATED) && (__cplusplus >= 201402L) 115 # define _GLIBCXX14_DEPRECATED _GLIBCXX_DEPRECATED 116 # define _GLIBCXX14_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) 117 #else 118 # define _GLIBCXX14_DEPRECATED 119 # define _GLIBCXX14_DEPRECATED_SUGGEST(ALT) 120 #endif 121 122 #if defined(__DEPRECATED) && (__cplusplus >= 201703L) 123 # define _GLIBCXX17_DEPRECATED [[__deprecated__]] 124 # define _GLIBCXX17_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) 125 #else 126 # define _GLIBCXX17_DEPRECATED 127 # define _GLIBCXX17_DEPRECATED_SUGGEST(ALT) 128 #endif 129 130 #if defined(__DEPRECATED) && (__cplusplus >= 202002L) 131 # define _GLIBCXX20_DEPRECATED [[__deprecated__]] 132 # define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) 133 #else 134 # define _GLIBCXX20_DEPRECATED 135 # define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) 136 #endif 137 138 #if defined(__DEPRECATED) && (__cplusplus >= 202100L) 139 # define _GLIBCXX23_DEPRECATED [[__deprecated__]] 140 # define _GLIBCXX23_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) 141 #else 142 # define _GLIBCXX23_DEPRECATED 143 # define _GLIBCXX23_DEPRECATED_SUGGEST(ALT) 144 #endif 145 146 // Macros for ABI tag attributes. 147 #ifndef _GLIBCXX_ABI_TAG_CXX11 148 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) 149 #endif 150 151 // Macro to warn about unused results. 152 #if __cplusplus >= 201703L 153 # define _GLIBCXX_NODISCARD [[__nodiscard__]] 154 #else 155 # define _GLIBCXX_NODISCARD 156 #endif 157 158 159 160 #if __cplusplus 161 162 // Macro for constexpr, to support in mixed 03/0x mode. 163 #ifndef _GLIBCXX_CONSTEXPR 164 # if __cplusplus >= 201103L 165 # define _GLIBCXX_CONSTEXPR constexpr 166 # define _GLIBCXX_USE_CONSTEXPR constexpr 167 # else 168 # define _GLIBCXX_CONSTEXPR 169 # define _GLIBCXX_USE_CONSTEXPR const 170 # endif 171 #endif 172 173 #ifndef _GLIBCXX14_CONSTEXPR 174 # if __cplusplus >= 201402L 175 # define _GLIBCXX14_CONSTEXPR constexpr 176 # else 177 # define _GLIBCXX14_CONSTEXPR 178 # endif 179 #endif 180 181 #ifndef _GLIBCXX17_CONSTEXPR 182 # if __cplusplus >= 201703L 183 # define _GLIBCXX17_CONSTEXPR constexpr 184 # else 185 # define _GLIBCXX17_CONSTEXPR 186 # endif 187 #endif 188 189 #ifndef _GLIBCXX20_CONSTEXPR 190 # if __cplusplus >= 202002L 191 # define _GLIBCXX20_CONSTEXPR constexpr 192 # else 193 # define _GLIBCXX20_CONSTEXPR 194 # endif 195 #endif 196 197 #ifndef _GLIBCXX23_CONSTEXPR 198 # if __cplusplus >= 202100L 199 # define _GLIBCXX23_CONSTEXPR constexpr 200 # else 201 # define _GLIBCXX23_CONSTEXPR 202 # endif 203 #endif 204 205 #ifndef _GLIBCXX17_INLINE 206 # if __cplusplus >= 201703L 207 # define _GLIBCXX17_INLINE inline 208 # else 209 # define _GLIBCXX17_INLINE 210 # endif 211 #endif 212 213 // Macro for noexcept, to support in mixed 03/0x mode. 214 #ifndef _GLIBCXX_NOEXCEPT 215 # if __cplusplus >= 201103L 216 # define _GLIBCXX_NOEXCEPT noexcept 217 # define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__) 218 # define _GLIBCXX_USE_NOEXCEPT noexcept 219 # define _GLIBCXX_THROW(_EXC) 220 # else 221 # define _GLIBCXX_NOEXCEPT 222 # define _GLIBCXX_NOEXCEPT_IF(...) 223 # define _GLIBCXX_USE_NOEXCEPT throw() 224 # define _GLIBCXX_THROW(_EXC) throw(_EXC) 225 # endif 226 #endif 227 228 #ifndef _GLIBCXX_NOTHROW 229 # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT 230 #endif 231 232 #ifndef _GLIBCXX_THROW_OR_ABORT 233 # if __cpp_exceptions 234 # define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) 235 # else 236 # define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) 237 # endif 238 #endif 239 240 #if __cpp_noexcept_function_type 241 #define _GLIBCXX_NOEXCEPT_PARM , bool _NE 242 #define _GLIBCXX_NOEXCEPT_QUAL noexcept (_NE) 243 #else 244 #define _GLIBCXX_NOEXCEPT_PARM 245 #define _GLIBCXX_NOEXCEPT_QUAL 246 #endif 247 248 // Macro for extern template, ie controlling template linkage via use 249 // of extern keyword on template declaration. As documented in the g++ 250 // manual, it inhibits all implicit instantiations and is used 251 // throughout the library to avoid multiple weak definitions for 252 // required types that are already explicitly instantiated in the 253 // library binary. This substantially reduces the binary size of 254 // resulting executables. 255 // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern 256 // templates only in basic_string, thus activating its debug-mode 257 // checks even at -O0. 258 #define _GLIBCXX_EXTERN_TEMPLATE 259 260 /* 261 Outline of libstdc++ namespaces. 262 263 namespace std 264 { 265 namespace __debug { } 266 namespace __parallel { } 267 namespace __cxx1998 { } 268 269 namespace __detail { 270 namespace __variant { } // C++17 271 } 272 273 namespace rel_ops { } 274 275 namespace tr1 276 { 277 namespace placeholders { } 278 namespace regex_constants { } 279 namespace __detail { } 280 } 281 282 namespace tr2 { } 283 284 namespace decimal { } 285 286 namespace chrono { } // C++11 287 namespace placeholders { } // C++11 288 namespace regex_constants { } // C++11 289 namespace this_thread { } // C++11 290 inline namespace literals { // C++14 291 inline namespace chrono_literals { } // C++14 292 inline namespace complex_literals { } // C++14 293 inline namespace string_literals { } // C++14 294 inline namespace string_view_literals { } // C++17 295 } 296 } 297 298 namespace abi { } 299 300 namespace __gnu_cxx 301 { 302 namespace __detail { } 303 } 304 305 For full details see: 306 http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html 307 */ 308 namespace std 309 { 310 typedef __SIZE_TYPE__ size_t; 311 typedef __PTRDIFF_TYPE__ ptrdiff_t; 312 313 #if __cplusplus >= 201103L 314 typedef decltype(nullptr) nullptr_t; 315 #endif 316 317 #pragma GCC visibility push(default) 318 // This allows the library to terminate without including all of <exception> 319 // and without making the declaration of std::terminate visible to users. 320 extern "C++" __attribute__ ((__noreturn__, __always_inline__)) 321 inline void __terminate() _GLIBCXX_USE_NOEXCEPT 322 { 323 void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__,__cold__)); 324 terminate(); 325 } 326 #pragma GCC visibility pop 327 } 328 329 #define _GLIBCXX_USE_DUAL_ABI 330 331 #if ! _GLIBCXX_USE_DUAL_ABI 332 // Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI 333 # undef _GLIBCXX_USE_CXX11_ABI 334 #endif 335 336 #ifndef _GLIBCXX_USE_CXX11_ABI 337 #define _GLIBCXX_USE_CXX11_ABI 338 #endif 339 340 #if _GLIBCXX_USE_CXX11_ABI 341 namespace std 342 { 343 inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } 344 } 345 namespace __gnu_cxx 346 { 347 inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } 348 } 349 # define _GLIBCXX_NAMESPACE_CXX11 __cxx11:: 350 # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 { 351 # define _GLIBCXX_END_NAMESPACE_CXX11 } 352 # define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11 353 #else 354 # define _GLIBCXX_NAMESPACE_CXX11 355 # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 356 # define _GLIBCXX_END_NAMESPACE_CXX11 357 # define _GLIBCXX_DEFAULT_ABI_TAG 358 #endif 359 360 // Non-zero if inline namespaces are used for versioning the entire library. 361 #define _GLIBCXX_INLINE_VERSION 362 363 #if _GLIBCXX_INLINE_VERSION 364 // Inline namespace for symbol versioning of (nearly) everything in std. 365 # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 { 366 # define _GLIBCXX_END_NAMESPACE_VERSION } 367 // Unused when everything in std is versioned anyway. 368 # define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) 369 # define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) 370 371 namespace std 372 { 373 inline _GLIBCXX_BEGIN_NAMESPACE_VERSION 374 #if __cplusplus >= 201402L 375 inline namespace literals { 376 inline namespace chrono_literals { } 377 inline namespace complex_literals { } 378 inline namespace string_literals { } 379 #if __cplusplus > 201402L 380 inline namespace string_view_literals { } 381 #endif // C++17 382 } 383 #endif // C++14 384 _GLIBCXX_END_NAMESPACE_VERSION 385 } 386 387 namespace __gnu_cxx 388 { 389 inline _GLIBCXX_BEGIN_NAMESPACE_VERSION 390 _GLIBCXX_END_NAMESPACE_VERSION 391 } 392 393 #else 394 // Unused. 395 # define _GLIBCXX_BEGIN_NAMESPACE_VERSION 396 # define _GLIBCXX_END_NAMESPACE_VERSION 397 // Used to version individual components, e.g. std::_V2::error_category. 398 # define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) inline namespace X { 399 # define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) } // inline namespace X 400 #endif 401 402 // In the case that we don't have a hosted environment, we can't provide the 403 // debugging mode. Instead, we do our best and downgrade to assertions. 404 #if defined(_GLIBCXX_DEBUG) && !__STDC_HOSTED__ 405 #undef _GLIBCXX_DEBUG 406 #define _GLIBCXX_ASSERTIONS 1 407 #endif 408 409 // Inline namespaces for special modes: debug, parallel. 410 #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) 411 namespace std 412 { 413 _GLIBCXX_BEGIN_NAMESPACE_VERSION 414 415 // Non-inline namespace for components replaced by alternates in active mode. 416 namespace __cxx1998 417 { 418 # if _GLIBCXX_USE_CXX11_ABI 419 inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } 420 # endif 421 } 422 423 _GLIBCXX_END_NAMESPACE_VERSION 424 425 // Inline namespace for debug mode. 426 # ifdef _GLIBCXX_DEBUG 427 inline namespace __debug { } 428 # endif 429 430 // Inline namespaces for parallel mode. 431 # ifdef _GLIBCXX_PARALLEL 432 inline namespace __parallel { } 433 # endif 434 } 435 436 // Check for invalid usage and unsupported mixed-mode use. 437 # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) 438 # error illegal use of multiple inlined namespaces 439 # endif 440 441 // Check for invalid use due to lack for weak symbols. 442 # if __NO_INLINE__ && !__GXX_WEAK__ 443 # warning currently using inlined namespace mode which may fail \ 444 without inlining due to lack of weak symbols 445 # endif 446 #endif 447 448 // Macros for namespace scope. Either namespace std:: or the name 449 // of some nested namespace within it corresponding to the active mode. 450 // _GLIBCXX_STD_A 451 // _GLIBCXX_STD_C 452 // 453 // Macros for opening/closing conditional namespaces. 454 // _GLIBCXX_BEGIN_NAMESPACE_ALGO 455 // _GLIBCXX_END_NAMESPACE_ALGO 456 // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER 457 // _GLIBCXX_END_NAMESPACE_CONTAINER 458 #if defined(_GLIBCXX_DEBUG) 459 # define _GLIBCXX_STD_C __cxx1998 460 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ 461 namespace _GLIBCXX_STD_C { 462 # define _GLIBCXX_END_NAMESPACE_CONTAINER } 463 #else 464 # define _GLIBCXX_STD_C std 465 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER 466 # define _GLIBCXX_END_NAMESPACE_CONTAINER 467 #endif 468 469 #ifdef _GLIBCXX_PARALLEL 470 # define _GLIBCXX_STD_A __cxx1998 471 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ 472 namespace _GLIBCXX_STD_A { 473 # define _GLIBCXX_END_NAMESPACE_ALGO } 474 #else 475 # define _GLIBCXX_STD_A std 476 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO 477 # define _GLIBCXX_END_NAMESPACE_ALGO 478 #endif 479 480 // GLIBCXX_ABI Deprecated 481 // Define if compatibility should be provided for -mlong-double-64. 482 #undef _GLIBCXX_LONG_DOUBLE_COMPAT 483 484 // Define if compatibility should be provided for alternative 128-bit long 485 // double formats. Not possible for Clang until __ibm128 is supported. 486 #ifndef __clang__ 487 #undef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT 488 #endif 489 490 // Inline namespaces for long double 128 modes. 491 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ 492 && defined __LONG_DOUBLE_IEEE128__ 493 namespace std 494 { 495 // Namespaces for 128-bit IEEE long double format on 64-bit POWER LE. 496 inline namespace __gnu_cxx_ieee128 { } 497 inline namespace __gnu_cxx11_ieee128 { } 498 } 499 # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ieee128:: 500 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ieee128 { 501 # define _GLIBCXX_END_NAMESPACE_LDBL } 502 # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 __gnu_cxx11_ieee128:: 503 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 namespace __gnu_cxx11_ieee128 { 504 # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 } 505 506 #else // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128 507 508 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 509 namespace std 510 { 511 inline namespace __gnu_cxx_ldbl128 { } 512 } 513 # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: 514 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { 515 # define _GLIBCXX_END_NAMESPACE_LDBL } 516 #else 517 # define _GLIBCXX_NAMESPACE_LDBL 518 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL 519 # define _GLIBCXX_END_NAMESPACE_LDBL 520 #endif 521 522 #if _GLIBCXX_USE_CXX11_ABI 523 # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11 524 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11 525 # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 526 #else 527 # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL 528 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL 529 # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL 530 #endif 531 532 #endif // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128 533 534 namespace std 535 { 536 #pragma GCC visibility push(default) 537 // Internal version of std::is_constant_evaluated(). 538 // This can be used without checking if the compiler supports the feature. 539 // The macro _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED can be used to check if 540 // the compiler support is present to make this function work as expected. 541 __attribute__((__always_inline__)) 542 _GLIBCXX_CONSTEXPR inline bool 543 __is_constant_evaluated() _GLIBCXX_NOEXCEPT 544 { 545 #if __cpp_if_consteval >= 202106L 546 # define _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED 1 547 if consteval { return true; } else { return false; } 548 #elif __cplusplus >= 201103L && __has_builtin(__builtin_is_constant_evaluated) 549 # define _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED 1 550 return __builtin_is_constant_evaluated(); 551 #else 552 return false; 553 #endif 554 } 555 #pragma GCC visibility pop 556 } 557 558 // Debug Mode implies checking assertions. 559 #if defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_ASSERTIONS) 560 # define _GLIBCXX_ASSERTIONS 1 561 #endif 562 563 // Disable std::string explicit instantiation declarations in order to assert. 564 #ifdef _GLIBCXX_ASSERTIONS 565 # undef _GLIBCXX_EXTERN_TEMPLATE 566 # define _GLIBCXX_EXTERN_TEMPLATE -1 567 #endif 568 569 #undef _GLIBCXX_VERBOSE_ASSERT 570 571 // Assert. 572 #ifdef _GLIBCXX_VERBOSE_ASSERT 573 namespace std 574 { 575 #pragma GCC visibility push(default) 576 // Don't use <cassert> because this should be unaffected by NDEBUG. 577 extern "C++" _GLIBCXX_NORETURN 578 void 579 __glibcxx_assert_fail /* Called when a precondition violation is detected. */ 580 (const char* __file, int __line, const char* __function, 581 const char* __condition) 582 _GLIBCXX_NOEXCEPT; 583 #pragma GCC visibility pop 584 } 585 # define _GLIBCXX_ASSERT_FAIL(_Condition) \ 586 std::__glibcxx_assert_fail(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ 587 #_Condition) 588 #else // ! VERBOSE_ASSERT 589 # define _GLIBCXX_ASSERT_FAIL(_Condition) __builtin_abort() 590 #endif 591 592 #if defined(_GLIBCXX_ASSERTIONS) 593 // When _GLIBCXX_ASSERTIONS is defined we enable runtime assertion checks. 594 // These checks will also be done during constant evaluation. 595 # define __glibcxx_assert(cond) \ 596 do { \ 597 if (__builtin_expect(!bool(cond), false)) \ 598 _GLIBCXX_ASSERT_FAIL(cond); \ 599 } while (false) 600 #elif _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED 601 // _GLIBCXX_ASSERTIONS is not defined, so assertions checks are only enabled 602 // during constant evaluation. This ensures we diagnose undefined behaviour 603 // in constant expressions. 604 namespace std 605 { 606 __attribute__((__always_inline__,__visibility__("default"))) 607 inline void 608 __glibcxx_assert_fail() 609 { } 610 } 611 # define __glibcxx_assert(cond) \ 612 do { \ 613 if (std::__is_constant_evaluated() && !bool(cond)) \ 614 std::__glibcxx_assert_fail(); \ 615 } while (false) 616 #else 617 // _GLIBCXX_ASSERTIONS is not defined and __is_constant_evaluated() doesn't 618 // work so don't check any assertions. 619 # define __glibcxx_assert(cond) 620 #endif 621 622 // Macro indicating that TSAN is in use. 623 #if __SANITIZE_THREAD__ 624 # define _GLIBCXX_TSAN 1 625 #elif defined __has_feature 626 # if __has_feature(thread_sanitizer) 627 # define _GLIBCXX_TSAN 1 628 # endif 629 #endif 630 631 // Macros for race detectors. 632 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and 633 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain 634 // atomic (lock-free) synchronization to race detectors: 635 // the race detector will infer a happens-before arc from the former to the 636 // latter when they share the same argument pointer. 637 // 638 // The most frequent use case for these macros (and the only case in the 639 // current implementation of the library) is atomic reference counting: 640 // void _M_remove_reference() 641 // { 642 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); 643 // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) 644 // { 645 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); 646 // _M_destroy(__a); 647 // } 648 // } 649 // The annotations in this example tell the race detector that all memory 650 // accesses occurred when the refcount was positive do not race with 651 // memory accesses which occurred after the refcount became zero. 652 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE 653 # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) 654 #endif 655 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER 656 # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) 657 #endif 658 659 // Macros for C linkage: define extern "C" linkage only when using C++. 660 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { 661 # define _GLIBCXX_END_EXTERN_C } 662 663 #define _GLIBCXX_USE_ALLOCATOR_NEW 664 665 #ifdef __SIZEOF_INT128__ 666 #if ! defined __GLIBCXX_TYPE_INT_N_0 && ! defined __STRICT_ANSI__ 667 // If __int128 is supported, we expect __GLIBCXX_TYPE_INT_N_0 to be defined 668 // unless the compiler is in strict mode. If it's not defined and the strict 669 // macro is not defined, something is wrong. 670 #warning "__STRICT_ANSI__ seems to have been undefined; this is not supported" 671 #endif 672 #endif 673 674 #else // !__cplusplus 675 # define _GLIBCXX_BEGIN_EXTERN_C 676 # define _GLIBCXX_END_EXTERN_C 677 #endif 678 679 680 // First includes. 681 682 // Pick up any OS-specific definitions. 683 #include <bits/os_defines.h> 684 685 // Pick up any CPU-specific definitions. 686 #include <bits/cpu_defines.h> 687 688 // If platform uses neither visibility nor psuedo-visibility, 689 // specify empty default for namespace annotation macros. 690 #ifndef _GLIBCXX_PSEUDO_VISIBILITY 691 # define _GLIBCXX_PSEUDO_VISIBILITY(V) 692 #endif 693 694 // Certain function definitions that are meant to be overridable from 695 // user code are decorated with this macro. For some targets, this 696 // macro causes these definitions to be weak. 697 #ifndef _GLIBCXX_WEAK_DEFINITION 698 # define _GLIBCXX_WEAK_DEFINITION 699 #endif 700 701 // By default, we assume that __GXX_WEAK__ also means that there is support 702 // for declaring functions as weak while not defining such functions. This 703 // allows for referring to functions provided by other libraries (e.g., 704 // libitm) without depending on them if the respective features are not used. 705 #ifndef _GLIBCXX_USE_WEAK_REF 706 # define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__ 707 #endif 708 709 // Conditionally enable annotations for the Transactional Memory TS on C++11. 710 // Most of the following conditions are due to limitations in the current 711 // implementation. 712 #if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \ 713 && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201500L \ 714 && !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF \ 715 && _GLIBCXX_USE_ALLOCATOR_NEW 716 #define _GLIBCXX_TXN_SAFE transaction_safe 717 #define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic 718 #else 719 #define _GLIBCXX_TXN_SAFE 720 #define _GLIBCXX_TXN_SAFE_DYN 721 #endif 722 723 #if __cplusplus > 201402L 724 // In C++17 mathematical special functions are in namespace std. 725 # define _GLIBCXX_USE_STD_SPEC_FUNCS 1 726 #elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0 727 // For C++11 and C++14 they are in namespace std when requested. 728 # define _GLIBCXX_USE_STD_SPEC_FUNCS 1 729 #endif 730 731 // The remainder of the prewritten config is automatic; all the 732 // user hooks are listed above. 733 734 // Create a boolean flag to be used to determine if --fast-math is set. 735 #ifdef __FAST_MATH__ 736 # define _GLIBCXX_FAST_MATH 1 737 #else 738 # define _GLIBCXX_FAST_MATH 0 739 #endif 740 741 // This marks string literals in header files to be extracted for eventual 742 // translation. It is primarily used for messages in thrown exceptions; see 743 // src/functexcept.cc. We use __N because the more traditional _N is used 744 // for something else under certain OSes (see BADNAMES). 745 #define __N(msgid) (msgid) 746 747 // For example, <windows.h> is known to #define min and max as macros... 748 #undef min 749 #undef max 750 751 // N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally 752 // so they should be tested with #if not with #ifdef. 753 #if __cplusplus >= 201103L 754 # ifndef _GLIBCXX_USE_C99_MATH 755 # define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH 756 # endif 757 # ifndef _GLIBCXX_USE_C99_COMPLEX 758 # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX 759 # endif 760 # ifndef _GLIBCXX_USE_C99_STDIO 761 # define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO 762 # endif 763 # ifndef _GLIBCXX_USE_C99_STDLIB 764 # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB 765 # endif 766 # ifndef _GLIBCXX_USE_C99_WCHAR 767 # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR 768 # endif 769 #else 770 # ifndef _GLIBCXX_USE_C99_MATH 771 # define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH 772 # endif 773 # ifndef _GLIBCXX_USE_C99_COMPLEX 774 # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX 775 # endif 776 # ifndef _GLIBCXX_USE_C99_STDIO 777 # define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO 778 # endif 779 # ifndef _GLIBCXX_USE_C99_STDLIB 780 # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB 781 # endif 782 # ifndef _GLIBCXX_USE_C99_WCHAR 783 # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR 784 # endif 785 #endif 786 787 // Unless explicitly specified, enable char8_t extensions only if the core 788 // language char8_t feature macro is defined. 789 #ifndef _GLIBCXX_USE_CHAR8_T 790 # ifdef __cpp_char8_t 791 # define _GLIBCXX_USE_CHAR8_T 1 792 # endif 793 #endif 794 #ifdef _GLIBCXX_USE_CHAR8_T 795 # define __cpp_lib_char8_t 201907L 796 #endif 797 798 /* Define if __float128 is supported on this host. */ 799 #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) 800 /* For powerpc64 don't use __float128 when it's the same type as long double. */ 801 # if !(defined(_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT) && defined(__LONG_DOUBLE_IEEE128__)) 802 # define _GLIBCXX_USE_FLOAT128 803 # endif 804 #endif 805 806 // Define if float has the IEEE binary32 format. 807 #if __FLT_MANT_DIG__ == 24 \ 808 && __FLT_MIN_EXP__ == -125 \ 809 && __FLT_MAX_EXP__ == 128 810 # define _GLIBCXX_FLOAT_IS_IEEE_BINARY32 1 811 #endif 812 813 // Define if double has the IEEE binary64 format. 814 #if __DBL_MANT_DIG__ == 53 \ 815 && __DBL_MIN_EXP__ == -1021 \ 816 && __DBL_MAX_EXP__ == 1024 817 # define _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 1 818 #endif 819 820 // Define if long double has the IEEE binary128 format. 821 #if __LDBL_MANT_DIG__ == 113 \ 822 && __LDBL_MIN_EXP__ == -16381 \ 823 && __LDBL_MAX_EXP__ == 16384 824 # define _GLIBCXX_LDOUBLE_IS_IEEE_BINARY128 1 825 #endif 826 827 #if defined __cplusplus && defined __BFLT16_DIG__ 828 namespace __gnu_cxx 829 { 830 typedef __decltype(0.0bf16) __bfloat16_t; 831 } 832 #endif 833 834 #ifdef __has_builtin 835 # ifdef __is_identifier 836 // Intel and older Clang require !__is_identifier for some built-ins: 837 # define _GLIBCXX_HAS_BUILTIN(B) __has_builtin(B) || ! __is_identifier(B) 838 # else 839 # define _GLIBCXX_HAS_BUILTIN(B) __has_builtin(B) 840 # endif 841 #endif 842 843 #if _GLIBCXX_HAS_BUILTIN(__has_unique_object_representations) 844 # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 845 #endif 846 847 #if _GLIBCXX_HAS_BUILTIN(__is_aggregate) 848 # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 849 #endif 850 851 #if _GLIBCXX_HAS_BUILTIN(__builtin_launder) 852 # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 853 #endif 854 855 // Returns 1 if _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS is not defined and the 856 // compiler has a corresponding built-in type trait, 0 otherwise. 857 // _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS can be defined to disable the use of 858 // built-in traits. 859 #ifndef _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS 860 # define _GLIBCXX_USE_BUILTIN_TRAIT(BT) _GLIBCXX_HAS_BUILTIN(BT) 861 #else 862 # define _GLIBCXX_USE_BUILTIN_TRAIT(BT) 0 863 #endif 864 865 // Mark code that should be ignored by the compiler, but seen by Doxygen. 866 #define _GLIBCXX_DOXYGEN_ONLY(X) 867 868 // PSTL configuration 869 870 #if __cplusplus >= 201703L 871 // This header is not installed for freestanding: 872 #if __has_include(<pstl/pstl_config.h>) 873 // Preserved here so we have some idea which version of upstream we've pulled in 874 // #define PSTL_VERSION 9000 875 876 // For now this defaults to being based on the presence of Thread Building Blocks 877 # ifndef _GLIBCXX_USE_TBB_PAR_BACKEND 878 # define _GLIBCXX_USE_TBB_PAR_BACKEND __has_include(<tbb/tbb.h>) 879 # endif 880 // This section will need some rework when a new (default) backend type is added 881 # if _GLIBCXX_USE_TBB_PAR_BACKEND 882 # define _PSTL_PAR_BACKEND_TBB 883 # else 884 # define _PSTL_PAR_BACKEND_SERIAL 885 # endif 886 887 # define _PSTL_ASSERT(_Condition) __glibcxx_assert(_Condition) 888 # define _PSTL_ASSERT_MSG(_Condition, _Message) __glibcxx_assert(_Condition) 889 890 #include <pstl/pstl_config.h> 891 #endif // __has_include 892 #endif // C++17 893 894 // End of prewritten config; the settings discovered at configure time follow. 895