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