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