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