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