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