]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/include/bits/c++config
*: Use headername alias to associate private includes to public includes.
[thirdparty/gcc.git] / libstdc++-v3 / include / bits / c++config
1 // Predefined symbols and macros -*- C++ -*-
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
20
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
25
26 /** @file bits/c++config.h
27 * This is an internal header file, included by other library headers.
28 * Do not attempt to use it directly. @headername{iosfwd}
29 */
30
31 #ifndef _GLIBCXX_CXX_CONFIG_H
32 #define _GLIBCXX_CXX_CONFIG_H 1
33
34 // The current version of the C++ library in compressed ISO date format.
35 #define __GLIBCXX__
36
37 // Macros for various attributes.
38 #ifndef _GLIBCXX_PURE
39 # define _GLIBCXX_PURE __attribute__ ((__pure__))
40 #endif
41
42 #ifndef _GLIBCXX_CONST
43 # define _GLIBCXX_CONST __attribute__ ((__const__))
44 #endif
45
46 #ifndef _GLIBCXX_NORETURN
47 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
48 #endif
49
50 #ifndef _GLIBCXX_NOTHROW
51 # ifdef __cplusplus
52 # define _GLIBCXX_NOTHROW throw()
53 # else
54 # define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
55 # endif
56 #endif
57
58 // Macros for visibility.
59 // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
60 // _GLIBCXX_VISIBILITY_ATTR
61 #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
62
63 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
64 # define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V)))
65 #else
66 // If this is not supplied by the OS-specific or CPU-specific
67 // headers included below, it will be defined to an empty default.
68 # define _GLIBCXX_VISIBILITY_ATTR(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
69 #endif
70
71 // Macros for deprecated.
72 // _GLIBCXX_DEPRECATED
73 // _GLIBCXX_DEPRECATED_ATTR
74 #ifndef _GLIBCXX_DEPRECATED
75 # define _GLIBCXX_DEPRECATED 1
76 #endif
77
78 #if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
79 # define _GLIBCXX_DEPRECATED_ATTR __attribute__ ((__deprecated__))
80 #else
81 # define _GLIBCXX_DEPRECATED_ATTR
82 #endif
83
84 #if __cplusplus
85
86 namespace std
87 {
88 typedef __SIZE_TYPE__ size_t;
89 typedef __PTRDIFF_TYPE__ ptrdiff_t;
90
91 #ifdef __GXX_EXPERIMENTAL_CXX0X__
92 typedef decltype(nullptr) nullptr_t;
93 #endif
94 }
95
96 // Macros for C compatibility. In particular, define extern "C"
97 // linkage only when using C++.
98 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
99 # define _GLIBCXX_END_EXTERN_C }
100
101
102 // Macro for constexpr, to support in mixed 03/0x mode.
103 #ifndef _GLIBCXX_CONSTEXPR
104 # ifdef __GXX_EXPERIMENTAL_CXX0X__
105 # define _GLIBCXX_CONSTEXPR constexpr
106 # else
107 # define _GLIBCXX_CONSTEXPR
108 # endif
109 #endif
110
111 #ifndef _GLIBCXX_USE_CONSTEXPR
112 # ifdef __GXX_EXPERIMENTAL_CXX0X__
113 # define _GLIBCXX_USE_CONSTEXPR constexpr
114 # else
115 # define _GLIBCXX_USE_CONSTEXPR const
116 # endif
117 #endif
118
119 // Macros for activating various namespace association modes.
120 // _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
121 // _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
122 // _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
123
124 // Guide to libstdc++ namespaces.
125 /*
126 namespace std
127 {
128 namespace __debug { }
129 namespace __parallel { }
130 namespace __norm { } // __normative, __shadow, __replaced
131 namespace __cxx1998 { }
132
133 namespace tr1 { }
134 }
135 */
136
137 #ifdef _GLIBCXX_DEBUG
138 # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
139 #endif
140
141 #ifdef _GLIBCXX_PARALLEL
142 # define _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 1
143 #endif
144
145 // Namespace association for profile
146 #ifdef _GLIBCXX_PROFILE
147 # define _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 1
148 #endif
149
150 #define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
151
152 // Defined if any namespace association modes are active.
153 #if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG \
154 || _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL \
155 || _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE \
156 || _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
157 # define _GLIBCXX_USE_NAMESPACE_ASSOCIATION 1
158 #endif
159
160 // Macros for namespace scope. Either namespace std:: or the name
161 // of some nested namespace within it.
162 // _GLIBCXX_STD
163 // _GLIBCXX_STD_D
164 // _GLIBCXX_STD_P
165 // _GLIBCXX_STD_PR
166 //
167 // Macros for enclosing namespaces and possibly nested namespaces.
168 // _GLIBCXX_BEGIN_NAMESPACE
169 // _GLIBCXX_END_NAMESPACE
170 // _GLIBCXX_BEGIN_NESTED_NAMESPACE
171 // _GLIBCXX_END_NESTED_NAMESPACE
172 #ifndef _GLIBCXX_USE_NAMESPACE_ASSOCIATION
173 # define _GLIBCXX_STD_D _GLIBCXX_STD
174 # define _GLIBCXX_STD_P _GLIBCXX_STD
175 # define _GLIBCXX_STD_PR _GLIBCXX_STD
176 # define _GLIBCXX_STD std
177 # define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) _GLIBCXX_BEGIN_NAMESPACE(X)
178 # define _GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NAMESPACE
179 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
180 # define _GLIBCXX_END_NAMESPACE }
181 #else
182
183 # if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION // && not anything else
184 # define _GLIBCXX_STD_D _GLIBCXX_STD
185 # define _GLIBCXX_STD_P _GLIBCXX_STD
186 # define _GLIBCXX_STD _6
187 # define _GLIBCXX_BEGIN_NAMESPACE(X) _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, _6)
188 # define _GLIBCXX_END_NAMESPACE _GLIBCXX_END_NESTED_NAMESPACE
189 # endif
190
191 // debug
192 # if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
193 # define _GLIBCXX_STD_D __norm
194 # define _GLIBCXX_STD_P _GLIBCXX_STD
195 # define _GLIBCXX_STD __cxx1998
196 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
197 # define _GLIBCXX_END_NAMESPACE }
198 # define _GLIBCXX_EXTERN_TEMPLATE -1
199 # endif
200
201 // parallel
202 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && !_GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
203 # define _GLIBCXX_STD_D _GLIBCXX_STD
204 # define _GLIBCXX_STD_P __norm
205 # define _GLIBCXX_STD __cxx1998
206 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
207 # define _GLIBCXX_END_NAMESPACE }
208 # endif
209
210 // debug + parallel
211 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
212 # define _GLIBCXX_STD_D __norm
213 # define _GLIBCXX_STD_P __norm
214 # define _GLIBCXX_STD __cxx1998
215 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
216 # define _GLIBCXX_END_NAMESPACE }
217 # define _GLIBCXX_EXTERN_TEMPLATE -1
218 # endif
219
220 // profile
221 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
222 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL || _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
223 # error Cannot use -D_GLIBCXX_PROFILE with -D_GLIBCXX_DEBUG or \
224 -D_GLIBCXX_PARALLEL
225 # endif
226 # define _GLIBCXX_STD_D __norm
227 # define _GLIBCXX_STD_P _GLIBCXX_STD
228 # define _GLIBCXX_STD_PR __norm
229 # define _GLIBCXX_STD __cxx1998
230 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
231 # define _GLIBCXX_END_NAMESPACE }
232 # endif
233
234 # if __NO_INLINE__ && !__GXX_WEAK__
235 # warning currently using namespace associated mode which may fail \
236 without inlining due to lack of weak symbols
237 # endif
238
239 # define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY_ATTR(default) {
240 # define _GLIBCXX_END_NESTED_NAMESPACE } }
241 #endif
242
243 // Namespace associations for debug mode.
244 #if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
245 namespace std
246 {
247 namespace __norm { }
248 inline namespace __debug { }
249 inline namespace __cxx1998 { }
250 }
251 #endif
252
253 // Namespace associations for parallel mode.
254 #if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
255 namespace std
256 {
257 namespace __norm { }
258 inline namespace __parallel { }
259 inline namespace __cxx1998 { }
260 }
261 #endif
262
263 // Namespace associations for profile mode
264 #if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
265 namespace std
266 {
267 namespace __norm { }
268 inline namespace __profile { }
269 inline namespace __cxx1998 { }
270 }
271 #endif
272
273 // Namespace associations for versioning mode.
274 #if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
275 namespace std
276 {
277 inline namespace _6 { }
278 }
279
280 namespace __gnu_cxx
281 {
282 inline namespace _6 { }
283 }
284
285 namespace std
286 {
287 namespace tr1
288 {
289 inline namespace _6 { }
290 }
291 }
292 #endif
293
294 // XXX GLIBCXX_ABI Deprecated
295 // Define if compatibility should be provided for -mlong-double-64
296 #undef _GLIBCXX_LONG_DOUBLE_COMPAT
297
298 // Namespace associations for long double 128 mode.
299 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
300 namespace std
301 {
302 inline namespace __gnu_cxx_ldbl128 { }
303 }
304 # define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
305 # define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
306 # define _GLIBCXX_END_LDBL_NAMESPACE }
307 #else
308 # define _GLIBCXX_LDBL_NAMESPACE
309 # define _GLIBCXX_BEGIN_LDBL_NAMESPACE
310 # define _GLIBCXX_END_LDBL_NAMESPACE
311 #endif
312
313 // Macros for race detectors.
314 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
315 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
316 // atomic (lock-free) synchronization to race detectors:
317 // the race detector will infer a happens-before arc from the former to the
318 // latter when they share the same argument pointer.
319 //
320 // The most frequent use case for these macros (and the only case in the
321 // current implementation of the library) is atomic reference counting:
322 // void _M_remove_reference()
323 // {
324 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
325 // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
326 // {
327 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
328 // _M_destroy(__a);
329 // }
330 // }
331 // The annotations in this example tell the race detector that all memory
332 // accesses occurred when the refcount was positive do not race with
333 // memory accesses which occurred after the refcount became zero.
334
335 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
336 # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
337 #endif
338 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
339 # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
340 #endif
341
342 #else // !__cplusplus
343 # define _GLIBCXX_BEGIN_EXTERN_C
344 # define _GLIBCXX_END_EXTERN_C
345 # undef _GLIBCXX_BEGIN_NAMESPACE
346 # undef _GLIBCXX_END_NAMESPACE
347 # define _GLIBCXX_BEGIN_NAMESPACE(X)
348 # define _GLIBCXX_END_NAMESPACE
349 #endif
350
351 // First includes.
352
353 // Pick up any OS-specific definitions.
354 #include <bits/os_defines.h>
355
356 // Pick up any CPU-specific definitions.
357 #include <bits/cpu_defines.h>
358
359 // If platform uses neither visibility nor psuedo-visibility,
360 // specify empty default for namespace annotation macros.
361 #ifndef _GLIBCXX_PSEUDO_VISIBILITY
362 #define _GLIBCXX_PSEUDO_VISIBILITY(V)
363 #endif
364
365 // Allow use of "export template." This is currently not a feature
366 // that g++ supports.
367 // #define _GLIBCXX_EXPORT_TEMPLATE 1
368
369 // Allow use of the GNU syntax extension, "extern template." This
370 // extension is fully documented in the g++ manual, but in a nutshell,
371 // it inhibits all implicit instantiations and is used throughout the
372 // library to avoid multiple weak definitions for required types that
373 // are already explicitly instantiated in the library binary. This
374 // substantially reduces the binary size of resulting executables.
375
376 // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
377 // templates only in basic_string, thus activating its debug-mode
378 // checks even at -O0.
379 #ifndef _GLIBCXX_EXTERN_TEMPLATE
380 # define _GLIBCXX_EXTERN_TEMPLATE 1
381 #endif
382
383 // Certain function definitions that are meant to be overridable from
384 // user code are decorated with this macro. For some targets, this
385 // macro causes these definitions to be weak.
386 #ifndef _GLIBCXX_WEAK_DEFINITION
387 # define _GLIBCXX_WEAK_DEFINITION
388 #endif
389
390 // Assert.
391 // Avoid the use of assert, because we're trying to keep the <cassert>
392 // include out of the mix.
393 #if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
394 #define __glibcxx_assert(_Condition)
395 #else
396 _GLIBCXX_BEGIN_NAMESPACE(std)
397 // Avoid the use of assert, because we're trying to keep the <cassert>
398 // include out of the mix.
399 inline void
400 __replacement_assert(const char* __file, int __line,
401 const char* __function, const char* __condition)
402 {
403 __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
404 __function, __condition);
405 __builtin_abort();
406 }
407 _GLIBCXX_END_NAMESPACE
408
409 #define __glibcxx_assert(_Condition) \
410 do \
411 { \
412 if (! (_Condition)) \
413 std::__replacement_assert(__FILE__, __LINE__, \
414 __PRETTY_FUNCTION__, #_Condition); \
415 } while (false)
416 #endif
417
418 // The remainder of the prewritten config is automatic; all the
419 // user hooks are listed above.
420
421 // Create a boolean flag to be used to determine if --fast-math is set.
422 #ifdef __FAST_MATH__
423 # define _GLIBCXX_FAST_MATH 1
424 #else
425 # define _GLIBCXX_FAST_MATH 0
426 #endif
427
428 // This marks string literals in header files to be extracted for eventual
429 // translation. It is primarily used for messages in thrown exceptions; see
430 // src/functexcept.cc. We use __N because the more traditional _N is used
431 // for something else under certain OSes (see BADNAMES).
432 #define __N(msgid) (msgid)
433
434 // For example, <windows.h> is known to #define min and max as macros...
435 #undef min
436 #undef max
437
438 // End of prewritten config; the discovered settings follow.