OSDN Git Service

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