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