1 // Predefined symbols and macros -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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)
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.
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.
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/>.
27 * This is an internal header file, included by other library headers.
28 * You should not attempt to use it directly.
31 #ifndef _GLIBCXX_CXX_CONFIG_H
32 #define _GLIBCXX_CXX_CONFIG_H 1
34 // The current version of the C++ library in compressed ISO date format.
37 // Macros for visibility.
38 // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
39 // _GLIBCXX_VISIBILITY_ATTR
40 #define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
42 #if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
43 # define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V)))
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)
50 // Macros for deprecated.
51 // _GLIBCXX_DEPRECATED
52 // _GLIBCXX_DEPRECATED_ATTR
53 #ifndef _GLIBCXX_DEPRECATED
54 # define _GLIBCXX_DEPRECATED 1
57 #if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__)
58 # define _GLIBCXX_DEPRECATED_ATTR __attribute__ ((__deprecated__))
60 # define _GLIBCXX_DEPRECATED_ATTR
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.
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()
74 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
75 // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0)
77 // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
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.
85 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE
86 # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A)
88 #ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER
89 # define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)
92 // Macros for activating various namespace association modes.
93 // _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
94 // _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
95 // _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
97 // Guide to libstdc++ namespaces.
101 namespace __debug { }
102 namespace __parallel { }
103 namespace __norm { } // __normative, __shadow, __replaced
104 namespace __cxx1998 { }
111 #ifdef _GLIBCXX_DEBUG
112 # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
115 #ifdef _GLIBCXX_PARALLEL
116 # define _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 1
119 // Namespace association for profile
120 #ifdef _GLIBCXX_PROFILE
121 # define _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 1
124 #define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
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
134 // Macros for namespace scope. Either namespace std:: or the name
135 // of some nested namespace within it.
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 }
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
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
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 }
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
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 \
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 }
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
212 # define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY_ATTR(default) {
213 # define _GLIBCXX_END_NESTED_NAMESPACE } }
216 // Namespace associations for debug mode.
217 #if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
221 inline namespace __debug { }
222 inline namespace __cxx1998 { }
226 // Namespace associations for parallel mode.
227 #if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
231 inline namespace __parallel { }
232 inline namespace __cxx1998 { }
236 // Namespace associations for profile mode
237 #if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
241 inline namespace __profile { }
242 inline namespace __cxx1998 { }
246 // Namespace associations for versioning mode.
247 #if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
250 inline namespace _6 { }
255 inline namespace _6 { }
262 inline namespace _6 { }
267 // XXX GLIBCXX_ABI Deprecated
268 // Define if compatibility should be provided for -mlong-double-64
269 #undef _GLIBCXX_LONG_DOUBLE_COMPAT
271 // Namespace associations for long double 128 mode.
272 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
275 inline namespace __gnu_cxx_ldbl128 { }
277 # define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
278 # define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
279 # define _GLIBCXX_END_LDBL_NAMESPACE }
281 # define _GLIBCXX_LDBL_NAMESPACE
282 # define _GLIBCXX_BEGIN_LDBL_NAMESPACE
283 # define _GLIBCXX_END_LDBL_NAMESPACE
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 }
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
303 // Pick up any OS-specific definitions.
304 #include <bits/os_defines.h>
306 // Pick up any CPU-specific definitions.
307 #include <bits/cpu_defines.h>
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)
315 // Allow use of "export template." This is currently not a feature
316 // that g++ supports.
317 // #define _GLIBCXX_EXPORT_TEMPLATE 1
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.
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
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
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)
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.
350 __replacement_assert(const char* __file, int __line,
351 const char* __function, const char* __condition)
353 __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
354 __function, __condition);
357 _GLIBCXX_END_NAMESPACE
359 #define __glibcxx_assert(_Condition) \
362 if (! (_Condition)) \
363 std::__replacement_assert(__FILE__, __LINE__, \
364 __PRETTY_FUNCTION__, #_Condition); \
368 // The remainder of the prewritten config is automatic; all the
369 // user hooks are listed above.
371 // Create a boolean flag to be used to determine if --fast-math is set.
373 # define _GLIBCXX_FAST_MATH 1
375 # define _GLIBCXX_FAST_MATH 0
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)
384 // For example, <windows.h> is known to #define min and max as macros...
388 #ifndef _GLIBCXX_PURE
389 # define _GLIBCXX_PURE __attribute__ ((__pure__))
392 #ifndef _GLIBCXX_CONST
393 # define _GLIBCXX_CONST __attribute__ ((__const__))
396 #ifndef _GLIBCXX_NORETURN
397 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
400 #ifndef _GLIBCXX_NOTHROW
402 # define _GLIBCXX_NOTHROW throw()
404 # define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
410 _GLIBCXX_BEGIN_NAMESPACE(std)
412 typedef __SIZE_TYPE__ size_t;
413 typedef __PTRDIFF_TYPE__ ptrdiff_t;
415 #ifdef __GXX_EXPERIMENTAL_CXX0X__
416 typedef decltype(nullptr) nullptr_t;
419 _GLIBCXX_END_NAMESPACE
421 #endif // __cplusplus
423 // End of prewritten config; the discovered settings follow.