]>
Commit | Line | Data |
---|---|---|
de53cb75 | 1 | // Predefined symbols and macros -*- C++ -*- |
725dc051 | 2 | |
8d9254fc | 3 | // Copyright (C) 1997-2020 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 | |
8c05647c JW |
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. | |
7c3e9502 | 37 | #define __GLIBCXX__ |
285b36d6 | 38 | |
94a86be0 | 39 | // Macros for various attributes. |
12ffa228 BK |
40 | // _GLIBCXX_PURE |
41 | // _GLIBCXX_CONST | |
42 | // _GLIBCXX_NORETURN | |
43 | // _GLIBCXX_NOTHROW | |
44 | // _GLIBCXX_VISIBILITY | |
94a86be0 BK |
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 | ||
782378a6 | 57 | // See below for C++ |
94a86be0 | 58 | #ifndef _GLIBCXX_NOTHROW |
782378a6 | 59 | # ifndef __cplusplus |
94a86be0 BK |
60 | # define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) |
61 | # endif | |
62 | #endif | |
63 | ||
12ffa228 BK |
64 | // Macros for visibility attributes. |
65 | // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY | |
66 | // _GLIBCXX_VISIBILITY | |
98e615b4 BK |
67 | #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY |
68 | ||
69 | #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY | |
12ffa228 | 70 | # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) |
98e615b4 | 71 | #else |
f7e413e2 DK |
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. | |
12ffa228 | 74 | # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) |
98e615b4 BK |
75 | #endif |
76 | ||
12ffa228 | 77 | // Macros for deprecated attributes. |
e1bcd685 | 78 | // _GLIBCXX_USE_DEPRECATED |
12ffa228 | 79 | // _GLIBCXX_DEPRECATED |
f78958c9 | 80 | // _GLIBCXX17_DEPRECATED |
e1bcd685 BK |
81 | #ifndef _GLIBCXX_USE_DEPRECATED |
82 | # define _GLIBCXX_USE_DEPRECATED 1 | |
40abbf1f BK |
83 | #endif |
84 | ||
734f5023 | 85 | #if defined(__DEPRECATED) && (__cplusplus >= 201103L) |
e1bcd685 | 86 | # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) |
40abbf1f | 87 | #else |
e1bcd685 | 88 | # define _GLIBCXX_DEPRECATED |
40abbf1f BK |
89 | #endif |
90 | ||
f78958c9 JW |
91 | #if defined(__DEPRECATED) && (__cplusplus >= 201703L) |
92 | # define _GLIBCXX17_DEPRECATED [[__deprecated__]] | |
93 | #else | |
94 | # define _GLIBCXX17_DEPRECATED | |
95 | #endif | |
96 | ||
3b31a727 BK |
97 | // Macros for ABI tag attributes. |
98 | #ifndef _GLIBCXX_ABI_TAG_CXX11 | |
99 | # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) | |
100 | #endif | |
101 | ||
ec0d5371 UD |
102 | // Macro to warn about unused results. |
103 | #if __cplusplus >= 201703L | |
104 | # define _GLIBCXX_NODISCARD [[__nodiscard__]] | |
105 | #else | |
106 | # define _GLIBCXX_NODISCARD | |
107 | #endif | |
108 | ||
109 | ||
9f285ccb JM |
110 | |
111 | #if __cplusplus | |
be335b18 | 112 | |
94a86be0 BK |
113 | // Macro for constexpr, to support in mixed 03/0x mode. |
114 | #ifndef _GLIBCXX_CONSTEXPR | |
734f5023 | 115 | # if __cplusplus >= 201103L |
94a86be0 | 116 | # define _GLIBCXX_CONSTEXPR constexpr |
94a86be0 BK |
117 | # define _GLIBCXX_USE_CONSTEXPR constexpr |
118 | # else | |
7c3e9502 | 119 | # define _GLIBCXX_CONSTEXPR |
94a86be0 BK |
120 | # define _GLIBCXX_USE_CONSTEXPR const |
121 | # endif | |
be335b18 KS |
122 | #endif |
123 | ||
8dff34fe VV |
124 | #ifndef _GLIBCXX14_CONSTEXPR |
125 | # if __cplusplus >= 201402L | |
126 | # define _GLIBCXX14_CONSTEXPR constexpr | |
127 | # else | |
128 | # define _GLIBCXX14_CONSTEXPR | |
129 | # endif | |
130 | #endif | |
131 | ||
06db9920 | 132 | #ifndef _GLIBCXX17_CONSTEXPR |
3be9ded2 | 133 | # if __cplusplus >= 201703L |
06db9920 JW |
134 | # define _GLIBCXX17_CONSTEXPR constexpr |
135 | # else | |
136 | # define _GLIBCXX17_CONSTEXPR | |
137 | # endif | |
138 | #endif | |
139 | ||
3be9ded2 JW |
140 | #ifndef _GLIBCXX20_CONSTEXPR |
141 | # if __cplusplus > 201703L | |
142 | # define _GLIBCXX20_CONSTEXPR constexpr | |
143 | # else | |
144 | # define _GLIBCXX20_CONSTEXPR | |
145 | # endif | |
146 | #endif | |
147 | ||
288695f7 | 148 | #ifndef _GLIBCXX17_INLINE |
3be9ded2 | 149 | # if __cplusplus >= 201703L |
288695f7 DK |
150 | # define _GLIBCXX17_INLINE inline |
151 | # else | |
152 | # define _GLIBCXX17_INLINE | |
153 | # endif | |
154 | #endif | |
155 | ||
4d4cf144 PC |
156 | // Macro for noexcept, to support in mixed 03/0x mode. |
157 | #ifndef _GLIBCXX_NOEXCEPT | |
734f5023 | 158 | # if __cplusplus >= 201103L |
4d4cf144 | 159 | # define _GLIBCXX_NOEXCEPT noexcept |
315f8b5f | 160 | # define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__) |
4d4cf144 | 161 | # define _GLIBCXX_USE_NOEXCEPT noexcept |
578f0234 | 162 | # define _GLIBCXX_THROW(_EXC) |
4d4cf144 PC |
163 | # else |
164 | # define _GLIBCXX_NOEXCEPT | |
315f8b5f | 165 | # define _GLIBCXX_NOEXCEPT_IF(...) |
4d4cf144 | 166 | # define _GLIBCXX_USE_NOEXCEPT throw() |
578f0234 | 167 | # define _GLIBCXX_THROW(_EXC) throw(_EXC) |
4d4cf144 PC |
168 | # endif |
169 | #endif | |
170 | ||
782378a6 PC |
171 | #ifndef _GLIBCXX_NOTHROW |
172 | # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT | |
173 | #endif | |
174 | ||
54ba39f5 | 175 | #ifndef _GLIBCXX_THROW_OR_ABORT |
0f3d27f0 | 176 | # if __cpp_exceptions |
54ba39f5 PC |
177 | # define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) |
178 | # else | |
179 | # define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) | |
180 | # endif | |
181 | #endif | |
182 | ||
51dc6603 | 183 | #if __cpp_noexcept_function_type |
0a7577bb EB |
184 | #define _GLIBCXX_NOEXCEPT_PARM , bool _NE |
185 | #define _GLIBCXX_NOEXCEPT_QUAL noexcept (_NE) | |
51dc6603 JM |
186 | #else |
187 | #define _GLIBCXX_NOEXCEPT_PARM | |
188 | #define _GLIBCXX_NOEXCEPT_QUAL | |
189 | #endif | |
190 | ||
2f1e8e7c | 191 | // Macro for extern template, ie controlling template linkage via use |
12ffa228 BK |
192 | // of extern keyword on template declaration. As documented in the g++ |
193 | // manual, it inhibits all implicit instantiations and is used | |
194 | // throughout the library to avoid multiple weak definitions for | |
195 | // required types that are already explicitly instantiated in the | |
196 | // library binary. This substantially reduces the binary size of | |
197 | // resulting executables. | |
198 | // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern | |
199 | // templates only in basic_string, thus activating its debug-mode | |
200 | // checks even at -O0. | |
ed4f96af | 201 | #define _GLIBCXX_EXTERN_TEMPLATE |
40abbf1f | 202 | |
c2ba9709 | 203 | /* |
12ffa228 BK |
204 | Outline of libstdc++ namespaces. |
205 | ||
c2ba9709 JS |
206 | namespace std |
207 | { | |
208 | namespace __debug { } | |
209 | namespace __parallel { } | |
c2ba9709 JS |
210 | namespace __cxx1998 { } |
211 | ||
3e5fb20f JW |
212 | namespace __detail { |
213 | namespace __variant { } // C++17 | |
214 | } | |
12ffa228 BK |
215 | |
216 | namespace rel_ops { } | |
217 | ||
218 | namespace tr1 | |
219 | { | |
220 | namespace placeholders { } | |
221 | namespace regex_constants { } | |
222 | namespace __detail { } | |
223 | } | |
224 | ||
08624e90 BK |
225 | namespace tr2 { } |
226 | ||
12ffa228 BK |
227 | namespace decimal { } |
228 | ||
3e5fb20f JW |
229 | namespace chrono { } // C++11 |
230 | namespace placeholders { } // C++11 | |
231 | namespace regex_constants { } // C++11 | |
232 | namespace this_thread { } // C++11 | |
233 | inline namespace literals { // C++14 | |
234 | inline namespace chrono_literals { } // C++14 | |
235 | inline namespace complex_literals { } // C++14 | |
236 | inline namespace string_literals { } // C++14 | |
237 | inline namespace string_view_literals { } // C++17 | |
e347987d | 238 | } |
c2ba9709 | 239 | } |
c2ba9709 | 240 | |
12ffa228 | 241 | namespace abi { } |
3cbc7af0 | 242 | |
12ffa228 BK |
243 | namespace __gnu_cxx |
244 | { | |
245 | namespace __detail { } | |
246 | } | |
247 | ||
248 | For full details see: | |
249 | http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html | |
250 | */ | |
251 | namespace std | |
252 | { | |
253 | typedef __SIZE_TYPE__ size_t; | |
254 | typedef __PTRDIFF_TYPE__ ptrdiff_t; | |
c2ba9709 | 255 | |
734f5023 | 256 | #if __cplusplus >= 201103L |
12ffa228 | 257 | typedef decltype(nullptr) nullptr_t; |
1218d701 | 258 | #endif |
12ffa228 | 259 | } |
1218d701 | 260 | |
34a2b755 JW |
261 | #define _GLIBCXX_USE_DUAL_ABI |
262 | ||
263 | #if ! _GLIBCXX_USE_DUAL_ABI | |
264 | // Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI | |
265 | # undef _GLIBCXX_USE_CXX11_ABI | |
266 | #endif | |
267 | ||
375f837b JW |
268 | #ifndef _GLIBCXX_USE_CXX11_ABI |
269 | #define _GLIBCXX_USE_CXX11_ABI | |
270 | #endif | |
271 | ||
272 | #if _GLIBCXX_USE_CXX11_ABI | |
34a2b755 JW |
273 | namespace std |
274 | { | |
7cb73573 | 275 | inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } |
34a2b755 | 276 | } |
df6d9c7f JW |
277 | namespace __gnu_cxx |
278 | { | |
279 | inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } | |
280 | } | |
34a2b755 JW |
281 | # define _GLIBCXX_NAMESPACE_CXX11 __cxx11:: |
282 | # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 { | |
283 | # define _GLIBCXX_END_NAMESPACE_CXX11 } | |
375f837b JW |
284 | # define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11 |
285 | #else | |
34a2b755 JW |
286 | # define _GLIBCXX_NAMESPACE_CXX11 |
287 | # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 | |
288 | # define _GLIBCXX_END_NAMESPACE_CXX11 | |
375f837b JW |
289 | # define _GLIBCXX_DEFAULT_ABI_TAG |
290 | #endif | |
291 | ||
12ffa228 | 292 | // Defined if inline namespaces are used for versioning. |
2799d972 | 293 | #define _GLIBCXX_INLINE_VERSION |
3cbc7af0 | 294 | |
12ffa228 BK |
295 | // Inline namespace for symbol versioning. |
296 | #if _GLIBCXX_INLINE_VERSION | |
4a15d842 FD |
297 | # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 { |
298 | # define _GLIBCXX_END_NAMESPACE_VERSION } | |
2799d972 | 299 | |
12ffa228 BK |
300 | namespace std |
301 | { | |
4a15d842 | 302 | inline _GLIBCXX_BEGIN_NAMESPACE_VERSION |
3e5fb20f | 303 | #if __cplusplus >= 201402L |
e347987d | 304 | inline namespace literals { |
4a15d842 FD |
305 | inline namespace chrono_literals { } |
306 | inline namespace complex_literals { } | |
307 | inline namespace string_literals { } | |
3e5fb20f | 308 | #if __cplusplus > 201402L |
4a15d842 | 309 | inline namespace string_view_literals { } |
3e5fb20f | 310 | #endif // C++17 |
e347987d | 311 | } |
3e5fb20f | 312 | #endif // C++14 |
4a15d842 | 313 | _GLIBCXX_END_NAMESPACE_VERSION |
12ffa228 BK |
314 | } |
315 | ||
316 | namespace __gnu_cxx | |
317 | { | |
4a15d842 FD |
318 | inline _GLIBCXX_BEGIN_NAMESPACE_VERSION |
319 | _GLIBCXX_END_NAMESPACE_VERSION | |
12ffa228 | 320 | } |
4a15d842 | 321 | |
3cbc7af0 | 322 | #else |
12ffa228 BK |
323 | # define _GLIBCXX_BEGIN_NAMESPACE_VERSION |
324 | # define _GLIBCXX_END_NAMESPACE_VERSION | |
325 | #endif | |
c2ba9709 | 326 | |
544be2be JW |
327 | // Inline namespaces for special modes: debug, parallel. |
328 | #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) | |
12ffa228 BK |
329 | namespace std |
330 | { | |
4a15d842 FD |
331 | _GLIBCXX_BEGIN_NAMESPACE_VERSION |
332 | ||
12ffa228 BK |
333 | // Non-inline namespace for components replaced by alternates in active mode. |
334 | namespace __cxx1998 | |
335 | { | |
9836f82e | 336 | # if _GLIBCXX_USE_CXX11_ABI |
3a353ff5 | 337 | inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } |
9836f82e | 338 | # endif |
12ffa228 BK |
339 | } |
340 | ||
4a15d842 FD |
341 | _GLIBCXX_END_NAMESPACE_VERSION |
342 | ||
12ffa228 BK |
343 | // Inline namespace for debug mode. |
344 | # ifdef _GLIBCXX_DEBUG | |
345 | inline namespace __debug { } | |
c2ba9709 JS |
346 | # endif |
347 | ||
12ffa228 BK |
348 | // Inline namespaces for parallel mode. |
349 | # ifdef _GLIBCXX_PARALLEL | |
350 | inline namespace __parallel { } | |
c2ba9709 | 351 | # endif |
12ffa228 | 352 | } |
c2ba9709 | 353 | |
12ffa228 BK |
354 | // Check for invalid usage and unsupported mixed-mode use. |
355 | # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) | |
356 | # error illegal use of multiple inlined namespaces | |
357 | # endif | |
1218d701 | 358 | |
12ffa228 | 359 | // Check for invalid use due to lack for weak symbols. |
c2ba9709 | 360 | # if __NO_INLINE__ && !__GXX_WEAK__ |
7c3e9502 | 361 | # warning currently using inlined namespace mode which may fail \ |
c2ba9709 JS |
362 | without inlining due to lack of weak symbols |
363 | # endif | |
12ffa228 BK |
364 | #endif |
365 | ||
366 | // Macros for namespace scope. Either namespace std:: or the name | |
367 | // of some nested namespace within it corresponding to the active mode. | |
368 | // _GLIBCXX_STD_A | |
369 | // _GLIBCXX_STD_C | |
370 | // | |
371 | // Macros for opening/closing conditional namespaces. | |
372 | // _GLIBCXX_BEGIN_NAMESPACE_ALGO | |
373 | // _GLIBCXX_END_NAMESPACE_ALGO | |
374 | // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |
375 | // _GLIBCXX_END_NAMESPACE_CONTAINER | |
544be2be | 376 | #if defined(_GLIBCXX_DEBUG) |
12ffa228 BK |
377 | # define _GLIBCXX_STD_C __cxx1998 |
378 | # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ | |
4a15d842 FD |
379 | namespace _GLIBCXX_STD_C { |
380 | # define _GLIBCXX_END_NAMESPACE_CONTAINER } | |
35518d76 FD |
381 | #else |
382 | # define _GLIBCXX_STD_C std | |
4a15d842 FD |
383 | # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER |
384 | # define _GLIBCXX_END_NAMESPACE_CONTAINER | |
12ffa228 | 385 | #endif |
c2ba9709 | 386 | |
12ffa228 BK |
387 | #ifdef _GLIBCXX_PARALLEL |
388 | # define _GLIBCXX_STD_A __cxx1998 | |
389 | # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ | |
4a15d842 FD |
390 | namespace _GLIBCXX_STD_A { |
391 | # define _GLIBCXX_END_NAMESPACE_ALGO } | |
35518d76 | 392 | #else |
12ffa228 | 393 | # define _GLIBCXX_STD_A std |
4a15d842 FD |
394 | # define _GLIBCXX_BEGIN_NAMESPACE_ALGO |
395 | # define _GLIBCXX_END_NAMESPACE_ALGO | |
3cbc7af0 BK |
396 | #endif |
397 | ||
12ffa228 BK |
398 | // GLIBCXX_ABI Deprecated |
399 | // Define if compatibility should be provided for -mlong-double-64. | |
a7d17ed9 | 400 | #undef _GLIBCXX_LONG_DOUBLE_COMPAT |
b397e31b | 401 | |
12ffa228 | 402 | // Inline namespace for long double 128 mode. |
7c3e9502 | 403 | #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ |
b397e31b BK |
404 | namespace std |
405 | { | |
406 | inline namespace __gnu_cxx_ldbl128 { } | |
407 | } | |
12ffa228 BK |
408 | # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: |
409 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { | |
410 | # define _GLIBCXX_END_NAMESPACE_LDBL } | |
b397e31b | 411 | #else |
12ffa228 BK |
412 | # define _GLIBCXX_NAMESPACE_LDBL |
413 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL | |
414 | # define _GLIBCXX_END_NAMESPACE_LDBL | |
415 | #endif | |
34a2b755 JW |
416 | #if _GLIBCXX_USE_CXX11_ABI |
417 | # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11 | |
418 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11 | |
419 | # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 | |
420 | #else | |
421 | # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL | |
422 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL | |
423 | # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL | |
424 | #endif | |
12ffa228 | 425 | |
2f1e8e7c | 426 | // Debug Mode implies checking assertions. |
8b790281 | 427 | #if defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_ASSERTIONS) |
e383deac | 428 | # define _GLIBCXX_ASSERTIONS 1 |
2f1e8e7c JW |
429 | #endif |
430 | ||
431 | // Disable std::string explicit instantiation declarations in order to assert. | |
432 | #ifdef _GLIBCXX_ASSERTIONS | |
433 | # undef _GLIBCXX_EXTERN_TEMPLATE | |
434 | # define _GLIBCXX_EXTERN_TEMPLATE -1 | |
435 | #endif | |
436 | ||
12ffa228 | 437 | // Assert. |
eae0b895 JW |
438 | #if defined(_GLIBCXX_ASSERTIONS) \ |
439 | || defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PARALLEL_ASSERTIONS) | |
12ffa228 BK |
440 | namespace std |
441 | { | |
442 | // Avoid the use of assert, because we're trying to keep the <cassert> | |
443 | // include out of the mix. | |
daf69489 | 444 | extern "C++" inline void |
12ffa228 BK |
445 | __replacement_assert(const char* __file, int __line, |
446 | const char* __function, const char* __condition) | |
447 | { | |
448 | __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line, | |
449 | __function, __condition); | |
450 | __builtin_abort(); | |
451 | } | |
452 | } | |
eae0b895 | 453 | #define __glibcxx_assert_impl(_Condition) \ |
12ffa228 BK |
454 | do \ |
455 | { \ | |
456 | if (! (_Condition)) \ | |
457 | std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ | |
458 | #_Condition); \ | |
459 | } while (false) | |
b397e31b BK |
460 | #endif |
461 | ||
eae0b895 JW |
462 | #if defined(_GLIBCXX_ASSERTIONS) |
463 | # define __glibcxx_assert(_Condition) __glibcxx_assert_impl(_Condition) | |
464 | #else | |
465 | # define __glibcxx_assert(_Condition) | |
466 | #endif | |
467 | ||
94a86be0 BK |
468 | // Macros for race detectors. |
469 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and | |
470 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain | |
471 | // atomic (lock-free) synchronization to race detectors: | |
472 | // the race detector will infer a happens-before arc from the former to the | |
473 | // latter when they share the same argument pointer. | |
474 | // | |
475 | // The most frequent use case for these macros (and the only case in the | |
476 | // current implementation of the library) is atomic reference counting: | |
477 | // void _M_remove_reference() | |
478 | // { | |
479 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); | |
480 | // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) | |
481 | // { | |
482 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); | |
483 | // _M_destroy(__a); | |
484 | // } | |
485 | // } | |
486 | // The annotations in this example tell the race detector that all memory | |
487 | // accesses occurred when the refcount was positive do not race with | |
488 | // memory accesses which occurred after the refcount became zero. | |
94a86be0 BK |
489 | #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE |
490 | # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) | |
491 | #endif | |
492 | #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER | |
493 | # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) | |
494 | #endif | |
86ff5c50 | 495 | |
12ffa228 BK |
496 | // Macros for C linkage: define extern "C" linkage only when using C++. |
497 | # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { | |
498 | # define _GLIBCXX_END_EXTERN_C } | |
499 | ||
a04d5fc9 TR |
500 | #define _GLIBCXX_USE_ALLOCATOR_NEW |
501 | ||
86ff5c50 | 502 | #else // !__cplusplus |
94a86be0 | 503 | # define _GLIBCXX_BEGIN_EXTERN_C |
7c3e9502 | 504 | # define _GLIBCXX_END_EXTERN_C |
d466a7e2 BK |
505 | #endif |
506 | ||
12ffa228 | 507 | |
b397e31b | 508 | // First includes. |
6defecc2 | 509 | |
b397e31b BK |
510 | // Pick up any OS-specific definitions. |
511 | #include <bits/os_defines.h> | |
390e4c0d | 512 | |
b397e31b BK |
513 | // Pick up any CPU-specific definitions. |
514 | #include <bits/cpu_defines.h> | |
45f388bb | 515 | |
f7e413e2 DK |
516 | // If platform uses neither visibility nor psuedo-visibility, |
517 | // specify empty default for namespace annotation macros. | |
518 | #ifndef _GLIBCXX_PSEUDO_VISIBILITY | |
12ffa228 | 519 | # define _GLIBCXX_PSEUDO_VISIBILITY(V) |
94afef7b BK |
520 | #endif |
521 | ||
522 | // Certain function definitions that are meant to be overridable from | |
523 | // user code are decorated with this macro. For some targets, this | |
524 | // macro causes these definitions to be weak. | |
525 | #ifndef _GLIBCXX_WEAK_DEFINITION | |
526 | # define _GLIBCXX_WEAK_DEFINITION | |
527 | #endif | |
725dc051 | 528 | |
9585381a TR |
529 | // By default, we assume that __GXX_WEAK__ also means that there is support |
530 | // for declaring functions as weak while not defining such functions. This | |
531 | // allows for referring to functions provided by other libraries (e.g., | |
532 | // libitm) without depending on them if the respective features are not used. | |
533 | #ifndef _GLIBCXX_USE_WEAK_REF | |
534 | # define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__ | |
535 | #endif | |
536 | ||
537 | // Conditionally enable annotations for the Transactional Memory TS on C++11. | |
538 | // Most of the following conditions are due to limitations in the current | |
539 | // implementation. | |
540 | #if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \ | |
fe16acf2 | 541 | && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201500L \ |
9585381a TR |
542 | && !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF \ |
543 | && _GLIBCXX_USE_ALLOCATOR_NEW | |
544 | #define _GLIBCXX_TXN_SAFE transaction_safe | |
545 | #define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic | |
546 | #else | |
547 | #define _GLIBCXX_TXN_SAFE | |
548 | #define _GLIBCXX_TXN_SAFE_DYN | |
549 | #endif | |
550 | ||
f8571e51 JW |
551 | #if __cplusplus > 201402L |
552 | // In C++17 mathematical special functions are in namespace std. | |
553 | # define _GLIBCXX_USE_STD_SPEC_FUNCS 1 | |
554 | #elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0 | |
555 | // For C++11 and C++14 they are in namespace std when requested. | |
556 | # define _GLIBCXX_USE_STD_SPEC_FUNCS 1 | |
557 | #endif | |
d4e1b072 | 558 | |
1051c718 PE |
559 | // The remainder of the prewritten config is automatic; all the |
560 | // user hooks are listed above. | |
561 | ||
442c0874 JQ |
562 | // Create a boolean flag to be used to determine if --fast-math is set. |
563 | #ifdef __FAST_MATH__ | |
3d7c150e | 564 | # define _GLIBCXX_FAST_MATH 1 |
442c0874 | 565 | #else |
3d7c150e | 566 | # define _GLIBCXX_FAST_MATH 0 |
442c0874 JQ |
567 | #endif |
568 | ||
ad414290 PE |
569 | // This marks string literals in header files to be extracted for eventual |
570 | // translation. It is primarily used for messages in thrown exceptions; see | |
571 | // src/functexcept.cc. We use __N because the more traditional _N is used | |
572 | // for something else under certain OSes (see BADNAMES). | |
573 | #define __N(msgid) (msgid) | |
574 | ||
fe264e58 PC |
575 | // For example, <windows.h> is known to #define min and max as macros... |
576 | #undef min | |
577 | #undef max | |
578 | ||
23c64853 JY |
579 | // N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally |
580 | // so they should be tested with #if not with #ifdef. | |
581 | #if __cplusplus >= 201103L | |
582 | # ifndef _GLIBCXX_USE_C99_MATH | |
583 | # define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH | |
584 | # endif | |
585 | # ifndef _GLIBCXX_USE_C99_COMPLEX | |
586 | # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX | |
587 | # endif | |
588 | # ifndef _GLIBCXX_USE_C99_STDIO | |
589 | # define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO | |
590 | # endif | |
591 | # ifndef _GLIBCXX_USE_C99_STDLIB | |
592 | # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB | |
593 | # endif | |
594 | # ifndef _GLIBCXX_USE_C99_WCHAR | |
595 | # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR | |
596 | # endif | |
597 | #else | |
598 | # ifndef _GLIBCXX_USE_C99_MATH | |
599 | # define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH | |
600 | # endif | |
601 | # ifndef _GLIBCXX_USE_C99_COMPLEX | |
602 | # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX | |
603 | # endif | |
604 | # ifndef _GLIBCXX_USE_C99_STDIO | |
605 | # define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO | |
606 | # endif | |
607 | # ifndef _GLIBCXX_USE_C99_STDLIB | |
608 | # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB | |
609 | # endif | |
610 | # ifndef _GLIBCXX_USE_C99_WCHAR | |
611 | # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR | |
612 | # endif | |
613 | #endif | |
614 | ||
c124af93 TH |
615 | // Unless explicitly specified, enable char8_t extensions only if the core |
616 | // language char8_t feature macro is defined. | |
617 | #ifndef _GLIBCXX_USE_CHAR8_T | |
618 | # ifdef __cpp_char8_t | |
619 | # define _GLIBCXX_USE_CHAR8_T 1 | |
620 | # endif | |
621 | #endif | |
622 | #ifdef _GLIBCXX_USE_CHAR8_T | |
2b4e2c93 | 623 | # define __cpp_lib_char8_t 201907L |
c124af93 TH |
624 | #endif |
625 | ||
f421e442 | 626 | /* Define if __float128 is supported on this host. */ |
41c3db9f | 627 | #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) |
f421e442 | 628 | #define _GLIBCXX_USE_FLOAT128 |
f421e442 TMQMF |
629 | #endif |
630 | ||
ff273400 JW |
631 | #if __GNUC__ >= 7 |
632 | // Assume these are available if the compiler claims to be a recent GCC: | |
633 | # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 | |
634 | # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 | |
635 | # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 | |
44af818f | 636 | # define _GLIBCXX_BUILTIN_IS_SAME_AS(T, U) __is_same_as(T, U) |
0d7924f2 JJ |
637 | # if __GNUC__ >= 9 |
638 | # define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1 | |
639 | # endif | |
4887c9e8 | 640 | #elif defined(__is_identifier) && defined(__has_builtin) |
ff273400 JW |
641 | // For non-GNU compilers: |
642 | # if ! __is_identifier(__has_unique_object_representations) | |
643 | # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 | |
644 | # endif | |
645 | # if ! __is_identifier(__is_aggregate) | |
646 | # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 | |
647 | # endif | |
4887c9e8 | 648 | # if __has_builtin(__builtin_launder) |
ff273400 JW |
649 | # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 |
650 | # endif | |
4887c9e8 | 651 | # if __has_builtin(__builtin_is_constant_evaluated) |
0d7924f2 JJ |
652 | # define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1 |
653 | # endif | |
44af818f JW |
654 | # if ! __is_identifier(__is_same) |
655 | # define _GLIBCXX_BUILTIN_IS_SAME_AS(T, U) __is_same(T, U) | |
656 | # endif | |
ff273400 JW |
657 | #endif // GCC |
658 | ||
061f4578 TR |
659 | // PSTL configuration |
660 | ||
661 | #if __cplusplus >= 201703L | |
662 | // Preserved here so we have some idea which version of upstream we've pulled in | |
f32ee8a2 | 663 | // #define PSTL_VERSION 9000 |
061f4578 TR |
664 | |
665 | // For now this defaults to being based on the presence of Thread Building Blocks | |
666 | # ifndef _GLIBCXX_USE_TBB_PAR_BACKEND | |
667 | # define _GLIBCXX_USE_TBB_PAR_BACKEND __has_include(<tbb/tbb.h>) | |
668 | # endif | |
669 | // This section will need some rework when a new (default) backend type is added | |
670 | # if _GLIBCXX_USE_TBB_PAR_BACKEND | |
f32ee8a2 TR |
671 | # define _PSTL_PAR_BACKEND_TBB |
672 | # else | |
673 | # define _PSTL_PAR_BACKEND_SERIAL | |
061f4578 TR |
674 | # endif |
675 | ||
f32ee8a2 TR |
676 | # define _PSTL_ASSERT(_Condition) __glibcxx_assert(_Condition) |
677 | # define _PSTL_ASSERT_MSG(_Condition, _Message) __glibcxx_assert(_Condition) | |
9eda9f92 | 678 | |
1dc5a184 | 679 | #include <pstl/pstl_config.h> |
061f4578 TR |
680 | |
681 | #endif | |
12ffa228 | 682 | // End of prewritten config; the settings discovered at configure time follow. |