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