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