1 // Predefined symbols and macros -*- C++ -*-
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009 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 activating various namespace association modes.
64 // _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
65 // _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
66 // _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
68 // Guide to libstdc++ namespaces.
73 namespace __parallel { }
74 namespace __norm { } // __normative, __shadow, __replaced
75 namespace __cxx1998 { }
83 # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
86 #ifdef _GLIBCXX_PARALLEL
87 # define _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 1
90 // Namespace association for profile
91 #ifdef _GLIBCXX_PROFILE
92 # define _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 1
95 #define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
97 // Defined if any namespace association modes are active.
98 #if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG \
99 || _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL \
100 || _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE \
101 || _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
102 # define _GLIBCXX_USE_NAMESPACE_ASSOCIATION 1
105 // Macros for namespace scope. Either namespace std:: or the name
106 // of some nested namespace within it.
111 // Macros for enclosing namespaces and possibly nested namespaces.
112 // _GLIBCXX_BEGIN_NAMESPACE
113 // _GLIBCXX_END_NAMESPACE
114 // _GLIBCXX_BEGIN_NESTED_NAMESPACE
115 // _GLIBCXX_END_NESTED_NAMESPACE
116 #ifndef _GLIBCXX_USE_NAMESPACE_ASSOCIATION
117 # define _GLIBCXX_STD_D _GLIBCXX_STD
118 # define _GLIBCXX_STD_P _GLIBCXX_STD
119 # define _GLIBCXX_STD_PR _GLIBCXX_STD
120 # define _GLIBCXX_STD std
121 # define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) _GLIBCXX_BEGIN_NAMESPACE(X)
122 # define _GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NAMESPACE
123 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
124 # define _GLIBCXX_END_NAMESPACE }
127 # if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION // && not anything else
128 # define _GLIBCXX_STD_D _GLIBCXX_STD
129 # define _GLIBCXX_STD_P _GLIBCXX_STD
130 # define _GLIBCXX_STD _6
131 # define _GLIBCXX_BEGIN_NAMESPACE(X) _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, _6)
132 # define _GLIBCXX_END_NAMESPACE _GLIBCXX_END_NESTED_NAMESPACE
136 # if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
137 # define _GLIBCXX_STD_D __norm
138 # define _GLIBCXX_STD_P _GLIBCXX_STD
139 # define _GLIBCXX_STD __cxx1998
140 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
141 # define _GLIBCXX_END_NAMESPACE }
142 # define _GLIBCXX_EXTERN_TEMPLATE -1
146 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && !_GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
147 # define _GLIBCXX_STD_D _GLIBCXX_STD
148 # define _GLIBCXX_STD_P __norm
149 # define _GLIBCXX_STD __cxx1998
150 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
151 # define _GLIBCXX_END_NAMESPACE }
155 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL && _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
156 # define _GLIBCXX_STD_D __norm
157 # define _GLIBCXX_STD_P __norm
158 # define _GLIBCXX_STD __cxx1998
159 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
160 # define _GLIBCXX_END_NAMESPACE }
161 # define _GLIBCXX_EXTERN_TEMPLATE -1
165 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
166 # if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL || _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
167 # error Cannot use -D_GLIBCXX_PROFILE with -D_GLIBCXX_DEBUG or \
170 # define _GLIBCXX_STD_D __norm
171 # define _GLIBCXX_STD_P _GLIBCXX_STD
172 # define _GLIBCXX_STD_PR __norm
173 # define _GLIBCXX_STD __cxx1998
174 # define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
175 # define _GLIBCXX_END_NAMESPACE }
178 # if __NO_INLINE__ && !__GXX_WEAK__
179 # warning currently using namespace associated mode which may fail \
180 without inlining due to lack of weak symbols
183 # define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY_ATTR(default) {
184 # define _GLIBCXX_END_NESTED_NAMESPACE } }
187 // Namespace associations for debug mode.
188 #if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
192 inline namespace __debug { }
193 inline namespace __cxx1998 { }
197 // Namespace associations for parallel mode.
198 #if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
202 inline namespace __parallel { }
203 inline namespace __cxx1998 { }
207 // Namespace associations for profile mode
208 #if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
212 inline namespace __profile { }
213 inline namespace __cxx1998 { }
217 // Namespace associations for versioning mode.
218 #if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
221 inline namespace _6 { }
226 inline namespace _6 { }
233 inline namespace _6 { }
238 // XXX GLIBCXX_ABI Deprecated
239 // Define if compatibility should be provided for -mlong-double-64
240 #undef _GLIBCXX_LONG_DOUBLE_COMPAT
242 // Namespace associations for long double 128 mode.
243 #if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
246 inline namespace __gnu_cxx_ldbl128 { }
248 # define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
249 # define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
250 # define _GLIBCXX_END_LDBL_NAMESPACE }
252 # define _GLIBCXX_LDBL_NAMESPACE
253 # define _GLIBCXX_BEGIN_LDBL_NAMESPACE
254 # define _GLIBCXX_END_LDBL_NAMESPACE
258 // Defines for C compatibility. In particular, define extern "C"
259 // linkage only when using C++.
260 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
261 # define _GLIBCXX_END_EXTERN_C }
263 #else // !__cplusplus
264 # undef _GLIBCXX_BEGIN_NAMESPACE
265 # undef _GLIBCXX_END_NAMESPACE
266 # define _GLIBCXX_BEGIN_NAMESPACE(X)
267 # define _GLIBCXX_END_NAMESPACE
268 # define _GLIBCXX_BEGIN_EXTERN_C
269 # define _GLIBCXX_END_EXTERN_C
274 // Pick up any OS-specific definitions.
275 #include <bits/os_defines.h>
277 // Pick up any CPU-specific definitions.
278 #include <bits/cpu_defines.h>
280 // If platform uses neither visibility nor psuedo-visibility,
281 // specify empty default for namespace annotation macros.
282 #ifndef _GLIBCXX_PSEUDO_VISIBILITY
283 #define _GLIBCXX_PSEUDO_VISIBILITY(V)
286 // Allow use of "export template." This is currently not a feature
287 // that g++ supports.
288 // #define _GLIBCXX_EXPORT_TEMPLATE 1
290 // Allow use of the GNU syntax extension, "extern template." This
291 // extension is fully documented in the g++ manual, but in a nutshell,
292 // it inhibits all implicit instantiations and is used throughout the
293 // library to avoid multiple weak definitions for required types that
294 // are already explicitly instantiated in the library binary. This
295 // substantially reduces the binary size of resulting executables.
297 // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern
298 // templates only in basic_string, thus activating its debug-mode
299 // checks even at -O0.
300 #ifndef _GLIBCXX_EXTERN_TEMPLATE
301 # define _GLIBCXX_EXTERN_TEMPLATE 1
304 // Certain function definitions that are meant to be overridable from
305 // user code are decorated with this macro. For some targets, this
306 // macro causes these definitions to be weak.
307 #ifndef _GLIBCXX_WEAK_DEFINITION
308 # define _GLIBCXX_WEAK_DEFINITION
312 // Avoid the use of assert, because we're trying to keep the <cassert>
313 // include out of the mix.
314 #if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL)
315 #define __glibcxx_assert(_Condition)
317 _GLIBCXX_BEGIN_NAMESPACE(std)
318 // Avoid the use of assert, because we're trying to keep the <cassert>
319 // include out of the mix.
321 __replacement_assert(const char* __file, int __line,
322 const char* __function, const char* __condition)
324 __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line,
325 __function, __condition);
328 _GLIBCXX_END_NAMESPACE
330 #define __glibcxx_assert(_Condition) \
333 if (! (_Condition)) \
334 std::__replacement_assert(__FILE__, __LINE__, \
335 __PRETTY_FUNCTION__, #_Condition); \
339 // The remainder of the prewritten config is automatic; all the
340 // user hooks are listed above.
342 // Create a boolean flag to be used to determine if --fast-math is set.
344 # define _GLIBCXX_FAST_MATH 1
346 # define _GLIBCXX_FAST_MATH 0
349 // This marks string literals in header files to be extracted for eventual
350 // translation. It is primarily used for messages in thrown exceptions; see
351 // src/functexcept.cc. We use __N because the more traditional _N is used
352 // for something else under certain OSes (see BADNAMES).
353 #define __N(msgid) (msgid)
355 // For example, <windows.h> is known to #define min and max as macros...
359 #ifndef _GLIBCXX_PURE
360 # define _GLIBCXX_PURE __attribute__ ((__pure__))
363 #ifndef _GLIBCXX_CONST
364 # define _GLIBCXX_CONST __attribute__ ((__const__))
367 #ifndef _GLIBCXX_NORETURN
368 # define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
371 #ifndef _GLIBCXX_NOTHROW
373 # define _GLIBCXX_NOTHROW throw()
375 # define _GLIBCXX_NOTHROW __attribute__((__nothrow__))
379 // End of prewritten config; the discovered settings follow.