libstdc++: Make __gnu_debug::vector usable in constant expressions [PR109536]
[official-gcc.git] / libstdc++-v3 / include / bits / c++config
blob96cda086a4def3c2f7077772357f7a0f8b64c73c
1 // Predefined symbols and macros -*- C++ -*-
3 // Copyright (C) 1997-2023 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.
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.
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.
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/>.
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  */
30 #ifndef _GLIBCXX_CXX_CONFIG_H
31 #define _GLIBCXX_CXX_CONFIG_H 1
33 #pragma GCC system_header
35 // The major release number for the GCC release the C++ library belongs to.
36 #define _GLIBCXX_RELEASE
38 // The datestamp of the C++ library in compressed ISO date format.
39 #define __GLIBCXX__
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
51 #ifndef _GLIBCXX_CONST
52 # define _GLIBCXX_CONST __attribute__ ((__const__))
53 #endif
55 #ifndef _GLIBCXX_NORETURN
56 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
57 #endif
59 // See below for C++
60 #ifndef _GLIBCXX_NOTHROW
61 # ifndef __cplusplus
62 #  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
63 # endif
64 #endif
66 // Macros for visibility attributes.
67 //   _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
68 //   _GLIBCXX_VISIBILITY
69 #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
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
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
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
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
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
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
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
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
146 // Macros for ABI tag attributes.
147 #ifndef _GLIBCXX_ABI_TAG_CXX11
148 # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11")))
149 #endif
151 // Macro to warn about unused results.
152 #if __cplusplus >= 201703L
153 # define _GLIBCXX_NODISCARD [[__nodiscard__]]
154 #else
155 # define _GLIBCXX_NODISCARD
156 #endif
160 #if __cplusplus
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
173 #ifndef _GLIBCXX14_CONSTEXPR
174 # if __cplusplus >= 201402L
175 #  define _GLIBCXX14_CONSTEXPR constexpr
176 # else
177 #  define _GLIBCXX14_CONSTEXPR
178 # endif
179 #endif
181 #ifndef _GLIBCXX17_CONSTEXPR
182 # if __cplusplus >= 201703L
183 #  define _GLIBCXX17_CONSTEXPR constexpr
184 # else
185 #  define _GLIBCXX17_CONSTEXPR
186 # endif
187 #endif
189 #ifndef _GLIBCXX20_CONSTEXPR
190 # if __cplusplus >= 202002L
191 #  define _GLIBCXX20_CONSTEXPR constexpr
192 # else
193 #  define _GLIBCXX20_CONSTEXPR
194 # endif
195 #endif
197 #ifndef _GLIBCXX23_CONSTEXPR
198 # if __cplusplus >= 202100L
199 #  define _GLIBCXX23_CONSTEXPR constexpr
200 # else
201 #  define _GLIBCXX23_CONSTEXPR
202 # endif
203 #endif
205 #ifndef _GLIBCXX17_INLINE
206 # if __cplusplus >= 201703L
207 #  define _GLIBCXX17_INLINE inline
208 # else
209 #  define _GLIBCXX17_INLINE
210 # endif
211 #endif
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
228 #ifndef _GLIBCXX_NOTHROW
229 # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT
230 #endif
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
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
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
261   Outline of libstdc++ namespaces.
263   namespace std
264   {
265     namespace __debug { }
266     namespace __parallel { }
267     namespace __cxx1998 { }
269     namespace __detail {
270       namespace __variant { }                           // C++17
271     }
273     namespace rel_ops { }
275     namespace tr1
276     {
277       namespace placeholders { }
278       namespace regex_constants { }
279       namespace __detail { }
280     }
282     namespace tr2 { }
283     
284     namespace decimal { }
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   }
298   namespace abi { }
300   namespace __gnu_cxx
301   {
302     namespace __detail { }
303   }
305   For full details see:
306   http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
308 namespace std
310   typedef __SIZE_TYPE__         size_t;
311   typedef __PTRDIFF_TYPE__      ptrdiff_t;
313 #if __cplusplus >= 201103L
314   typedef decltype(nullptr)     nullptr_t;
315 #endif
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
329 #define _GLIBCXX_USE_DUAL_ABI
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
336 #ifndef _GLIBCXX_USE_CXX11_ABI
337 #define _GLIBCXX_USE_CXX11_ABI
338 #endif
340 #if _GLIBCXX_USE_CXX11_ABI
341 namespace std
343   inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
345 namespace __gnu_cxx
347   inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }
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
360 // Non-zero if inline namespaces are used for versioning the entire library.
361 #define _GLIBCXX_INLINE_VERSION 
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)
371 namespace std
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
387 namespace __gnu_cxx
389 inline _GLIBCXX_BEGIN_NAMESPACE_VERSION
390 _GLIBCXX_END_NAMESPACE_VERSION
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
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
409 // Inline namespaces for special modes: debug, parallel.
410 #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL)
411 namespace std
413 _GLIBCXX_BEGIN_NAMESPACE_VERSION
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   }
423 _GLIBCXX_END_NAMESPACE_VERSION
425   // Inline namespace for debug mode.
426 # ifdef _GLIBCXX_DEBUG
427   inline namespace __debug { }
428 # endif
430   // Inline namespaces for parallel mode.
431 # ifdef _GLIBCXX_PARALLEL
432   inline namespace __parallel { }
433 # endif
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
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
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
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
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
480 // GLIBCXX_ABI Deprecated
481 // Define if compatibility should be provided for -mlong-double-64.
482 #undef _GLIBCXX_LONG_DOUBLE_COMPAT
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
490 // Inline namespaces for long double 128 modes.
491 #if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \
492   && defined __LONG_DOUBLE_IEEE128__
493 namespace std
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 { }
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 }
506 #else // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128
508 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
509 namespace std
511   inline namespace __gnu_cxx_ldbl128 { }
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
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
532 #endif // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128
534 namespace std
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
558 // Debug Mode implies checking assertions.
559 #if defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_ASSERTIONS)
560 # define _GLIBCXX_ASSERTIONS 1
561 #endif
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
569 #undef _GLIBCXX_VERBOSE_ASSERT
571 // Assert.
572 #ifdef _GLIBCXX_VERBOSE_ASSERT
573 namespace std
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
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
592 #if defined(_GLIBCXX_ASSERTIONS)
593 // Enable runtime assertion checks, and also check in constant expressions.
594 # define __glibcxx_assert(cond)                                         \
595   do {                                                                  \
596     if (__builtin_expect(!bool(cond), false))                           \
597       _GLIBCXX_ASSERT_FAIL(cond);                                       \
598   } while (false)
599 #elif _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
600 // Only check assertions during constant evaluation.
601 namespace std
603   __attribute__((__always_inline__,__visibility__("default")))
604   inline void
605   __glibcxx_assert_fail()
606   { }
608 # define __glibcxx_assert(cond)                                         \
609   do {                                                                  \
610     if (std::__is_constant_evaluated())                                 \
611       if (__builtin_expect(!bool(cond), false))                         \
612         std::__glibcxx_assert_fail();                                   \
613   } while (false)
614 #else
615 // Don't check any assertions.
616 # define __glibcxx_assert(cond)
617 #endif
619 // Macro indicating that TSAN is in use.
620 #if __SANITIZE_THREAD__
621 #  define _GLIBCXX_TSAN 1
622 #elif defined __has_feature
623 # if __has_feature(thread_sanitizer)
624 #  define _GLIBCXX_TSAN 1
625 # endif
626 #endif
628 // Macros for race detectors.
629 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
630 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
631 // atomic (lock-free) synchronization to race detectors:
632 // the race detector will infer a happens-before arc from the former to the
633 // latter when they share the same argument pointer.
635 // The most frequent use case for these macros (and the only case in the
636 // current implementation of the library) is atomic reference counting:
637 //   void _M_remove_reference()
638 //   {
639 //     _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
640 //     if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
641 //       {
642 //         _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
643 //         _M_destroy(__a);
644 //       }
645 //   }
646 // The annotations in this example tell the race detector that all memory
647 // accesses occurred when the refcount was positive do not race with
648 // memory accesses which occurred after the refcount became zero.
649 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
650 # define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
651 #endif
652 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
653 # define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
654 #endif
656 // Macros for C linkage: define extern "C" linkage only when using C++.
657 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
658 # define _GLIBCXX_END_EXTERN_C }
660 #define _GLIBCXX_USE_ALLOCATOR_NEW
662 #ifdef __SIZEOF_INT128__
663 #if ! defined __GLIBCXX_TYPE_INT_N_0 && ! defined __STRICT_ANSI__
664 // If __int128 is supported, we expect __GLIBCXX_TYPE_INT_N_0 to be defined
665 // unless the compiler is in strict mode. If it's not defined and the strict
666 // macro is not defined, something is wrong.
667 #warning "__STRICT_ANSI__ seems to have been undefined; this is not supported"
668 #endif
669 #endif
671 #else // !__cplusplus
672 # define _GLIBCXX_BEGIN_EXTERN_C
673 # define _GLIBCXX_END_EXTERN_C
674 #endif
677 // First includes.
679 // Pick up any OS-specific definitions.
680 #include <bits/os_defines.h>
682 // Pick up any CPU-specific definitions.
683 #include <bits/cpu_defines.h>
685 // If platform uses neither visibility nor psuedo-visibility,
686 // specify empty default for namespace annotation macros.
687 #ifndef _GLIBCXX_PSEUDO_VISIBILITY
688 # define _GLIBCXX_PSEUDO_VISIBILITY(V)
689 #endif
691 // Certain function definitions that are meant to be overridable from
692 // user code are decorated with this macro.  For some targets, this
693 // macro causes these definitions to be weak.
694 #ifndef _GLIBCXX_WEAK_DEFINITION
695 # define _GLIBCXX_WEAK_DEFINITION
696 #endif
698 // By default, we assume that __GXX_WEAK__ also means that there is support
699 // for declaring functions as weak while not defining such functions.  This
700 // allows for referring to functions provided by other libraries (e.g.,
701 // libitm) without depending on them if the respective features are not used.
702 #ifndef _GLIBCXX_USE_WEAK_REF
703 # define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__
704 #endif
706 // Conditionally enable annotations for the Transactional Memory TS on C++11.
707 // Most of the following conditions are due to limitations in the current
708 // implementation.
709 #if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI                    \
710   && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201500L     \
711   &&  !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF           \
712   && _GLIBCXX_USE_ALLOCATOR_NEW
713 #define _GLIBCXX_TXN_SAFE transaction_safe
714 #define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic
715 #else
716 #define _GLIBCXX_TXN_SAFE
717 #define _GLIBCXX_TXN_SAFE_DYN
718 #endif
720 #if __cplusplus > 201402L
721 // In C++17 mathematical special functions are in namespace std.
722 # define _GLIBCXX_USE_STD_SPEC_FUNCS 1
723 #elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
724 // For C++11 and C++14 they are in namespace std when requested.
725 # define _GLIBCXX_USE_STD_SPEC_FUNCS 1
726 #endif
728 // The remainder of the prewritten config is automatic; all the
729 // user hooks are listed above.
731 // Create a boolean flag to be used to determine if --fast-math is set.
732 #ifdef __FAST_MATH__
733 # define _GLIBCXX_FAST_MATH 1
734 #else
735 # define _GLIBCXX_FAST_MATH 0
736 #endif
738 // This marks string literals in header files to be extracted for eventual
739 // translation.  It is primarily used for messages in thrown exceptions; see
740 // src/functexcept.cc.  We use __N because the more traditional _N is used
741 // for something else under certain OSes (see BADNAMES).
742 #define __N(msgid)     (msgid)
744 // For example, <windows.h> is known to #define min and max as macros...
745 #undef min
746 #undef max
748 // N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally
749 // so they should be tested with #if not with #ifdef.
750 #if __cplusplus >= 201103L
751 # ifndef _GLIBCXX_USE_C99_MATH
752 #  define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH
753 # endif
754 # ifndef _GLIBCXX_USE_C99_COMPLEX
755 # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX
756 # endif
757 # ifndef _GLIBCXX_USE_C99_STDIO
758 # define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO
759 # endif
760 # ifndef _GLIBCXX_USE_C99_STDLIB
761 # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB
762 # endif
763 # ifndef _GLIBCXX_USE_C99_WCHAR
764 # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR
765 # endif
766 #else
767 # ifndef _GLIBCXX_USE_C99_MATH
768 #  define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH
769 # endif
770 # ifndef _GLIBCXX_USE_C99_COMPLEX
771 # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX
772 # endif
773 # ifndef _GLIBCXX_USE_C99_STDIO
774 # define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO
775 # endif
776 # ifndef _GLIBCXX_USE_C99_STDLIB
777 # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB
778 # endif
779 # ifndef _GLIBCXX_USE_C99_WCHAR
780 # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR
781 # endif
782 #endif
784 // Unless explicitly specified, enable char8_t extensions only if the core
785 // language char8_t feature macro is defined.
786 #ifndef _GLIBCXX_USE_CHAR8_T
787 # ifdef __cpp_char8_t
788 #  define _GLIBCXX_USE_CHAR8_T 1
789 # endif
790 #endif
791 #ifdef _GLIBCXX_USE_CHAR8_T
792 # define __cpp_lib_char8_t 201907L
793 #endif
795 /* Define if __float128 is supported on this host.  */
796 #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
797 /* For powerpc64 don't use __float128 when it's the same type as long double. */
798 # if !(defined(_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT) && defined(__LONG_DOUBLE_IEEE128__))
799 #  define _GLIBCXX_USE_FLOAT128
800 # endif
801 #endif
803 // Define if float has the IEEE binary32 format.
804 #if __FLT_MANT_DIG__ == 24 \
805   && __FLT_MIN_EXP__ == -125 \
806   && __FLT_MAX_EXP__ == 128
807 # define _GLIBCXX_FLOAT_IS_IEEE_BINARY32 1
808 #endif
810 // Define if double has the IEEE binary64 format.
811 #if __DBL_MANT_DIG__ == 53 \
812   && __DBL_MIN_EXP__ == -1021 \
813   && __DBL_MAX_EXP__ == 1024
814 # define _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 1
815 #endif
817 // Define if long double has the IEEE binary128 format.
818 #if __LDBL_MANT_DIG__ == 113 \
819   && __LDBL_MIN_EXP__ == -16381 \
820   && __LDBL_MAX_EXP__ == 16384
821 # define _GLIBCXX_LDOUBLE_IS_IEEE_BINARY128 1
822 #endif
824 #if defined __cplusplus && defined __BFLT16_DIG__
825 namespace __gnu_cxx
827   typedef __decltype(0.0bf16) __bfloat16_t;
829 #endif
831 #ifdef __has_builtin
832 # ifdef __is_identifier
833 // Intel and older Clang require !__is_identifier for some built-ins:
834 #  define _GLIBCXX_HAS_BUILTIN(B) __has_builtin(B) || ! __is_identifier(B)
835 # else
836 #  define _GLIBCXX_HAS_BUILTIN(B) __has_builtin(B)
837 # endif
838 #endif
840 #if _GLIBCXX_HAS_BUILTIN(__has_unique_object_representations)
841 # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
842 #endif
844 #if _GLIBCXX_HAS_BUILTIN(__is_aggregate)
845 # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
846 #endif
848 #if _GLIBCXX_HAS_BUILTIN(__is_same)
849 #  define _GLIBCXX_HAVE_BUILTIN_IS_SAME 1
850 #endif
852 #if _GLIBCXX_HAS_BUILTIN(__builtin_launder)
853 # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
854 #endif
856 // Returns 1 if _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS is not defined and the
857 // compiler has a corresponding built-in type trait, 0 otherwise.
858 // _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS can be defined to disable the use of
859 // built-in traits.
860 #ifndef _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS
861 # define _GLIBCXX_USE_BUILTIN_TRAIT(BT) _GLIBCXX_HAS_BUILTIN(BT)
862 #else
863 # define _GLIBCXX_USE_BUILTIN_TRAIT(BT) 0
864 #endif
866 // Mark code that should be ignored by the compiler, but seen by Doxygen.
867 #define _GLIBCXX_DOXYGEN_ONLY(X)
869 // PSTL configuration
871 #if __cplusplus >= 201703L
872 // This header is not installed for freestanding:
873 #if __has_include(<pstl/pstl_config.h>)
874 // Preserved here so we have some idea which version of upstream we've pulled in
875 // #define PSTL_VERSION 9000
877 // For now this defaults to being based on the presence of Thread Building Blocks
878 # ifndef _GLIBCXX_USE_TBB_PAR_BACKEND
879 #  define _GLIBCXX_USE_TBB_PAR_BACKEND __has_include(<tbb/tbb.h>)
880 # endif
881 // This section will need some rework when a new (default) backend type is added
882 # if _GLIBCXX_USE_TBB_PAR_BACKEND
883 #  define _PSTL_PAR_BACKEND_TBB
884 # else
885 #  define _PSTL_PAR_BACKEND_SERIAL
886 # endif
888 # define _PSTL_ASSERT(_Condition) __glibcxx_assert(_Condition)
889 # define _PSTL_ASSERT_MSG(_Condition, _Message) __glibcxx_assert(_Condition)
891 #include <pstl/pstl_config.h>
892 #endif // __has_include
893 #endif // C++17
895 // End of prewritten config; the settings discovered at configure time follow.