OSDN Git Service

5cb654b45b75b90036a391891de799868332d16a
[pf3gnuchains/gcc-fork.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, 2011 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 //   _GLIBCXX_PURE
39 //   _GLIBCXX_CONST
40 //   _GLIBCXX_NORETURN
41 //   _GLIBCXX_NOTHROW
42 //   _GLIBCXX_VISIBILITY
43 #ifndef _GLIBCXX_PURE
44 # define _GLIBCXX_PURE __attribute__ ((__pure__))
45 #endif
46
47 #ifndef _GLIBCXX_CONST
48 # define _GLIBCXX_CONST __attribute__ ((__const__))
49 #endif
50
51 #ifndef _GLIBCXX_NORETURN
52 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
53 #endif
54
55 #ifndef _GLIBCXX_NOTHROW
56 # ifdef __cplusplus
57 #  define _GLIBCXX_NOTHROW throw()
58 # else
59 #  define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
60 # endif
61 #endif
62
63 // Macros for visibility attributes.
64 //   _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
65 //   _GLIBCXX_VISIBILITY
66 #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
67
68 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
69 # define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
70 #else
71 // If this is not supplied by the OS-specific or CPU-specific
72 // headers included below, it will be defined to an empty default.
73 # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
74 #endif
75
76 // Macros for deprecated attributes.
77 //   _GLIBCXX_USE_DEPRECATED
78 //   _GLIBCXX_DEPRECATED
79 #ifndef _GLIBCXX_USE_DEPRECATED
80 # define _GLIBCXX_USE_DEPRECATED 1
81 #endif
82
83 #if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
84 # define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__))
85 #else
86 # define _GLIBCXX_DEPRECATED
87 #endif
88
89 #if __cplusplus
90
91 // Macro for constexpr, to support in mixed 03/0x mode.
92 #ifndef _GLIBCXX_CONSTEXPR
93 # ifdef __GXX_EXPERIMENTAL_CXX0X__
94 #  define _GLIBCXX_CONSTEXPR constexpr
95 #  define _GLIBCXX_USE_CONSTEXPR constexpr
96 # else
97 #  define _GLIBCXX_CONSTEXPR
98 #  define _GLIBCXX_USE_CONSTEXPR const
99 # endif
100 #endif
101
102 // Macro for noexcept, to support in mixed 03/0x mode.
103 #ifndef _GLIBCXX_NOEXCEPT
104 # ifdef __GXX_EXPERIMENTAL_CXX0X__
105 #  define _GLIBCXX_NOEXCEPT noexcept
106 #  define _GLIBCXX_USE_NOEXCEPT noexcept
107 # else
108 #  define _GLIBCXX_NOEXCEPT
109 #  define _GLIBCXX_USE_NOEXCEPT throw()
110 # endif
111 #endif
112
113 // Macro for extern template, ie controling template linkage via use
114 // of extern keyword on template declaration. As documented in the g++
115 // manual, it inhibits all implicit instantiations and is used
116 // throughout the library to avoid multiple weak definitions for
117 // required types that are already explicitly instantiated in the
118 // library binary. This substantially reduces the binary size of
119 // resulting executables.
120 // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
121 // templates only in basic_string, thus activating its debug-mode
122 // checks even at -O0.
123 #define _GLIBCXX_EXTERN_TEMPLATE
124
125 /*
126   Outline of libstdc++ namespaces.
127
128   namespace std
129   {
130     namespace __debug { }
131     namespace __parallel { }
132     namespace __profile { }
133     namespace __cxx1998 { }
134
135     namespace __detail { }
136
137     namespace rel_ops { }
138
139     namespace tr1
140     {
141       namespace placeholders { }
142       namespace regex_constants { }
143       namespace __detail { }
144     }
145
146     namespace decimal { }
147
148     namespace chrono { }
149     namespace placeholders { }
150     namespace regex_constants { }
151     namespace this_thread { }
152   }
153
154   namespace abi { }
155
156   namespace __gnu_cxx
157   {
158     namespace __detail { }
159   }
160
161   For full details see:
162   http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html
163 */
164 namespace std
165 {
166   typedef __SIZE_TYPE__         size_t;
167   typedef __PTRDIFF_TYPE__      ptrdiff_t;
168
169 #ifdef __GXX_EXPERIMENTAL_CXX0X__
170   typedef decltype(nullptr)     nullptr_t;
171 #endif
172 }
173
174
175 // Defined if inline namespaces are used for versioning.
176 #define _GLIBCXX_INLINE_VERSION
177
178 // Inline namespace for symbol versioning.
179 #if _GLIBCXX_INLINE_VERSION
180 namespace std
181 {
182   inline namespace _6 { }
183
184   namespace rel_ops { inline namespace _6 { } }
185
186   namespace tr1
187   {
188     inline namespace _6 { }
189     namespace placeholders { inline namespace _6 { } }
190     namespace regex_constants { inline namespace _6 { } }
191     namespace __detail { inline namespace _6 { } }
192   }
193
194   namespace decimal { inline namespace _6 { } }
195
196   namespace chrono { inline namespace _6 { } }
197   namespace placeholders { inline namespace _6 { } }
198   namespace regex_constants { inline namespace _6 { } }
199   namespace this_thread { inline namespace _6 { } }
200
201   namespace __detail { inline namespace _6 { } }
202   namespace __regex { inline namespace _6 { } }
203 }
204
205 namespace __gnu_cxx
206 {
207   inline namespace _6 { }
208   namespace __detail { inline namespace _6 { } }
209 }
210 # define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace _6 {
211 # define _GLIBCXX_END_NAMESPACE_VERSION }
212 #else
213 # define _GLIBCXX_BEGIN_NAMESPACE_VERSION
214 # define _GLIBCXX_END_NAMESPACE_VERSION
215 #endif
216
217
218 // Inline namespaces for special modes: debug, parallel, profile.
219 #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) \
220     || defined(_GLIBCXX_PROFILE)
221 namespace std
222 {
223   // Non-inline namespace for components replaced by alternates in active mode.
224   namespace __cxx1998
225   {
226 #if _GLIBCXX_INLINE_VERSION
227  inline namespace _6 { }
228 #endif
229   }
230
231   // Inline namespace for debug mode.
232 # ifdef _GLIBCXX_DEBUG
233   inline namespace __debug { }
234 # endif
235
236   // Inline namespaces for parallel mode.
237 # ifdef _GLIBCXX_PARALLEL
238   inline namespace __parallel { }
239 # endif
240
241   // Inline namespaces for profile mode
242 # ifdef _GLIBCXX_PROFILE
243   inline namespace __profile { }
244 # endif
245 }
246
247 // Check for invalid usage and unsupported mixed-mode use.
248 # if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL)
249 #  error illegal use of multiple inlined namespaces
250 # endif
251 # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_DEBUG)
252 #  error illegal use of multiple inlined namespaces
253 # endif
254 # if defined(_GLIBCXX_PROFILE) && defined(_GLIBCXX_PARALLEL)
255 #  error illegal use of multiple inlined namespaces
256 # endif
257
258 // Check for invalid use due to lack for weak symbols.
259 # if __NO_INLINE__ && !__GXX_WEAK__
260 #  warning currently using inlined namespace mode which may fail \
261    without inlining due to lack of weak symbols
262 # endif
263 #endif
264
265 // Macros for namespace scope. Either namespace std:: or the name
266 // of some nested namespace within it corresponding to the active mode.
267 // _GLIBCXX_STD_A
268 // _GLIBCXX_STD_C
269 //
270 // Macros for opening/closing conditional namespaces.
271 // _GLIBCXX_BEGIN_NAMESPACE_ALGO
272 // _GLIBCXX_END_NAMESPACE_ALGO
273 // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
274 // _GLIBCXX_END_NAMESPACE_CONTAINER
275 #if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PROFILE)
276 # define _GLIBCXX_STD_C __cxx1998
277 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \
278          namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION
279 # define _GLIBCXX_END_NAMESPACE_CONTAINER \
280          } _GLIBCXX_END_NAMESPACE_VERSION
281 # undef _GLIBCXX_EXTERN_TEMPLATE
282 # define _GLIBCXX_EXTERN_TEMPLATE -1
283 #endif
284
285 #ifdef _GLIBCXX_PARALLEL
286 # define _GLIBCXX_STD_A __cxx1998
287 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO \
288          namespace _GLIBCXX_STD_A { _GLIBCXX_BEGIN_NAMESPACE_VERSION
289 # define _GLIBCXX_END_NAMESPACE_ALGO \
290          } _GLIBCXX_END_NAMESPACE_VERSION
291 #endif
292
293 #ifndef _GLIBCXX_STD_A
294 # define _GLIBCXX_STD_A std
295 #endif
296
297 #ifndef _GLIBCXX_STD_C
298 # define _GLIBCXX_STD_C std
299 #endif
300
301 #ifndef _GLIBCXX_BEGIN_NAMESPACE_ALGO
302 # define _GLIBCXX_BEGIN_NAMESPACE_ALGO
303 #endif
304
305 #ifndef _GLIBCXX_END_NAMESPACE_ALGO
306 # define _GLIBCXX_END_NAMESPACE_ALGO
307 #endif
308
309 #ifndef _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
310 # define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
311 #endif
312
313 #ifndef _GLIBCXX_END_NAMESPACE_CONTAINER
314 # define _GLIBCXX_END_NAMESPACE_CONTAINER
315 #endif
316
317 // GLIBCXX_ABI Deprecated
318 // Define if compatibility should be provided for -mlong-double-64.
319 #undef _GLIBCXX_LONG_DOUBLE_COMPAT
320
321 // Inline namespace for long double 128 mode.
322 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
323 namespace std
324 {
325   inline namespace __gnu_cxx_ldbl128 { }
326 }
327 # define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128::
328 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 {
329 # define _GLIBCXX_END_NAMESPACE_LDBL }
330 #else
331 # define _GLIBCXX_NAMESPACE_LDBL
332 # define _GLIBCXX_BEGIN_NAMESPACE_LDBL
333 # define _GLIBCXX_END_NAMESPACE_LDBL
334 #endif
335
336 // Assert.
337 #if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
338 # define __glibcxx_assert(_Condition)
339 #else
340 namespace std
341 {
342   // Avoid the use of assert, because we're trying to keep the <cassert>
343   // include out of the mix.
344   inline void
345   __replacement_assert(const char* __file, int __line,
346                        const char* __function, const char* __condition)
347   {
348     __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
349                      __function, __condition);
350     __builtin_abort();
351   }
352 }
353 #define __glibcxx_assert(_Condition)                                     \
354   do                                                                     \
355   {                                                                      \
356     if (! (_Condition))                                                  \
357       std::__replacement_assert(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
358                                 #_Condition);                            \
359   } while (false)
360 #endif
361
362 // Macros for race detectors.
363 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and
364 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain
365 // atomic (lock-free) synchronization to race detectors:
366 // the race detector will infer a happens-before arc from the former to the
367 // latter when they share the same argument pointer.
368 //
369 // The most frequent use case for these macros (and the only case in the
370 // current implementation of the library) is atomic reference counting:
371 //   void _M_remove_reference()
372 //   {
373 //     _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
374 //     if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
375 //       {
376 //         _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
377 //         _M_destroy(__a);
378 //       }
379 //   }
380 // The annotations in this example tell the race detector that all memory
381 // accesses occurred when the refcount was positive do not race with
382 // memory accesses which occurred after the refcount became zero.
383 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
384 # define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
385 #endif
386 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
387 # define  _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
388 #endif
389
390 // Macros for C linkage: define extern "C" linkage only when using C++.
391 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
392 # define _GLIBCXX_END_EXTERN_C }
393
394 #else // !__cplusplus
395 # define _GLIBCXX_BEGIN_EXTERN_C
396 # define _GLIBCXX_END_EXTERN_C
397 #endif
398
399
400 // First includes.
401
402 // Pick up any OS-specific definitions.
403 #include <bits/os_defines.h>
404
405 // Pick up any CPU-specific definitions.
406 #include <bits/cpu_defines.h>
407
408 // If platform uses neither visibility nor psuedo-visibility,
409 // specify empty default for namespace annotation macros.
410 #ifndef _GLIBCXX_PSEUDO_VISIBILITY
411 # define _GLIBCXX_PSEUDO_VISIBILITY(V)
412 #endif
413
414 // Certain function definitions that are meant to be overridable from
415 // user code are decorated with this macro.  For some targets, this
416 // macro causes these definitions to be weak.
417 #ifndef _GLIBCXX_WEAK_DEFINITION
418 # define _GLIBCXX_WEAK_DEFINITION
419 #endif
420
421
422 // The remainder of the prewritten config is automatic; all the
423 // user hooks are listed above.
424
425 // Create a boolean flag to be used to determine if --fast-math is set.
426 #ifdef __FAST_MATH__
427 # define _GLIBCXX_FAST_MATH 1
428 #else
429 # define _GLIBCXX_FAST_MATH 0
430 #endif
431
432 // This marks string literals in header files to be extracted for eventual
433 // translation.  It is primarily used for messages in thrown exceptions; see
434 // src/functexcept.cc.  We use __N because the more traditional _N is used
435 // for something else under certain OSes (see BADNAMES).
436 #define __N(msgid)     (msgid)
437
438 // For example, <windows.h> is known to #define min and max as macros...
439 #undef min
440 #undef max
441
442 // End of prewritten config; the settings discovered at configure time follow.