]>
Commit | Line | Data |
---|---|---|
58c508a1 | 1 | // Predefined symbols and macros -*- C++ -*- |
1d487aca | 2 | |
f1717362 | 3 | // Copyright (C) 1997-2016 Free Software Foundation, Inc. |
1d487aca | 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 | |
6bc9506f | 8 | // Free Software Foundation; either version 3, or (at your option) |
1d487aca | 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 | ||
6bc9506f | 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/>. | |
1d487aca | 24 | |
5846aeac | 25 | /** @file bits/c++config.h |
944beac5 | 26 | * This is an internal header file, included by other library headers. |
5846aeac | 27 | * Do not attempt to use it directly. @headername{iosfwd} |
944beac5 | 28 | */ |
29 | ||
c5462887 | 30 | #ifndef _GLIBCXX_CXX_CONFIG_H |
31 | #define _GLIBCXX_CXX_CONFIG_H 1 | |
1d487aca | 32 | |
1069247d | 33 | // The current version of the C++ library in compressed ISO date format. |
dee74d2b | 34 | #define __GLIBCXX__ |
d570f2e9 | 35 | |
c0000147 | 36 | // Macros for various attributes. |
2948dd21 | 37 | // _GLIBCXX_PURE |
38 | // _GLIBCXX_CONST | |
39 | // _GLIBCXX_NORETURN | |
40 | // _GLIBCXX_NOTHROW | |
41 | // _GLIBCXX_VISIBILITY | |
c0000147 | 42 | #ifndef _GLIBCXX_PURE |
43 | # define _GLIBCXX_PURE __attribute__ ((__pure__)) | |
44 | #endif | |
45 | ||
46 | #ifndef _GLIBCXX_CONST | |
47 | # define _GLIBCXX_CONST __attribute__ ((__const__)) | |
48 | #endif | |
49 | ||
50 | #ifndef _GLIBCXX_NORETURN | |
51 | # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) | |
52 | #endif | |
53 | ||
22a5fa5e | 54 | // See below for C++ |
c0000147 | 55 | #ifndef _GLIBCXX_NOTHROW |
22a5fa5e | 56 | # ifndef __cplusplus |
c0000147 | 57 | # define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) |
58 | # endif | |
59 | #endif | |
60 | ||
2948dd21 | 61 | // Macros for visibility attributes. |
62 | // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY | |
63 | // _GLIBCXX_VISIBILITY | |
4ffa185b | 64 | #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY |
65 | ||
66 | #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY | |
2948dd21 | 67 | # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) |
4ffa185b | 68 | #else |
dd9d9ac2 | 69 | // If this is not supplied by the OS-specific or CPU-specific |
70 | // headers included below, it will be defined to an empty default. | |
2948dd21 | 71 | # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) |
4ffa185b | 72 | #endif |
73 | ||
2948dd21 | 74 | // Macros for deprecated attributes. |
f58707cd | 75 | // _GLIBCXX_USE_DEPRECATED |
2948dd21 | 76 | // _GLIBCXX_DEPRECATED |
f58707cd | 77 | #ifndef _GLIBCXX_USE_DEPRECATED |
78 | # define _GLIBCXX_USE_DEPRECATED 1 | |
5c420bf3 | 79 | #endif |
80 | ||
0c8766b1 | 81 | #if defined(__DEPRECATED) && (__cplusplus >= 201103L) |
f58707cd | 82 | # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) |
5c420bf3 | 83 | #else |
f58707cd | 84 | # define _GLIBCXX_DEPRECATED |
5c420bf3 | 85 | #endif |
86 | ||
8544d95d | 87 | // Macros for ABI tag attributes. |
88 | #ifndef _GLIBCXX_ABI_TAG_CXX11 | |
89 | # define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) | |
90 | #endif | |
91 | ||
92 | ||
c0000147 | 93 | #if __cplusplus |
d8155f71 | 94 | |
c0000147 | 95 | // Macro for constexpr, to support in mixed 03/0x mode. |
96 | #ifndef _GLIBCXX_CONSTEXPR | |
0c8766b1 | 97 | # if __cplusplus >= 201103L |
c0000147 | 98 | # define _GLIBCXX_CONSTEXPR constexpr |
c0000147 | 99 | # define _GLIBCXX_USE_CONSTEXPR constexpr |
100 | # else | |
dee74d2b | 101 | # define _GLIBCXX_CONSTEXPR |
c0000147 | 102 | # define _GLIBCXX_USE_CONSTEXPR const |
103 | # endif | |
d8155f71 | 104 | #endif |
105 | ||
d3ab8611 | 106 | #ifndef _GLIBCXX14_CONSTEXPR |
107 | # if __cplusplus >= 201402L | |
108 | # define _GLIBCXX14_CONSTEXPR constexpr | |
109 | # else | |
110 | # define _GLIBCXX14_CONSTEXPR | |
111 | # endif | |
112 | #endif | |
113 | ||
568d055d | 114 | // Macro for noexcept, to support in mixed 03/0x mode. |
115 | #ifndef _GLIBCXX_NOEXCEPT | |
0c8766b1 | 116 | # if __cplusplus >= 201103L |
568d055d | 117 | # define _GLIBCXX_NOEXCEPT noexcept |
02769f1f | 118 | # define _GLIBCXX_NOEXCEPT_IF(_COND) noexcept(_COND) |
568d055d | 119 | # define _GLIBCXX_USE_NOEXCEPT noexcept |
43cb9fbd | 120 | # define _GLIBCXX_THROW(_EXC) |
568d055d | 121 | # else |
122 | # define _GLIBCXX_NOEXCEPT | |
02769f1f | 123 | # define _GLIBCXX_NOEXCEPT_IF(_COND) |
568d055d | 124 | # define _GLIBCXX_USE_NOEXCEPT throw() |
43cb9fbd | 125 | # define _GLIBCXX_THROW(_EXC) throw(_EXC) |
568d055d | 126 | # endif |
127 | #endif | |
128 | ||
22a5fa5e | 129 | #ifndef _GLIBCXX_NOTHROW |
130 | # define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT | |
131 | #endif | |
132 | ||
1590c7d4 | 133 | #ifndef _GLIBCXX_THROW_OR_ABORT |
0fcfaa33 | 134 | # if __cpp_exceptions |
1590c7d4 | 135 | # define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) |
136 | # else | |
137 | # define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort()) | |
138 | # endif | |
139 | #endif | |
140 | ||
6b5e6f09 | 141 | // Macro for extern template, ie controlling template linkage via use |
2948dd21 | 142 | // of extern keyword on template declaration. As documented in the g++ |
143 | // manual, it inhibits all implicit instantiations and is used | |
144 | // throughout the library to avoid multiple weak definitions for | |
145 | // required types that are already explicitly instantiated in the | |
146 | // library binary. This substantially reduces the binary size of | |
147 | // resulting executables. | |
148 | // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern | |
149 | // templates only in basic_string, thus activating its debug-mode | |
150 | // checks even at -O0. | |
cb38c7e0 | 151 | #define _GLIBCXX_EXTERN_TEMPLATE |
5c420bf3 | 152 | |
6482a45c | 153 | /* |
2948dd21 | 154 | Outline of libstdc++ namespaces. |
155 | ||
6482a45c | 156 | namespace std |
157 | { | |
158 | namespace __debug { } | |
159 | namespace __parallel { } | |
dee74d2b | 160 | namespace __profile { } |
6482a45c | 161 | namespace __cxx1998 { } |
162 | ||
2948dd21 | 163 | namespace __detail { } |
164 | ||
165 | namespace rel_ops { } | |
166 | ||
167 | namespace tr1 | |
168 | { | |
169 | namespace placeholders { } | |
170 | namespace regex_constants { } | |
171 | namespace __detail { } | |
172 | } | |
173 | ||
cae32d03 | 174 | namespace tr2 { } |
175 | ||
2948dd21 | 176 | namespace decimal { } |
177 | ||
178 | namespace chrono { } | |
179 | namespace placeholders { } | |
180 | namespace regex_constants { } | |
181 | namespace this_thread { } | |
e7297f3c | 182 | |
183 | namespace experimental { } | |
6482a45c | 184 | } |
6482a45c | 185 | |
2948dd21 | 186 | namespace abi { } |
1069247d | 187 | |
2948dd21 | 188 | namespace __gnu_cxx |
189 | { | |
190 | namespace __detail { } | |
191 | } | |
192 | ||
193 | For full details see: | |
194 | http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html | |
195 | */ | |
196 | namespace std | |
197 | { | |
198 | typedef __SIZE_TYPE__ size_t; | |
199 | typedef __PTRDIFF_TYPE__ ptrdiff_t; | |
6482a45c | 200 | |
0c8766b1 | 201 | #if __cplusplus >= 201103L |
2948dd21 | 202 | typedef decltype(nullptr) nullptr_t; |
c55dc904 | 203 | #endif |
2948dd21 | 204 | } |
c55dc904 | 205 | |
63f54259 | 206 | #define _GLIBCXX_USE_DUAL_ABI |
207 | ||
208 | #if ! _GLIBCXX_USE_DUAL_ABI | |
209 | // Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI | |
210 | # undef _GLIBCXX_USE_CXX11_ABI | |
211 | #endif | |
212 | ||
60f5701c | 213 | #ifndef _GLIBCXX_USE_CXX11_ABI |
214 | #define _GLIBCXX_USE_CXX11_ABI | |
215 | #endif | |
216 | ||
217 | #if _GLIBCXX_USE_CXX11_ABI | |
63f54259 | 218 | namespace std |
219 | { | |
527cb890 | 220 | inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } |
63f54259 | 221 | } |
0fe0648d | 222 | namespace __gnu_cxx |
223 | { | |
224 | inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } | |
225 | } | |
63f54259 | 226 | # define _GLIBCXX_NAMESPACE_CXX11 __cxx11:: |
227 | # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 { | |
228 | # define _GLIBCXX_END_NAMESPACE_CXX11 } | |
60f5701c | 229 | # define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11 |
230 | #else | |
63f54259 | 231 | # define _GLIBCXX_NAMESPACE_CXX11 |
232 | # define _GLIBCXX_BEGIN_NAMESPACE_CXX11 | |
233 | # define _GLIBCXX_END_NAMESPACE_CXX11 | |
60f5701c | 234 | # define _GLIBCXX_DEFAULT_ABI_TAG |
235 | #endif | |
236 | ||
2948dd21 | 237 | |
238 | // Defined if inline namespaces are used for versioning. | |
377fc3e8 | 239 | #define _GLIBCXX_INLINE_VERSION |
1069247d | 240 | |
2948dd21 | 241 | // Inline namespace for symbol versioning. |
242 | #if _GLIBCXX_INLINE_VERSION | |
377fc3e8 | 243 | |
2948dd21 | 244 | namespace std |
245 | { | |
377fc3e8 | 246 | inline namespace __7 { } |
6482a45c | 247 | |
377fc3e8 | 248 | namespace rel_ops { inline namespace __7 { } } |
2948dd21 | 249 | |
250 | namespace tr1 | |
251 | { | |
377fc3e8 | 252 | inline namespace __7 { } |
253 | namespace placeholders { inline namespace __7 { } } | |
254 | namespace regex_constants { inline namespace __7 { } } | |
255 | namespace __detail { inline namespace __7 { } } | |
2948dd21 | 256 | } |
257 | ||
cae32d03 | 258 | namespace tr2 |
259 | { inline namespace __7 { } } | |
260 | ||
377fc3e8 | 261 | namespace decimal { inline namespace __7 { } } |
2948dd21 | 262 | |
377fc3e8 | 263 | namespace chrono { inline namespace __7 { } } |
264 | namespace placeholders { inline namespace __7 { } } | |
265 | namespace regex_constants { inline namespace __7 { } } | |
266 | namespace this_thread { inline namespace __7 { } } | |
9a820731 | 267 | |
e7297f3c | 268 | namespace experimental { inline namespace __7 { } } |
269 | ||
377fc3e8 | 270 | namespace __detail { inline namespace __7 { } } |
2948dd21 | 271 | } |
272 | ||
273 | namespace __gnu_cxx | |
274 | { | |
377fc3e8 | 275 | inline namespace __7 { } |
276 | namespace __detail { inline namespace __7 { } } | |
2948dd21 | 277 | } |
377fc3e8 | 278 | # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { |
2948dd21 | 279 | # define _GLIBCXX_END_NAMESPACE_VERSION } |
1069247d | 280 | #else |
2948dd21 | 281 | # define _GLIBCXX_BEGIN_NAMESPACE_VERSION |
282 | # define _GLIBCXX_END_NAMESPACE_VERSION | |
283 | #endif | |
6482a45c | 284 | |
6482a45c | 285 | |
2948dd21 | 286 | // Inline namespaces for special modes: debug, parallel, profile. |
287 | #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \ | |
288 | || defined(_GLIBCXX_PROFILE) | |
289 | namespace std | |
290 | { | |
291 | // Non-inline namespace for components replaced by alternates in active mode. | |
292 | namespace __cxx1998 | |
293 | { | |
7a8cb66a | 294 | # if _GLIBCXX_INLINE_VERSION |
295 | inline namespace __7 { } | |
296 | # endif | |
297 | ||
298 | # if _GLIBCXX_USE_CXX11_ABI | |
89eaf71a | 299 | inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } |
7a8cb66a | 300 | # endif |
2948dd21 | 301 | } |
302 | ||
303 | // Inline namespace for debug mode. | |
304 | # ifdef _GLIBCXX_DEBUG | |
305 | inline namespace __debug { } | |
6482a45c | 306 | # endif |
307 | ||
2948dd21 | 308 | // Inline namespaces for parallel mode. |
309 | # ifdef _GLIBCXX_PARALLEL | |
310 | inline namespace __parallel { } | |
6482a45c | 311 | # endif |
312 | ||
2948dd21 | 313 | // Inline namespaces for profile mode |
314 | # ifdef _GLIBCXX_PROFILE | |
315 | inline namespace __profile { } | |
6482a45c | 316 | # endif |
2948dd21 | 317 | } |
6482a45c | 318 | |
2948dd21 | 319 | // Check for invalid usage and unsupported mixed-mode use. |
320 | # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) | |
321 | # error illegal use of multiple inlined namespaces | |
322 | # endif | |
323 | # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG) | |
324 | # error illegal use of multiple inlined namespaces | |
325 | # endif | |
326 | # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL) | |
327 | # error illegal use of multiple inlined namespaces | |
c55dc904 | 328 | # endif |
329 | ||
2948dd21 | 330 | // Check for invalid use due to lack for weak symbols. |
6482a45c | 331 | # if __NO_INLINE__ && !__GXX_WEAK__ |
dee74d2b | 332 | # warning currently using inlined namespace mode which may fail \ |
6482a45c | 333 | without inlining due to lack of weak symbols |
334 | # endif | |
2948dd21 | 335 | #endif |
336 | ||
337 | // Macros for namespace scope. Either namespace std:: or the name | |
338 | // of some nested namespace within it corresponding to the active mode. | |
339 | // _GLIBCXX_STD_A | |
340 | // _GLIBCXX_STD_C | |
341 | // | |
342 | // Macros for opening/closing conditional namespaces. | |
343 | // _GLIBCXX_BEGIN_NAMESPACE_ALGO | |
344 | // _GLIBCXX_END_NAMESPACE_ALGO | |
345 | // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |
346 | // _GLIBCXX_END_NAMESPACE_CONTAINER | |
c3a3727c | 347 | #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE) |
2948dd21 | 348 | # define _GLIBCXX_STD_C __cxx1998 |
349 | # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ | |
350 | namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
351 | # define _GLIBCXX_END_NAMESPACE_CONTAINER \ | |
f458a015 | 352 | _GLIBCXX_END_NAMESPACE_VERSION } |
2948dd21 | 353 | #endif |
6482a45c | 354 | |
2948dd21 | 355 | #ifdef _GLIBCXX_PARALLEL |
356 | # define _GLIBCXX_STD_A __cxx1998 | |
357 | # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ | |
358 | namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
359 | # define _GLIBCXX_END_NAMESPACE_ALGO \ | |
f458a015 | 360 | _GLIBCXX_END_NAMESPACE_VERSION } |
6482a45c | 361 | #endif |
362 | ||
2948dd21 | 363 | #ifndef _GLIBCXX_STD_A |
364 | # define _GLIBCXX_STD_A std | |
6482a45c | 365 | #endif |
366 | ||
2948dd21 | 367 | #ifndef _GLIBCXX_STD_C |
368 | # define _GLIBCXX_STD_C std | |
1069247d | 369 | #endif |
370 | ||
2948dd21 | 371 | #ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO |
372 | # define _GLIBCXX_BEGIN_NAMESPACE_ALGO | |
c55dc904 | 373 | #endif |
374 | ||
2948dd21 | 375 | #ifndef _GLIBCXX_END_NAMESPACE_ALGO |
376 | # define _GLIBCXX_END_NAMESPACE_ALGO | |
377 | #endif | |
1069247d | 378 | |
2948dd21 | 379 | #ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER |
380 | # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER | |
381 | #endif | |
d570f2e9 | 382 | |
2948dd21 | 383 | #ifndef _GLIBCXX_END_NAMESPACE_CONTAINER |
384 | # define _GLIBCXX_END_NAMESPACE_CONTAINER | |
1069247d | 385 | #endif |
386 | ||
2948dd21 | 387 | // GLIBCXX_ABI Deprecated |
388 | // Define if compatibility should be provided for -mlong-double-64. | |
e0614cd7 | 389 | #undef _GLIBCXX_LONG_DOUBLE_COMPAT |
6da9eb1d | 390 | |
2948dd21 | 391 | // Inline namespace for long double 128 mode. |
dee74d2b | 392 | #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ |
6da9eb1d | 393 | namespace std |
394 | { | |
395 | inline namespace __gnu_cxx_ldbl128 { } | |
396 | } | |
2948dd21 | 397 | # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: |
398 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { | |
399 | # define _GLIBCXX_END_NAMESPACE_LDBL } | |
6da9eb1d | 400 | #else |
2948dd21 | 401 | # define _GLIBCXX_NAMESPACE_LDBL |
402 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL | |
403 | # define _GLIBCXX_END_NAMESPACE_LDBL | |
404 | #endif | |
63f54259 | 405 | #if _GLIBCXX_USE_CXX11_ABI |
406 | # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11 | |
407 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11 | |
408 | # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 | |
409 | #else | |
410 | # define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL | |
411 | # define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL | |
412 | # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL | |
413 | #endif | |
2948dd21 | 414 | |
6b5e6f09 | 415 | // Debug Mode implies checking assertions. |
416 | #ifdef _GLIBCXX_DEBUG | |
417 | # define _GLIBCXX_ASSERTIONS | |
418 | #endif | |
419 | ||
420 | // Disable std::string explicit instantiation declarations in order to assert. | |
421 | #ifdef _GLIBCXX_ASSERTIONS | |
422 | # undef _GLIBCXX_EXTERN_TEMPLATE | |
423 | # define _GLIBCXX_EXTERN_TEMPLATE -1 | |
424 | #endif | |
425 | ||
2948dd21 | 426 | // Assert. |
6b5e6f09 | 427 | #if !defined(_GLIBCXX_ASSERTIONS) && !defined(_GLIBCXX_PARALLEL) |
2948dd21 | 428 | # define __glibcxx_assert(_Condition) |
429 | #else | |
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 | } | |
443 | #define __glibcxx_assert(_Condition) \ | |
444 | do \ | |
445 | { \ | |
446 | if (! (_Condition)) \ | |
447 | std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ | |
448 | #_Condition); \ | |
449 | } while (false) | |
6da9eb1d | 450 | #endif |
451 | ||
c0000147 | 452 | // Macros for race detectors. |
453 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and | |
454 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain | |
455 | // atomic (lock-free) synchronization to race detectors: | |
456 | // the race detector will infer a happens-before arc from the former to the | |
457 | // latter when they share the same argument pointer. | |
458 | // | |
459 | // The most frequent use case for these macros (and the only case in the | |
460 | // current implementation of the library) is atomic reference counting: | |
461 | // void _M_remove_reference() | |
462 | // { | |
463 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); | |
464 | // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) | |
465 | // { | |
466 | // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); | |
467 | // _M_destroy(__a); | |
468 | // } | |
469 | // } | |
470 | // The annotations in this example tell the race detector that all memory | |
471 | // accesses occurred when the refcount was positive do not race with | |
472 | // memory accesses which occurred after the refcount became zero. | |
c0000147 | 473 | #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE |
474 | # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) | |
475 | #endif | |
476 | #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER | |
477 | # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) | |
478 | #endif | |
6918f040 | 479 | |
2948dd21 | 480 | // Macros for C linkage: define extern "C" linkage only when using C++. |
481 | # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { | |
482 | # define _GLIBCXX_END_EXTERN_C } | |
483 | ||
6918f040 | 484 | #else // !__cplusplus |
c0000147 | 485 | # define _GLIBCXX_BEGIN_EXTERN_C |
dee74d2b | 486 | # define _GLIBCXX_END_EXTERN_C |
857d9b7b | 487 | #endif |
488 | ||
2948dd21 | 489 | |
6da9eb1d | 490 | // First includes. |
d7fbb98b | 491 | |
6da9eb1d | 492 | // Pick up any OS-specific definitions. |
493 | #include <bits/os_defines.h> | |
1ba9ca1d | 494 | |
6da9eb1d | 495 | // Pick up any CPU-specific definitions. |
496 | #include <bits/cpu_defines.h> | |
10c73e3f | 497 | |
dd9d9ac2 | 498 | // If platform uses neither visibility nor psuedo-visibility, |
499 | // specify empty default for namespace annotation macros. | |
500 | #ifndef _GLIBCXX_PSEUDO_VISIBILITY | |
2948dd21 | 501 | # define _GLIBCXX_PSEUDO_VISIBILITY(V) |
c12d367a | 502 | #endif |
503 | ||
504 | // Certain function definitions that are meant to be overridable from | |
505 | // user code are decorated with this macro. For some targets, this | |
506 | // macro causes these definitions to be weak. | |
507 | #ifndef _GLIBCXX_WEAK_DEFINITION | |
508 | # define _GLIBCXX_WEAK_DEFINITION | |
509 | #endif | |
1d487aca | 510 | |
251c02cb | 511 | |
d1439a5a | 512 | // The remainder of the prewritten config is automatic; all the |
513 | // user hooks are listed above. | |
514 | ||
d6782d58 | 515 | // Create a boolean flag to be used to determine if --fast-math is set. |
516 | #ifdef __FAST_MATH__ | |
5a64d8cf | 517 | # define _GLIBCXX_FAST_MATH 1 |
d6782d58 | 518 | #else |
5a64d8cf | 519 | # define _GLIBCXX_FAST_MATH 0 |
d6782d58 | 520 | #endif |
521 | ||
5128d03d | 522 | // This marks string literals in header files to be extracted for eventual |
523 | // translation. It is primarily used for messages in thrown exceptions; see | |
524 | // src/functexcept.cc. We use __N because the more traditional _N is used | |
525 | // for something else under certain OSes (see BADNAMES). | |
526 | #define __N(msgid) (msgid) | |
527 | ||
aced8a0b | 528 | // For example, <windows.h> is known to #define min and max as macros... |
529 | #undef min | |
530 | #undef max | |
531 | ||
bdb62e6a | 532 | // N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally |
533 | // so they should be tested with #if not with #ifdef. | |
534 | #if __cplusplus >= 201103L | |
535 | # ifndef _GLIBCXX_USE_C99_MATH | |
536 | # define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH | |
537 | # endif | |
538 | # ifndef _GLIBCXX_USE_C99_COMPLEX | |
539 | # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX | |
540 | # endif | |
541 | # ifndef _GLIBCXX_USE_C99_STDIO | |
542 | # define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO | |
543 | # endif | |
544 | # ifndef _GLIBCXX_USE_C99_STDLIB | |
545 | # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB | |
546 | # endif | |
547 | # ifndef _GLIBCXX_USE_C99_WCHAR | |
548 | # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR | |
549 | # endif | |
550 | #else | |
551 | # ifndef _GLIBCXX_USE_C99_MATH | |
552 | # define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH | |
553 | # endif | |
554 | # ifndef _GLIBCXX_USE_C99_COMPLEX | |
555 | # define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX | |
556 | # endif | |
557 | # ifndef _GLIBCXX_USE_C99_STDIO | |
558 | # define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO | |
559 | # endif | |
560 | # ifndef _GLIBCXX_USE_C99_STDLIB | |
561 | # define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB | |
562 | # endif | |
563 | # ifndef _GLIBCXX_USE_C99_WCHAR | |
564 | # define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR | |
565 | # endif | |
566 | #endif | |
567 | ||
2948dd21 | 568 | // End of prewritten config; the settings discovered at configure time follow. |