__config revision 232950
1// -*- C++ -*- 2//===--------------------------- __config ---------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 6// This file is dual licensed under the MIT and the University of Illinois Open 7// Source Licenses. See LICENSE.TXT for details. 8// 9//===----------------------------------------------------------------------===// 10 11#ifndef _LIBCPP_CONFIG 12#define _LIBCPP_CONFIG 13 14#if !_MSC_VER // explicit macro necessary because it is only defined below in this file 15#pragma GCC system_header 16#endif 17 18#define _LIBCPP_VERSION 1001 19 20#define _LIBCPP_ABI_VERSION 1 21 22#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y 23#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) 24 25#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) 26 27#ifdef __LITTLE_ENDIAN__ 28#if __LITTLE_ENDIAN__ 29#define _LIBCPP_LITTLE_ENDIAN 1 30#define _LIBCPP_BIG_ENDIAN 0 31#endif // __LITTLE_ENDIAN__ 32#endif // __LITTLE_ENDIAN__ 33 34#ifdef __BIG_ENDIAN__ 35#if __BIG_ENDIAN__ 36#define _LIBCPP_LITTLE_ENDIAN 0 37#define _LIBCPP_BIG_ENDIAN 1 38#endif // __BIG_ENDIAN__ 39#endif // __BIG_ENDIAN__ 40 41#ifdef __FreeBSD__ 42# include <sys/endian.h> 43# if _BYTE_ORDER == _LITTLE_ENDIAN 44# define _LIBCPP_LITTLE_ENDIAN 1 45# define _LIBCPP_BIG_ENDIAN 0 46# else // _BYTE_ORDER == _LITTLE_ENDIAN 47# define _LIBCPP_LITTLE_ENDIAN 0 48# define _LIBCPP_BIG_ENDIAN 1 49# endif // _BYTE_ORDER == _LITTLE_ENDIAN 50#endif // __FreeBSD__ 51 52#ifdef _WIN32 53# define _LIBCPP_LITTLE_ENDIAN 1 54# define _LIBCPP_BIG_ENDIAN 0 55// Compiler intrinsics (GCC or MSVC) 56# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3) 57# define _LIBCP_HAS_IS_BASE_OF 58# endif 59#endif // _WIN32 60 61#ifdef __sun__ 62# include <sys/isa_defs.h> 63# ifdef _LITTLE_ENDIAN 64# define _LIBCPP_LITTLE_ENDIAN 1 65# define _LIBCPP_BIG_ENDIAN 0 66# else 67# define _LIBCPP_LITTLE_ENDIAN 0 68# define _LIBCPP_BIG_ENDIAN 1 69# endif 70#endif // __sun__ 71 72#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) 73# include <endian.h> 74# if __BYTE_ORDER == __LITTLE_ENDIAN 75# define _LIBCPP_LITTLE_ENDIAN 1 76# define _LIBCPP_BIG_ENDIAN 0 77# elif __BYTE_ORDER == __BIG_ENDIAN 78# define _LIBCPP_LITTLE_ENDIAN 0 79# define _LIBCPP_BIG_ENDIAN 1 80# else // __BYTE_ORDER == __BIG_ENDIAN 81# error unable to determine endian 82# endif 83#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) 84 85#if _WIN32 86 87// only really useful for a DLL 88#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally... 89# ifdef cxx_EXPORTS 90# define _LIBCPP_HIDDEN 91# define _LIBCPP_VISIBLE __declspec(dllexport) 92# else 93# define _LIBCPP_HIDDEN 94# define _LIBCPP_VISIBLE __declspec(dllimport) 95# endif 96#else 97# define _LIBCPP_HIDDEN 98# define _LIBCPP_VISIBLE 99#endif 100 101#ifndef _LIBCPP_INLINE_VISIBILITY 102# if _MSC_VER 103# define _LIBCPP_INLINE_VISIBILITY __forceinline 104# else // MinGW GCC and Clang 105# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) 106# endif 107#endif 108 109#ifndef _LIBCPP_EXCEPTION_ABI 110#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE 111#endif 112 113#ifndef _LIBCPP_ALWAYS_INLINE 114# if _MSC_VER 115# define _LIBCPP_ALWAYS_INLINE __forceinline 116# endif 117#endif 118 119#endif // _WIN32 120 121#ifndef _LIBCPP_HIDDEN 122#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) 123#endif 124 125#ifndef _LIBCPP_VISIBLE 126#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) 127#endif 128 129#ifndef _LIBCPP_INLINE_VISIBILITY 130#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) 131#endif 132 133#ifndef _LIBCPP_EXCEPTION_ABI 134#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) 135#endif 136 137#ifndef _LIBCPP_CANTTHROW 138#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) 139#endif 140 141#ifndef _LIBCPP_ALWAYS_INLINE 142#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) 143#endif 144 145#if defined(__clang__) 146 147#if __has_feature(cxx_alignas) 148# define _ALIGNAS(x) alignas(x) 149#else 150# define _ALIGNAS(x) __attribute__((__aligned__(x))) 151#endif 152 153#if !__has_feature(cxx_alias_templates) 154#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 155#endif 156 157#ifndef __GXX_EXPERIMENTAL_CXX0X__ 158#ifdef __linux__ 159#define _LIBCPP_HAS_NO_UNICODE_CHARS 160#else 161typedef __char16_t char16_t; 162typedef __char32_t char32_t; 163#endif 164#endif 165 166#if !(__has_feature(cxx_exceptions)) 167#define _LIBCPP_NO_EXCEPTIONS 168#endif 169 170#if !(__has_feature(cxx_rtti)) 171#define _LIBCPP_NO_RTTI 172#endif 173 174#if !(__has_feature(cxx_strong_enums)) 175#define _LIBCPP_HAS_NO_STRONG_ENUMS 176#endif 177 178#if !(__has_feature(cxx_decltype)) 179#define _LIBCPP_HAS_NO_DECLTYPE 180#endif 181 182#if __has_feature(cxx_attributes) 183# define _ATTRIBUTE(x) [[x]] 184#else 185# define _ATTRIBUTE(x) __attribute__ ((x)) 186#endif 187 188#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 189 190#if !(__has_feature(cxx_deleted_functions)) 191#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 192#endif // !(__has_feature(cxx_deleted_functions)) 193 194#if !(__has_feature(cxx_lambdas)) 195#define _LIBCPP_HAS_NO_LAMBDAS 196#endif 197 198#if !(__has_feature(cxx_nullptr)) 199#define _LIBCPP_HAS_NO_NULLPTR 200#endif 201 202#if !(__has_feature(cxx_rvalue_references)) 203#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 204#endif 205 206#if !(__has_feature(cxx_static_assert)) 207#define _LIBCPP_HAS_NO_STATIC_ASSERT 208#endif 209 210#if !(__has_feature(cxx_auto_type)) 211#define _LIBCPP_HAS_NO_AUTO_TYPE 212#endif 213 214#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return) 215#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 216#endif 217 218#if !(__has_feature(cxx_variadic_templates)) 219#define _LIBCPP_HAS_NO_VARIADICS 220#endif 221 222#if !(__has_feature(cxx_trailing_return)) 223#define _LIBCPP_HAS_NO_TRAILING_RETURN 224#endif 225 226#if !(__has_feature(cxx_generalized_initializers)) 227#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 228#endif 229 230#if __has_feature(is_base_of) 231# define _LIBCP_HAS_IS_BASE_OF 232#endif 233 234// Objective-C++ features (opt-in) 235#if __has_feature(objc_arc) 236#define _LIBCPP_HAS_OBJC_ARC 237#endif 238 239#if __has_feature(objc_arc_weak) 240#define _LIBCPP_HAS_OBJC_ARC_WEAK 241#define _LIBCPP_HAS_NO_STRONG_ENUMS 242#endif 243 244#if !(__has_feature(cxx_constexpr)) 245#define _LIBCPP_HAS_NO_CONSTEXPR 246#endif 247 248#if (__has_feature(cxx_noexcept)) 249# define _NOEXCEPT noexcept 250# define _NOEXCEPT_(x) noexcept(x) 251#else 252# define _NOEXCEPT throw() 253# define _NOEXCEPT_(x) 254#endif 255 256#if __has_feature(underlying_type) 257# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) 258#endif 259 260// Inline namespaces are available in Clang regardless of C++ dialect. 261#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { 262#define _LIBCPP_END_NAMESPACE_STD } } 263#define _VSTD std::_LIBCPP_NAMESPACE 264 265namespace std { 266 inline namespace _LIBCPP_NAMESPACE { 267 } 268} 269 270#elif defined(__GNUC__) 271 272#define _ALIGNAS(x) __attribute__((__aligned__(x))) 273 274#define _ATTRIBUTE(x) __attribute__((x)) 275 276#if !__EXCEPTIONS 277#define _LIBCPP_NO_EXCEPTIONS 278#endif 279 280#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 281#define _LIBCPP_HAS_NO_CONSTEXPR 282 283#define _NOEXCEPT throw() 284#define _NOEXCEPT_(x) 285 286#ifndef __GXX_EXPERIMENTAL_CXX0X__ 287 288#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 289#define _LIBCPP_HAS_NO_DECLTYPE 290#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 291#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 292#define _LIBCPP_HAS_NO_NULLPTR 293#define _LIBCPP_HAS_NO_STATIC_ASSERT 294#define _LIBCPP_HAS_NO_UNICODE_CHARS 295#define _LIBCPP_HAS_NO_VARIADICS 296#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 297#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 298 299#else // __GXX_EXPERIMENTAL_CXX0X__ 300 301#define _LIBCPP_HAS_NO_TRAILING_RETURN 302#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 303 304#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) 305#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 306#endif 307 308#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) 309#define _LIBCPP_HAS_NO_STATIC_ASSERT 310#endif 311 312#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) 313#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 314#define _LIBCPP_HAS_NO_DECLTYPE 315#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 316#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 317#define _LIBCPP_HAS_NO_UNICODE_CHARS 318#define _LIBCPP_HAS_NO_VARIADICS 319#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 320#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) 321 322#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) 323#define _LIBCPP_HAS_NO_NULLPTR 324#endif 325 326#endif // __GXX_EXPERIMENTAL_CXX0X__ 327 328#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { 329#define _LIBCPP_END_NAMESPACE_STD } } 330#define _VSTD std::_LIBCPP_NAMESPACE 331 332namespace std { 333namespace _LIBCPP_NAMESPACE { 334} 335using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); 336} 337 338#elif defined(_MSC_VER) 339 340#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 341#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 342#define _LIBCPP_HAS_NO_CONSTEXPR 343#define _LIBCPP_HAS_NO_UNICODE_CHARS 344#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 345#define __alignof__ __alignof 346#define _ATTRIBUTE __declspec 347#define _ALIGNAS(x) __declspec(align(x)) 348#define _LIBCPP_HAS_NO_VARIADICS 349 350#define _NOEXCEPT throw() 351#define _NOEXCEPT_(x) 352 353#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { 354#define _LIBCPP_END_NAMESPACE_STD } 355#define _VSTD std 356 357namespace std { 358} 359 360#endif // __clang__ || __GNUC___ || _MSC_VER 361 362#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS 363typedef unsigned short char16_t; 364typedef unsigned int char32_t; 365#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 366 367#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT 368 369template <bool> struct __static_assert_test; 370template <> struct __static_assert_test<true> {}; 371template <unsigned> struct __static_assert_check {}; 372#define static_assert(__b, __m) \ 373 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ 374 _LIBCPP_CONCAT(__t, __LINE__) 375 376#endif // _LIBCPP_HAS_NO_STATIC_ASSERT 377 378#ifdef _LIBCPP_HAS_NO_DECLTYPE 379#define decltype(x) __typeof__(x) 380#endif 381 382#ifdef _LIBCPP_HAS_NO_CONSTEXPR 383#define constexpr const 384#endif 385 386#ifndef __has_feature 387#define __has_feature(__x) 0 388#endif 389 390#if __has_feature(cxx_explicit_conversions) 391# define _LIBCPP_EXPLICIT explicit 392#else 393# define _LIBCPP_EXPLICIT 394#endif 395 396#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS 397#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum _ 398#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ 399 _ __v_; \ 400 _LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \ 401 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ 402 }; 403#else // _LIBCPP_HAS_NO_STRONG_ENUMS 404#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x 405#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) 406#endif // _LIBCPP_HAS_NO_STRONG_ENUMS 407 408#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__ 409#define _LIBCPP_LOCALE__L_EXTENSIONS 1 410#endif 411#if __FreeBSD__ 412#define _DECLARE_C99_LDBL_MATH 1 413#endif 414 415#if __APPLE__ || __FreeBSD__ 416#define _LIBCPP_HAS_DEFAULTRUNELOCALE 417#endif 418 419#if __APPLE__ || __FreeBSD__ || __sun__ 420#define _LIBCPP_WCTYPE_IS_MASK 421#endif 422 423#ifdef _LIBCPP_DEBUG2 424# if _LIBCPP_DEBUG2 == 0 425# define _LIBCPP_DEBUG_LEVEL 1 426# elif _LIBCPP_DEBUG2 == 1 427# define _LIBCPP_DEBUG_LEVEL 2 428# else 429# error Supported values for _LIBCPP_DEBUG2 are 0 and 1 430# endif 431#endif 432 433#ifdef _LIBCPP_DEBUG2 434# include <__debug> 435#else 436# define _LIBCPP_ASSERT(x, m) ((void)0) 437#endif 438 439#endif // _LIBCPP_CONFIG 440