xref: /openbsd-src/gnu/gcc/libstdc++-v3/include/bits/c++config (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert// Predefined symbols and macros -*- C++ -*-
2*404b540aSrobert
3*404b540aSrobert// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4*404b540aSrobert// 2006, 2007
5*404b540aSrobert// Free Software Foundation, Inc.
6*404b540aSrobert//
7*404b540aSrobert// This file is part of the GNU ISO C++ Library.  This library is free
8*404b540aSrobert// software; you can redistribute it and/or modify it under the
9*404b540aSrobert// terms of the GNU General Public License as published by the
10*404b540aSrobert// Free Software Foundation; either version 2, or (at your option)
11*404b540aSrobert// any later version.
12*404b540aSrobert
13*404b540aSrobert// This library is distributed in the hope that it will be useful,
14*404b540aSrobert// but WITHOUT ANY WARRANTY; without even the implied warranty of
15*404b540aSrobert// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*404b540aSrobert// GNU General Public License for more details.
17*404b540aSrobert
18*404b540aSrobert// You should have received a copy of the GNU General Public License along
19*404b540aSrobert// with this library; see the file COPYING.  If not, write to the Free
20*404b540aSrobert// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21*404b540aSrobert// USA.
22*404b540aSrobert
23*404b540aSrobert// As a special exception, you may use this file as part of a free software
24*404b540aSrobert// library without restriction.  Specifically, if other files instantiate
25*404b540aSrobert// templates or use macros or inline functions from this file, or you compile
26*404b540aSrobert// this file and link it with other files to produce an executable, this
27*404b540aSrobert// file does not by itself cause the resulting executable to be covered by
28*404b540aSrobert// the GNU General Public License.  This exception does not however
29*404b540aSrobert// invalidate any other reasons why the executable file might be covered by
30*404b540aSrobert// the GNU General Public License.
31*404b540aSrobert
32*404b540aSrobert/** @file c++config.h
33*404b540aSrobert *  This is an internal header file, included by other library headers.
34*404b540aSrobert *  You should not attempt to use it directly.
35*404b540aSrobert */
36*404b540aSrobert
37*404b540aSrobert#ifndef _CXXCONFIG
38*404b540aSrobert#define _CXXCONFIG 1
39*404b540aSrobert
40*404b540aSrobert// Pick up any OS-specific definitions.
41*404b540aSrobert#include <bits/os_defines.h>
42*404b540aSrobert
43*404b540aSrobert// Pick up any CPU-specific definitions.
44*404b540aSrobert#include <bits/cpu_defines.h>
45*404b540aSrobert
46*404b540aSrobert// The current version of the C++ library in compressed ISO date format.
47*404b540aSrobert#define __GLIBCXX__
48*404b540aSrobert
49*404b540aSrobert// Macros for visibility.
50*404b540aSrobert#define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
51*404b540aSrobert
52*404b540aSrobert#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY
53*404b540aSrobert#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))
54*404b540aSrobert#else
55*404b540aSrobert#define _GLIBCXX_VISIBILITY(V)
56*404b540aSrobert#endif
57*404b540aSrobert
58*404b540aSrobert// Macros for controlling various namespace association schemes and modes.
59*404b540aSrobert#ifdef _GLIBCXX_DEBUG
60*404b540aSrobert# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
61*404b540aSrobert#endif
62*404b540aSrobert
63*404b540aSrobert#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
64*404b540aSrobert
65*404b540aSrobert// Macros for namespace scope.
66*404b540aSrobert// _GLIBCXX_BEGIN_NAMESPACE
67*404b540aSrobert// _GLIBCXX_END_NAMESPACE
68*404b540aSrobert// _GLIBCXX_BEGIN_NESTED_NAMESPACE
69*404b540aSrobert// _GLIBCXX_END_NESTED_NAMESPACE
70*404b540aSrobert#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
71*404b540aSrobert# define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)  namespace X { namespace Y _GLIBCXX_VISIBILITY(default) {
72*404b540aSrobert# define _GLIBCXX_END_NESTED_NAMESPACE } }
73*404b540aSrobert# define _GLIBCXX_BEGIN_NAMESPACE(X) _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, _6)
74*404b540aSrobert# define _GLIBCXX_END_NAMESPACE _GLIBCXX_END_NESTED_NAMESPACE
75*404b540aSrobert#else
76*404b540aSrobert# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY(default) {
77*404b540aSrobert# define _GLIBCXX_END_NAMESPACE }
78*404b540aSrobert# if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
79*404b540aSrobert#  define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY(default) {
80*404b540aSrobert#  define _GLIBCXX_END_NESTED_NAMESPACE  } }
81*404b540aSrobert# else
82*404b540aSrobert#  define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) _GLIBCXX_BEGIN_NAMESPACE(X)
83*404b540aSrobert#  define _GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NAMESPACE
84*404b540aSrobert# endif
85*404b540aSrobert#endif
86*404b540aSrobert
87*404b540aSrobert// Namespace associations for versioning mode.
88*404b540aSrobert#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
89*404b540aSrobertnamespace std
90*404b540aSrobert{
91*404b540aSrobert  namespace _6 { }
92*404b540aSrobert  using namespace _6 __attribute__ ((strong));
93*404b540aSrobert}
94*404b540aSrobert
95*404b540aSrobert// In addition, other supported namespace configurations.
96*404b540aSrobertnamespace __gnu_cxx
97*404b540aSrobert{
98*404b540aSrobert  namespace _6 { }
99*404b540aSrobert  using namespace _6 __attribute__ ((strong));
100*404b540aSrobert}
101*404b540aSrobert
102*404b540aSrobertnamespace std
103*404b540aSrobert{
104*404b540aSrobert  namespace tr1
105*404b540aSrobert  {
106*404b540aSrobert    namespace _6 { }
107*404b540aSrobert    using namespace _6 __attribute__ ((strong));
108*404b540aSrobert  }
109*404b540aSrobert}
110*404b540aSrobert#endif
111*404b540aSrobert
112*404b540aSrobert// Namespace associations for debug mode.
113*404b540aSrobert#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
114*404b540aSrobertnamespace std
115*404b540aSrobert{
116*404b540aSrobert  namespace __norm { }
117*404b540aSrobert  namespace __debug { }
118*404b540aSrobert  using namespace __debug __attribute__ ((strong));
119*404b540aSrobert}
120*404b540aSrobert
121*404b540aSrobertnamespace __gnu_cxx
122*404b540aSrobert{
123*404b540aSrobert  namespace __norm { }
124*404b540aSrobert  namespace __debug { }
125*404b540aSrobert  using namespace __debug __attribute__ ((strong));
126*404b540aSrobert}
127*404b540aSrobert
128*404b540aSrobert# define _GLIBCXX_STD __norm
129*404b540aSrobert# define _GLIBCXX_EXT __norm
130*404b540aSrobert# define _GLIBCXX_EXTERN_TEMPLATE 0
131*404b540aSrobert# if __NO_INLINE__ && !__GXX_WEAK__
132*404b540aSrobert#  warning debug mode without inlining may fail due to lack of weak symbols
133*404b540aSrobert# endif
134*404b540aSrobert#else
135*404b540aSrobert#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
136*404b540aSrobert# define _GLIBCXX_STD _6
137*404b540aSrobert# define _GLIBCXX_EXT _6
138*404b540aSrobert#else
139*404b540aSrobert# define _GLIBCXX_STD std
140*404b540aSrobert# define _GLIBCXX_EXT __gnu_cxx
141*404b540aSrobert#endif
142*404b540aSrobert#endif
143*404b540aSrobert
144*404b540aSrobert/* Define if compatibility should be provided for -mlong-double-64. */
145*404b540aSrobert#undef _GLIBCXX_LONG_DOUBLE_COMPAT
146*404b540aSrobert
147*404b540aSrobert// XXX GLIBCXX_ABI Deprecated
148*404b540aSrobert// Namespace associations for long double 128 mode.
149*404b540aSrobert_GLIBCXX_BEGIN_NAMESPACE(std)
150*404b540aSrobert#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__
151*404b540aSrobert# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::
152*404b540aSrobert# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {
153*404b540aSrobert# define _GLIBCXX_END_LDBL_NAMESPACE }
154*404b540aSrobert  namespace __gnu_cxx_ldbl128 { }
155*404b540aSrobert  using namespace __gnu_cxx_ldbl128 __attribute__((__strong__));
156*404b540aSrobert#else
157*404b540aSrobert# define _GLIBCXX_LDBL_NAMESPACE
158*404b540aSrobert# define _GLIBCXX_BEGIN_LDBL_NAMESPACE
159*404b540aSrobert# define _GLIBCXX_END_LDBL_NAMESPACE
160*404b540aSrobert#endif
161*404b540aSrobert_GLIBCXX_END_NAMESPACE
162*404b540aSrobert
163*404b540aSrobert
164*404b540aSrobert// Allow use of "export template." This is currently not a feature
165*404b540aSrobert// that g++ supports.
166*404b540aSrobert// #define _GLIBCXX_EXPORT_TEMPLATE 1
167*404b540aSrobert
168*404b540aSrobert// Allow use of the GNU syntax extension, "extern template." This
169*404b540aSrobert// extension is fully documented in the g++ manual, but in a nutshell,
170*404b540aSrobert// it inhibits all implicit instantiations and is used throughout the
171*404b540aSrobert// library to avoid multiple weak definitions for required types that
172*404b540aSrobert// are already explicitly instantiated in the library binary. This
173*404b540aSrobert// substantially reduces the binary size of resulting executables.
174*404b540aSrobert#ifndef _GLIBCXX_EXTERN_TEMPLATE
175*404b540aSrobert# define _GLIBCXX_EXTERN_TEMPLATE 1
176*404b540aSrobert#endif
177*404b540aSrobert
178*404b540aSrobert
179*404b540aSrobert// Certain function definitions that are meant to be overridable from
180*404b540aSrobert// user code are decorated with this macro.  For some targets, this
181*404b540aSrobert// macro causes these definitions to be weak.
182*404b540aSrobert#ifndef _GLIBCXX_WEAK_DEFINITION
183*404b540aSrobert# define _GLIBCXX_WEAK_DEFINITION
184*404b540aSrobert#endif
185*404b540aSrobert
186*404b540aSrobert// The remainder of the prewritten config is automatic; all the
187*404b540aSrobert// user hooks are listed above.
188*404b540aSrobert
189*404b540aSrobert// Create a boolean flag to be used to determine if --fast-math is set.
190*404b540aSrobert#ifdef __FAST_MATH__
191*404b540aSrobert# define _GLIBCXX_FAST_MATH 1
192*404b540aSrobert#else
193*404b540aSrobert# define _GLIBCXX_FAST_MATH 0
194*404b540aSrobert#endif
195*404b540aSrobert
196*404b540aSrobert// This marks string literals in header files to be extracted for eventual
197*404b540aSrobert// translation.  It is primarily used for messages in thrown exceptions; see
198*404b540aSrobert// src/functexcept.cc.  We use __N because the more traditional _N is used
199*404b540aSrobert// for something else under certain OSes (see BADNAMES).
200*404b540aSrobert#define __N(msgid)     (msgid)
201*404b540aSrobert
202*404b540aSrobert// For example, <windows.h> is known to #define min and max as macros...
203*404b540aSrobert#undef min
204*404b540aSrobert#undef max
205*404b540aSrobert
206*404b540aSrobert// End of prewritten config; the discovered settings follow.
207