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#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) 62# include <endian.h> 63# if __BYTE_ORDER == __LITTLE_ENDIAN 64# define _LIBCPP_LITTLE_ENDIAN 1 65# define _LIBCPP_BIG_ENDIAN 0 66# elif __BYTE_ORDER == __BIG_ENDIAN 67# define _LIBCPP_LITTLE_ENDIAN 0 68# define _LIBCPP_BIG_ENDIAN 1 69# else // __BYTE_ORDER == __BIG_ENDIAN 70# error unable to determine endian 71# endif 72#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) 73 74#if _WIN32 75 76// only really useful for a DLL 77#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally... 78# ifdef cxx_EXPORTS 79# define _LIBCPP_HIDDEN 80# define _LIBCPP_VISIBLE __declspec(dllexport) 81# else 82# define _LIBCPP_HIDDEN 83# define _LIBCPP_VISIBLE __declspec(dllimport) 84# endif 85#else 86# define _LIBCPP_HIDDEN 87# define _LIBCPP_VISIBLE 88#endif 89 90#ifndef _LIBCPP_INLINE_VISIBILITY 91# if _MSC_VER 92# define _LIBCPP_INLINE_VISIBILITY __forceinline 93# else // MinGW GCC and Clang 94# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) 95# endif 96#endif 97 98#ifndef _LIBCPP_EXCEPTION_ABI 99#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE 100#endif 101 102#ifndef _LIBCPP_ALWAYS_INLINE 103# if _MSC_VER 104# define _LIBCPP_ALWAYS_INLINE __forceinline 105# endif 106#endif 107 108#endif // _WIN32 109 110#ifndef _LIBCPP_HIDDEN 111#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) 112#endif 113 114#ifndef _LIBCPP_VISIBLE 115#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) 116#endif 117 118#ifndef _LIBCPP_INLINE_VISIBILITY 119#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) 120#endif 121 122#ifndef _LIBCPP_EXCEPTION_ABI 123#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) 124#endif 125 126#ifndef _LIBCPP_CANTTHROW 127#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) 128#endif 129 130#ifndef _LIBCPP_ALWAYS_INLINE 131#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) 132#endif 133 134#if defined(__clang__) 135 136#if __has_feature(cxx_alignas) 137# define _ALIGNAS(x) alignas(x) 138#else 139# define _ALIGNAS(x) __attribute__((__aligned__(x))) 140#endif 141 142#if !__has_feature(cxx_alias_templates) 143#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 144#endif 145 146#ifndef __GXX_EXPERIMENTAL_CXX0X__ 147#ifdef __linux__ 148#define _LIBCPP_HAS_NO_UNICODE_CHARS 149#else 150typedef __char16_t char16_t; 151typedef __char32_t char32_t; 152#endif 153#endif 154 155#if !(__has_feature(cxx_exceptions)) 156#define _LIBCPP_NO_EXCEPTIONS 157#endif 158 159#if !(__has_feature(cxx_rtti)) 160#define _LIBCPP_NO_RTTI 161#endif 162 163#if !(__has_feature(cxx_decltype)) 164#define _LIBCPP_HAS_NO_DECLTYPE 165#endif 166 167#if __has_feature(cxx_attributes) 168# define _ATTRIBUTE(x) [[x]] 169#else 170# define _ATTRIBUTE(x) __attribute__ ((x)) 171#endif 172 173#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 174 175#if !(__has_feature(cxx_deleted_functions)) 176#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 177#endif // !(__has_feature(cxx_deleted_functions)) 178 179#if !(__has_feature(cxx_lambdas)) 180#define _LIBCPP_HAS_NO_LAMBDAS 181#endif 182 183#if !(__has_feature(cxx_nullptr)) 184#define _LIBCPP_HAS_NO_NULLPTR 185#endif 186 187#if !(__has_feature(cxx_rvalue_references)) 188#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 189#endif 190 191#if !(__has_feature(cxx_static_assert)) 192#define _LIBCPP_HAS_NO_STATIC_ASSERT 193#endif 194 195#if !(__has_feature(cxx_auto_type)) 196#define _LIBCPP_HAS_NO_AUTO_TYPE 197#endif 198 199#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return) 200#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 201#endif 202 203#if !(__has_feature(cxx_variadic_templates)) 204#define _LIBCPP_HAS_NO_VARIADICS 205#endif 206 207#if !(__has_feature(cxx_trailing_return)) 208#define _LIBCPP_HAS_NO_TRAILING_RETURN 209#endif 210 211#if !(__has_feature(cxx_generalized_initializers)) 212#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 213#endif 214 215#if __has_feature(is_base_of) 216# define _LIBCP_HAS_IS_BASE_OF 217#endif 218 219// Objective-C++ features (opt-in) 220#if __has_feature(objc_arc) 221#define _LIBCPP_HAS_OBJC_ARC 222#endif 223 224#if __has_feature(objc_arc_weak) 225#define _LIBCPP_HAS_OBJC_ARC_WEAK 226#endif 227 228#if !(__has_feature(cxx_constexpr)) 229#define _LIBCPP_HAS_NO_CONSTEXPR 230#endif 231 232#if (__has_feature(cxx_noexcept)) 233# define _NOEXCEPT noexcept 234# define _NOEXCEPT_(x) noexcept(x) 235#else 236# define _NOEXCEPT throw() 237# define _NOEXCEPT_(x) 238#endif 239 240#if __has_feature(underlying_type) 241# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) 242#endif 243 244// Inline namespaces are available in Clang regardless of C++ dialect. 245#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { 246#define _LIBCPP_END_NAMESPACE_STD } } 247#define _VSTD std::_LIBCPP_NAMESPACE 248 249namespace std { 250 inline namespace _LIBCPP_NAMESPACE { 251 } 252} 253 254#elif defined(__GNUC__) 255 256#define _ALIGNAS(x) __attribute__((__aligned__(x))) 257 258#define _ATTRIBUTE(x) __attribute__((x)) 259 260#if !__EXCEPTIONS 261#define _LIBCPP_NO_EXCEPTIONS 262#endif 263 264#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 265#define _LIBCPP_HAS_NO_CONSTEXPR 266 267#define _NOEXCEPT throw() 268#define _NOEXCEPT_(x) 269 270#ifndef __GXX_EXPERIMENTAL_CXX0X__ 271 272#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 273#define _LIBCPP_HAS_NO_DECLTYPE 274#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 275#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 276#define _LIBCPP_HAS_NO_NULLPTR 277#define _LIBCPP_HAS_NO_STATIC_ASSERT 278#define _LIBCPP_HAS_NO_UNICODE_CHARS 279#define _LIBCPP_HAS_NO_VARIADICS 280#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 281#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 282 283#else // __GXX_EXPERIMENTAL_CXX0X__ 284 285#define _LIBCPP_HAS_NO_TRAILING_RETURN 286#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS 287 288#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) 289#define _LIBCPP_HAS_NO_RVALUE_REFERENCES 290#endif 291 292#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) 293#define _LIBCPP_HAS_NO_STATIC_ASSERT 294#endif 295 296#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) 297#define _LIBCPP_HAS_NO_ADVANCED_SFINAE 298#define _LIBCPP_HAS_NO_DECLTYPE 299#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS 300#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 301#define _LIBCPP_HAS_NO_UNICODE_CHARS 302#define _LIBCPP_HAS_NO_VARIADICS 303#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 304#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) 305 306#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) 307#define _LIBCPP_HAS_NO_NULLPTR 308#endif 309 310#endif // __GXX_EXPERIMENTAL_CXX0X__ 311 312#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { 313#define _LIBCPP_END_NAMESPACE_STD } } 314#define _VSTD std::_LIBCPP_NAMESPACE 315 316namespace std { 317namespace _LIBCPP_NAMESPACE { 318} 319using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); 320} 321 322#elif defined(_MSC_VER) 323 324#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES 325#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 326#define _LIBCPP_HAS_NO_CONSTEXPR 327#define _LIBCPP_HAS_NO_UNICODE_CHARS 328#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS 329#define __alignof__ __alignof 330#define _ATTRIBUTE __declspec 331#define _ALIGNAS(x) __declspec(align(x)) 332#define _LIBCPP_HAS_NO_VARIADICS 333 334#define _NOEXCEPT throw() 335#define _NOEXCEPT_(x) 336 337#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { 338#define _LIBCPP_END_NAMESPACE_STD } 339#define _VSTD std 340 341namespace std { 342} 343 344#endif // __clang__ || __GNUC___ || _MSC_VER 345 346#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS 347typedef unsigned short char16_t; 348typedef unsigned int char32_t; 349#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 350 351#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT 352 353template <bool> struct __static_assert_test; 354template <> struct __static_assert_test<true> {}; 355template <unsigned> struct __static_assert_check {}; 356#define static_assert(__b, __m) \ 357 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ 358 _LIBCPP_CONCAT(__t, __LINE__) 359 360#endif // _LIBCPP_HAS_NO_STATIC_ASSERT 361 362#ifdef _LIBCPP_HAS_NO_DECLTYPE 363#define decltype(x) __typeof__(x) 364#endif 365 366#ifdef _LIBCPP_HAS_NO_CONSTEXPR 367#define constexpr const 368#endif 369 370#ifndef __has_feature 371#define __has_feature(__x) 0 372#endif 373 374#if __APPLE__ || __FreeBSD__ || _WIN32 375#define _LIBCPP_LOCALE__L_EXTENSIONS 1 376#endif 377#if __FreeBSD__ 378#define _DECLARE_C99_LDBL_MATH 1 379#endif 380 381#if __APPLE__ || __FreeBSD__ 382#define _LIBCPP_HAS_DEFAULTRUNELOCALE 383#endif 384 385#if __APPLE__ || __FreeBSD__ 386#define _LIBCPP_WCTYPE_IS_MASK 387#endif 388 389#ifdef _LIBCPP_DEBUG2 390# if _LIBCPP_DEBUG2 == 0 391# define _LIBCPP_DEBUG_LEVEL 1 392# elif _LIBCPP_DEBUG2 == 1 393# define _LIBCPP_DEBUG_LEVEL 2 394# else 395# error Supported values for _LIBCPP_DEBUG2 are 0 and 1 396# endif 397#endif 398 399#ifdef _LIBCPP_DEBUG2 400# include <__debug> 401#else 402# define _LIBCPP_ASSERT(x, m) ((void)0) 403#endif 404 405#endif // _LIBCPP_CONFIG 406