1// Predefined symbols and macros -*- C++ -*- 2 3// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 4// 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 5// 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) 10// any later version. 11 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. 16 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. 20 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/>. 25 26/** @file c++config.h 27 * This is an internal header file, included by other library headers. 28 * You should not attempt to use it directly. 29 */ 30 31#ifndef _GLIBCXX_CXX_CONFIG_H 32#define _GLIBCXX_CXX_CONFIG_H 1 33 34// The current version of the C++ library in compressed ISO date format. 35#define __GLIBCXX__ 36 37// Macros for visibility. 38// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 39// _GLIBCXX_VISIBILITY_ATTR 40#define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 41 42#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 43# define _GLIBCXX_VISIBILITY_ATTR(V) __attribute__ ((__visibility__ (#V))) 44#else 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) 48#endif 49 50// Macros for deprecated. 51// _GLIBCXX_DEPRECATED 52// _GLIBCXX_DEPRECATED_ATTR 53#ifndef _GLIBCXX_DEPRECATED 54# define _GLIBCXX_DEPRECATED 1 55#endif 56 57#if defined(__DEPRECATED) && defined(__GXX_EXPERIMENTAL_CXX0X__) 58# define _GLIBCXX_DEPRECATED_ATTR __attribute__ ((__deprecated__)) 59#else 60# define _GLIBCXX_DEPRECATED_ATTR 61#endif 62 63// Macros for activating various namespace association modes. 64// _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 65// _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 66// _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION 67 68// Guide to libstdc++ namespaces. 69/* 70 namespace std 71 { 72 namespace __debug { } 73 namespace __parallel { } 74 namespace __norm { } // __normative, __shadow, __replaced 75 namespace __cxx1998 { } 76 77 namespace tr1 { } 78 } 79*/ 80#if __cplusplus 81 82#ifdef _GLIBCXX_DEBUG 83# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1 84#endif 85 86#ifdef _GLIBCXX_PARALLEL 87# define _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 1 88#endif 89 90// Namespace association for profile 91#ifdef _GLIBCXX_PROFILE 92# define _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 1 93#endif 94 95#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION 96 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 103#endif 104 105// Macros for namespace scope. Either namespace std:: or the name 106// of some nested namespace within it. 107// _GLIBCXX_STD 108// _GLIBCXX_STD_D 109// _GLIBCXX_STD_P 110// 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 } 125#else 126 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 133# endif 134 135// debug 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 143# endif 144 145// parallel 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 } 152# endif 153 154// debug + parallel 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 162# endif 163 164// profile 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 \ 168 -D_GLIBCXX_PARALLEL 169# endif 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 } 176# endif 177 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 181# endif 182 183# define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY_ATTR(default) { 184# define _GLIBCXX_END_NESTED_NAMESPACE } } 185#endif 186 187// Namespace associations for debug mode. 188#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 189namespace std 190{ 191 namespace __norm { } 192 inline namespace __debug { } 193 inline namespace __cxx1998 { } 194} 195#endif 196 197// Namespace associations for parallel mode. 198#if _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 199namespace std 200{ 201 namespace __norm { } 202 inline namespace __parallel { } 203 inline namespace __cxx1998 { } 204} 205#endif 206 207// Namespace associations for profile mode 208#if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 209namespace std 210{ 211 namespace __norm { } 212 inline namespace __profile { } 213 inline namespace __cxx1998 { } 214} 215#endif 216 217// Namespace associations for versioning mode. 218#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION 219namespace std 220{ 221 inline namespace _6 { } 222} 223 224namespace __gnu_cxx 225{ 226 inline namespace _6 { } 227} 228 229namespace std 230{ 231 namespace tr1 232 { 233 inline namespace _6 { } 234 } 235} 236#endif 237 238// XXX GLIBCXX_ABI Deprecated 239// Define if compatibility should be provided for -mlong-double-64 240#undef _GLIBCXX_LONG_DOUBLE_COMPAT 241 242// Namespace associations for long double 128 mode. 243#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 244namespace std 245{ 246 inline namespace __gnu_cxx_ldbl128 { } 247} 248# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128:: 249# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 { 250# define _GLIBCXX_END_LDBL_NAMESPACE } 251#else 252# define _GLIBCXX_LDBL_NAMESPACE 253# define _GLIBCXX_BEGIN_LDBL_NAMESPACE 254# define _GLIBCXX_END_LDBL_NAMESPACE 255#endif 256 257 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 } 262 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 270#endif 271 272// First includes. 273 274// Pick up any OS-specific definitions. 275#include <bits/os_defines.h> 276 277// Pick up any CPU-specific definitions. 278#include <bits/cpu_defines.h> 279 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) 284#endif 285 286// Allow use of "export template." This is currently not a feature 287// that g++ supports. 288// #define _GLIBCXX_EXPORT_TEMPLATE 1 289 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. 296 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 302#endif 303 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 309#endif 310 311// Assert. 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) 316#else 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. 320 inline void 321 __replacement_assert(const char* __file, int __line, 322 const char* __function, const char* __condition) 323 { 324 __builtin_printf("%s:%d: %s: Assertion '%s' failed.\n", __file, __line, 325 __function, __condition); 326 __builtin_abort(); 327 } 328_GLIBCXX_END_NAMESPACE 329 330#define __glibcxx_assert(_Condition) \ 331 do \ 332 { \ 333 if (! (_Condition)) \ 334 std::__replacement_assert(__FILE__, __LINE__, \ 335 __PRETTY_FUNCTION__, #_Condition); \ 336 } while (false) 337#endif 338 339// The remainder of the prewritten config is automatic; all the 340// user hooks are listed above. 341 342// Create a boolean flag to be used to determine if --fast-math is set. 343#ifdef __FAST_MATH__ 344# define _GLIBCXX_FAST_MATH 1 345#else 346# define _GLIBCXX_FAST_MATH 0 347#endif 348 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) 354 355// For example, <windows.h> is known to #define min and max as macros... 356#undef min 357#undef max 358 359#ifndef _GLIBCXX_PURE 360# define _GLIBCXX_PURE __attribute__ ((__pure__)) 361#endif 362 363#ifndef _GLIBCXX_CONST 364# define _GLIBCXX_CONST __attribute__ ((__const__)) 365#endif 366 367#ifndef _GLIBCXX_NORETURN 368# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) 369#endif 370 371#ifndef _GLIBCXX_NOTHROW 372# ifdef __cplusplus 373# define _GLIBCXX_NOTHROW throw() 374# else 375# define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) 376# endif 377#endif 378 379// End of prewritten config; the discovered settings follow. 380