Debian Codegraph @

libstdc++-v3/include/bits/c++config

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