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 !defined(_MSC_VER) || defined(__clang__)
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 __NetBSD__
60# include <sys/endian.h>
61#  if _BYTE_ORDER == _LITTLE_ENDIAN
62#   define _LIBCPP_LITTLE_ENDIAN 1
63#   define _LIBCPP_BIG_ENDIAN    0
64# else  // _BYTE_ORDER == _LITTLE_ENDIAN
65#   define _LIBCPP_LITTLE_ENDIAN 0
66#   define _LIBCPP_BIG_ENDIAN    1
67# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
68# define _LIBCPP_HAS_QUICK_EXIT
69#endif  // __NetBSD__
70
71#ifdef _WIN32
72#  define _LIBCPP_LITTLE_ENDIAN 1
73#  define _LIBCPP_BIG_ENDIAN    0
74// Compiler intrinsics (GCC or MSVC)
75#  if defined(__clang__) \
76   || (defined(_MSC_VER) && _MSC_VER >= 1400) \
77   || (defined(__GNUC__) && _GNUC_VER > 403)
78#    define _LIBCPP_HAS_IS_BASE_OF
79#  endif
80#  if defined(_MSC_VER) && !defined(__clang__)
81#    define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
82#    define _LIBCPP_TOSTRING2(x) #x
83#    define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
84#    define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
85#  endif
86#  // If mingw not explicitly detected, assume using MS C runtime only.
87#  ifndef __MINGW32__
88#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
89#  endif
90#endif  // _WIN32
91
92#ifdef __linux__
93#  if defined(__GNUC__) && _GNUC_VER >= 403
94#    define _LIBCPP_HAS_IS_BASE_OF
95#  endif
96#endif
97
98#ifdef __sun__
99# include <sys/isa_defs.h>
100# ifdef _LITTLE_ENDIAN
101#   define _LIBCPP_LITTLE_ENDIAN 1
102#   define _LIBCPP_BIG_ENDIAN    0
103# else
104#   define _LIBCPP_LITTLE_ENDIAN 0
105#   define _LIBCPP_BIG_ENDIAN    1
106# endif
107#endif // __sun__
108
109#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
110# include <endian.h>
111# if __BYTE_ORDER == __LITTLE_ENDIAN
112#  define _LIBCPP_LITTLE_ENDIAN 1
113#  define _LIBCPP_BIG_ENDIAN    0
114# elif __BYTE_ORDER == __BIG_ENDIAN
115#  define _LIBCPP_LITTLE_ENDIAN 0
116#  define _LIBCPP_BIG_ENDIAN    1
117# else  // __BYTE_ORDER == __BIG_ENDIAN
118#  error unable to determine endian
119# endif
120#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
121
122#ifdef _WIN32
123
124// only really useful for a DLL
125#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
126# ifdef cxx_EXPORTS
127#  define _LIBCPP_HIDDEN
128#  define _LIBCPP_FUNC_VIS __declspec(dllexport)
129#  define _LIBCPP_TYPE_VIS __declspec(dllexport)
130# else
131#  define _LIBCPP_HIDDEN
132#  define _LIBCPP_FUNC_VIS __declspec(dllimport)
133#  define _LIBCPP_TYPE_VIS __declspec(dllimport)
134# endif
135#else
136# define _LIBCPP_HIDDEN
137# define _LIBCPP_FUNC_VIS
138# define _LIBCPP_TYPE_VIS
139#endif
140
141#define _LIBCPP_TYPE_VIS_ONLY
142#define _LIBCPP_FUNC_VIS_ONLY
143
144#ifndef _LIBCPP_INLINE_VISIBILITY
145# ifdef _LIBCPP_MSVC
146#  define _LIBCPP_INLINE_VISIBILITY __forceinline
147# else // MinGW GCC and Clang
148#  define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
149# endif
150#endif
151
152#ifndef _LIBCPP_EXCEPTION_ABI
153#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
154#endif
155
156#ifndef _LIBCPP_ALWAYS_INLINE
157# ifdef _LIBCPP_MSVC
158#  define _LIBCPP_ALWAYS_INLINE __forceinline
159# endif
160#endif
161
162#endif // _WIN32
163
164#ifndef __has_attribute
165#define __has_attribute(__x) 0
166#endif
167
168#ifndef _LIBCPP_HIDDEN
169#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
170#endif
171
172#ifndef _LIBCPP_FUNC_VIS
173#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
174#endif
175
176#ifndef _LIBCPP_TYPE_VIS
177#  if __has_attribute(__type_visibility__)
178#    define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
179#  else
180#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
181#  endif
182#endif
183
184#ifndef _LIBCPP_TYPE_VIS_ONLY
185# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
186#endif
187
188#ifndef _LIBCPP_FUNC_VIS_ONLY
189# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
190#endif
191
192#ifndef _LIBCPP_INLINE_VISIBILITY
193#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
194#define _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49 _LIBCPP_INLINE_VISIBILITY
195#endif
196
197#ifndef _LIBCPP_EXCEPTION_ABI
198#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
199#endif
200
201#ifndef _LIBCPP_ALWAYS_INLINE
202#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
203#define _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 _LIBCPP_ALWAYS_INLINE
204#endif
205
206#if defined(__clang__)
207
208#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&        \
209    !defined(__arm__)
210#define _LIBCPP_ALTERNATE_STRING_LAYOUT
211#endif
212
213#if __has_feature(cxx_alignas)
214#  define _ALIGNAS_TYPE(x) alignas(x)
215#  define _ALIGNAS(x) alignas(x)
216#else
217#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
218#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
219#endif
220
221#if !__has_feature(cxx_alias_templates)
222#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
223#endif
224
225#if __cplusplus < 201103L
226#ifdef __linux__
227#define _LIBCPP_HAS_NO_UNICODE_CHARS
228#else
229typedef __char16_t char16_t;
230typedef __char32_t char32_t;
231#endif
232#endif
233
234#if !(__has_feature(cxx_exceptions))
235#define _LIBCPP_NO_EXCEPTIONS
236#endif
237
238#if !(__has_feature(cxx_rtti))
239#define _LIBCPP_NO_RTTI
240#endif
241
242#if !(__has_feature(cxx_strong_enums))
243#define _LIBCPP_HAS_NO_STRONG_ENUMS
244#endif
245
246#if !(__has_feature(cxx_decltype))
247#define _LIBCPP_HAS_NO_DECLTYPE
248#endif
249
250#if __has_feature(cxx_attributes)
251#  define _LIBCPP_NORETURN [[noreturn]]
252#else
253#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
254#endif
255
256#if !(__has_feature(cxx_defaulted_functions))
257#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
258#endif  // !(__has_feature(cxx_defaulted_functions))
259
260#if !(__has_feature(cxx_deleted_functions))
261#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
262#endif  // !(__has_feature(cxx_deleted_functions))
263
264#if !(__has_feature(cxx_lambdas))
265#define _LIBCPP_HAS_NO_LAMBDAS
266#endif
267
268#if !(__has_feature(cxx_nullptr))
269#define _LIBCPP_HAS_NO_NULLPTR
270#endif
271
272#if !(__has_feature(cxx_rvalue_references))
273#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
274#endif
275
276#if !(__has_feature(cxx_static_assert))
277#define _LIBCPP_HAS_NO_STATIC_ASSERT
278#endif
279
280#if !(__has_feature(cxx_auto_type))
281#define _LIBCPP_HAS_NO_AUTO_TYPE
282#endif
283
284#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
285#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
286#endif
287
288#if !(__has_feature(cxx_variadic_templates))
289#define _LIBCPP_HAS_NO_VARIADICS
290#endif
291
292#if !(__has_feature(cxx_trailing_return))
293#define _LIBCPP_HAS_NO_TRAILING_RETURN
294#endif
295
296#if !(__has_feature(cxx_generalized_initializers))
297#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
298#endif
299
300#if __has_feature(is_base_of)
301#  define _LIBCPP_HAS_IS_BASE_OF
302#endif
303
304// Objective-C++ features (opt-in)
305#if __has_feature(objc_arc)
306#define _LIBCPP_HAS_OBJC_ARC
307#endif
308
309#if __has_feature(objc_arc_weak)
310#define _LIBCPP_HAS_OBJC_ARC_WEAK
311#define _LIBCPP_HAS_NO_STRONG_ENUMS
312#endif
313
314#if !(__has_feature(cxx_constexpr))
315#define _LIBCPP_HAS_NO_CONSTEXPR
316#endif
317
318#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
319#if defined(__FreeBSD__)
320#define _LIBCPP_HAS_QUICK_EXIT
321#define _LIBCPP_HAS_C11_FEATURES
322#elif defined(__linux__) && defined(__GLIBC__)
323#include <features.h>
324#if __GLIBC_PREREQ(2, 15)
325#define _LIBCPP_HAS_QUICK_EXIT
326#endif
327#if __GLIBC_PREREQ(2, 17)
328#define _LIBCPP_HAS_C11_FEATURES
329#endif
330#endif
331#endif
332
333#if (__has_feature(cxx_noexcept))
334#  define _NOEXCEPT noexcept
335#  define _NOEXCEPT_(x) noexcept(x)
336#  define _NOEXCEPT_OR_FALSE(x) noexcept(x)
337#else
338#  define _NOEXCEPT throw()
339#  define _NOEXCEPT_(x)
340#  define _NOEXCEPT_OR_FALSE(x) false
341#endif
342
343#if __has_feature(underlying_type)
344#  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
345#endif
346
347#if __has_feature(is_literal)
348#  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
349#endif
350
351// Inline namespaces are available in Clang regardless of C++ dialect.
352#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
353#define _LIBCPP_END_NAMESPACE_STD  } }
354#define _VSTD std::_LIBCPP_NAMESPACE
355
356namespace std {
357  inline namespace _LIBCPP_NAMESPACE {
358  }
359}
360
361#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
362#define _LIBCPP_HAS_NO_ASAN
363#endif
364
365#elif defined(__GNUC__)
366
367// FixME: GCC4.9 fails some always_inline cases
368# if (_GNUC_VER == 409)
369#undef _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49
370#define _LIBCPP_ALWAYS_INLINE_EXCEPT_GCC49 inline
371#undef _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49
372#define _LIBCPP_INLINE_VISIBILITY_EXCEPT_GCC49
373#endif
374
375#define _ALIGNAS(x) __attribute__((__aligned__(x)))
376#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
377
378#define _LIBCPP_NORETURN __attribute__((noreturn))
379
380#if _GNUC_VER >= 407
381#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
382#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
383#endif
384
385#if !__EXCEPTIONS
386#define _LIBCPP_NO_EXCEPTIONS
387#endif
388
389#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
390
391// constexpr was added to GCC in 4.6
392#if _GNUC_VER < 406
393#define _LIBCPP_HAS_NO_CONSTEXPR
394// Can only use constexpr in c++11 mode.
395#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
396#define _LIBCPP_HAS_NO_CONSTEXPR
397#endif
398
399#define _NOEXCEPT throw()
400#define _NOEXCEPT_(x)
401#define _NOEXCEPT_OR_FALSE(x) false
402
403#ifndef __GXX_EXPERIMENTAL_CXX0X__
404
405#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
406#define _LIBCPP_HAS_NO_DECLTYPE
407#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
408#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
409#define _LIBCPP_HAS_NO_NULLPTR
410#define _LIBCPP_HAS_NO_STATIC_ASSERT
411#define _LIBCPP_HAS_NO_UNICODE_CHARS
412#define _LIBCPP_HAS_NO_VARIADICS
413#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
414#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
415#define _LIBCPP_HAS_NO_STRONG_ENUMS
416
417#else  // __GXX_EXPERIMENTAL_CXX0X__
418
419#define _LIBCPP_HAS_NO_TRAILING_RETURN
420#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
421
422#if _GNUC_VER < 403
423#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
424#endif
425
426#if _GNUC_VER < 403
427#define _LIBCPP_HAS_NO_STATIC_ASSERT
428#endif
429
430#if _GNUC_VER < 404
431#define _LIBCPP_HAS_NO_DECLTYPE
432#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
433#define _LIBCPP_HAS_NO_UNICODE_CHARS
434#define _LIBCPP_HAS_NO_VARIADICS
435#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
436#endif  // _GNUC_VER < 404
437
438#if _GNUC_VER < 406
439#define _LIBCPP_HAS_NO_NULLPTR
440#endif
441
442#if _GNUC_VER < 407
443#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
444#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
445#endif
446
447#endif  // __GXX_EXPERIMENTAL_CXX0X__
448
449#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
450#define _LIBCPP_END_NAMESPACE_STD  } }
451#define _VSTD std::_LIBCPP_NAMESPACE
452
453namespace std {
454namespace _LIBCPP_NAMESPACE {
455}
456using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
457}
458
459#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
460#define _LIBCPP_HAS_NO_ASAN
461#endif
462
463// Emulation of clang's __has_feature() for GCC on known cases
464#undef __has_feature
465#define __has_feature(__x) __gxx__ ## __x
466
467#define __gxx__cxx_access_control_sfinae          !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) || !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) // Also see usage in 7 tests
468#define __gxx__cxx_alias_templates                !defined(_LIBCPP_HAS_NO_TEMPLATE_ALIASES)
469#define __gxx__cxx_address_sanitizer              !defined(_LIBCPP_HAS_NO_ASAN)
470#define __gxx__cxx_alignas                        0  // Not sure, doesn't matter.
471#define __gxx__cxx_atomic                         (_GNUC_VER >= 407)
472#define __gxx__cxx_attributes                     0  // Not sure. Also see usage in libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_polymorphic.pass.cpp
473#define __gxx__cxx_auto_type                      !defined(_LIBCPP_HAS_NO_AUTO_TYPE)
474#define __gxx__cxx_constexpr                      !defined(_LIBCPP_HAS_NO_CONSTEXPR)
475#define __gxx__cxx_decltype                       !defined(_LIBCPP_HAS_NO_DECLTYPE)
476#define __gxx__cxx_defaulted_functions            !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS)  // libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp
477#define __gxx__cxx_deleted_functions              !defined(_LIBCPP_HAS_NO_DELETED_FUNCTIONS)
478#define __gxx__cxx_exceptions                     !defined(_LIBCPP_NO_EXCEPTIONS)
479#define __gxx__cxx_explicit_conversions           (_GNUC_VER >= 405)
480#define __gxx__cxx_generalized_initializers       !defined(_LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS)
481#define __gxx__cxx_lambdas                        !defined(_LIBCPP_HAS_NO_LAMBDAS)
482#define __gxx__cxx_noexcept                       0  // Not sure, doesn't matter.
483#define __gxx__cxx_nullptr                        !defined(_LIBCPP_HAS_NO_NULLPTR)
484#define __gxx__cxx_reference_qualified_functions  (_GNUC_VER >= 408)  // Since 4.8.1
485#ifdef _LIBCPP_NO_RTTI
486#define __gxx__cxx_rtti                           0
487#else
488#define __gxx__cxx_rtti                           __GXX_RTTI
489#endif
490#define __gxx__cxx_rvalue_references              !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
491#define __gxx__cxx_static_assert                  !defined(_LIBCPP_HAS_NO_STATIC_ASSERT)
492#define __gxx__cxx_strong_enums                   !defined(_LIBCPP_HAS_NO_STRONG_ENUMS)  // See usage in libcxx/test/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
493#define __gxx__cxx_trailing_return                !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
494#define __gxx__cxx_unrestricted_unions            1  // Not sure.  Also See usage in libcxx/test/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
495#define __gxx__cxx_variadic_templates             !defined(_LIBCPP_HAS_NO_VARIADICS)
496#define __gxx__has_nothrow_assign                 (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
497#define __gxx__has_nothrow_constructor            (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
498#define __gxx__has_nothrow_copy                   (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
499#define __gxx__has_trivial_constructor            (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
500#define __gxx__has_trivial_destructor             (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
501#define __gxx__has_virtual_destructor             (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
502#define __gxx__is_base_of                         !defined(_LIBCPP_HAS_IS_BASE_OF)  // See usage in libcxx/include/type_traits
503#define __gxx__is_class                           (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
504#define __gxx__is_convertible_to                  0  // Not supported in GCC 4.8.  Also see usage in libcxx/include/type_traits
505#define __gxx__is_empty                           1  // Not sure.  Also see usage in libcxx/include/type_traits
506#define __gxx__is_enum                            (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
507#define __gxx__is_final                           (_GNUC_VER >= 408)  // Not if 4.7 work. 4.6 certainly not.  Also see usage in libcxx/include/unordered_map,tuple,ext/hash_map,map,memory
508#define __gxx__is_literal                         defined(_LIBCPP_IS_LITERAL)
509#define __gxx__is_pod                             (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
510#define __gxx__is_polymorphic                     1  // Not sure.  Also see usage in libcxx/include/type_traits
511#define __gxx__is_standard_layout                 1  // Not sure.  Also see usage in libcxx/include/type_traits
512#define __gxx__is_trivial                         0  // Not supported in GCC 4.8.  Also see usage in libcxx/include/type_traits
513#define __gxx__is_trivially_constructible         0  // Not supported in GCC 4.8.  Also see usage in libcxx/include/type_traits
514#define __gxx__is_trivially_copyable              0  // Not supported in GCC 4.8.  Also see usage in libcxx/include/type_traits
515#define __gxx__is_union                           (_GNUC_VER >= 403)  // See usage in libcxx/include/type_traits
516#define __gxx__objc_arc                           defined(_LIBCPP_HAS_OBJC_ARC)
517#define __gxx__objc_arc_weak                      defined(_LIBCPP_HAS_OBJC_ARC_WEAK)
518#define __gxx__underlying_type                    defined(_LIBCPP_UNDERLYING_TYPE)
519
520
521#elif defined(_LIBCPP_MSVC)
522
523#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
524#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
525#define _LIBCPP_HAS_NO_CONSTEXPR
526#define _LIBCPP_HAS_NO_UNICODE_CHARS
527#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
528#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
529#define __alignof__ __alignof
530#define _LIBCPP_NORETURN __declspec(noreturn)
531#define _ALIGNAS(x) __declspec(align(x))
532#define _LIBCPP_HAS_NO_VARIADICS
533
534#define _NOEXCEPT throw ()
535#define _NOEXCEPT_(x)
536#define _NOEXCEPT_OR_FALSE(x) false
537
538#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
539#define _LIBCPP_END_NAMESPACE_STD  }
540#define _VSTD std
541
542#  define _LIBCPP_WEAK
543namespace std {
544}
545
546#define _LIBCPP_HAS_NO_ASAN
547
548#elif defined(__IBMCPP__)
549
550#define _ALIGNAS(x) __attribute__((__aligned__(x)))
551#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
552#define _ATTRIBUTE(x) __attribute__((x))
553#define _LIBCPP_NORETURN __attribute__((noreturn))
554
555#define _NOEXCEPT throw()
556#define _NOEXCEPT_(x)
557#define _NOEXCEPT_OR_FALSE(x) false
558
559#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
560#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
561#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
562#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
563#define _LIBCPP_HAS_NO_NULLPTR
564#define _LIBCPP_HAS_NO_UNICODE_CHARS
565#define _LIBCPP_HAS_IS_BASE_OF
566
567#if defined(_AIX)
568#define __MULTILOCALE_API
569#endif
570
571#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
572#define _LIBCPP_END_NAMESPACE_STD  } }
573#define _VSTD std::_LIBCPP_NAMESPACE
574
575namespace std {
576  inline namespace _LIBCPP_NAMESPACE {
577  }
578}
579
580#define _LIBCPP_HAS_NO_ASAN
581
582#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
583
584#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
585typedef unsigned short char16_t;
586typedef unsigned int   char32_t;
587#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
588
589#ifndef __SIZEOF_INT128__
590#define _LIBCPP_HAS_NO_INT128
591#endif
592
593#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
594
595template <bool> struct __static_assert_test;
596template <> struct __static_assert_test<true> {};
597template <unsigned> struct __static_assert_check {};
598#define static_assert(__b, __m) \
599    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
600    _LIBCPP_CONCAT(__t, __LINE__)
601
602#endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
603
604#ifdef _LIBCPP_HAS_NO_DECLTYPE
605#define decltype(x) __typeof__(x)
606#endif
607
608#ifdef _LIBCPP_HAS_NO_CONSTEXPR
609#define _LIBCPP_CONSTEXPR
610#else
611#define _LIBCPP_CONSTEXPR constexpr
612#endif
613
614#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
615#define _LIBCPP_DEFAULT {}
616#else
617#define _LIBCPP_DEFAULT = default;
618#endif
619
620#ifdef __GNUC__
621#define _NOALIAS __attribute__((__malloc__))
622#else
623#define _NOALIAS
624#endif
625
626#ifndef __has_feature
627#define __has_feature(__x) 0
628#endif
629
630#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
631#   define _LIBCPP_EXPLICIT explicit
632#else
633#   define _LIBCPP_EXPLICIT
634#endif
635
636#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
637#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
638#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
639    __lx __v_; \
640    _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
641    _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
642    _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
643    };
644#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
645#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
646#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
647#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
648
649#ifdef _LIBCPP_DEBUG
650#   if _LIBCPP_DEBUG == 0
651#       define _LIBCPP_DEBUG_LEVEL 1
652#   elif _LIBCPP_DEBUG == 1
653#       define _LIBCPP_DEBUG_LEVEL 2
654#   else
655#       error Supported values for _LIBCPP_DEBUG are 0 and 1
656#   endif
657#   define _LIBCPP_EXTERN_TEMPLATE(...)
658#endif
659
660#ifndef _LIBCPP_EXTERN_TEMPLATE
661#define _LIBCPP_EXTERN_TEMPLATE(...)
662#endif
663
664#ifndef _LIBCPP_EXTERN_TEMPLATE2
665#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
666#endif
667
668#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
669#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
670#endif
671
672#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
673#define _LIBCPP_LOCALE__L_EXTENSIONS 1
674#endif
675
676#ifdef __FreeBSD__
677#define _DECLARE_C99_LDBL_MATH 1
678#endif
679
680#if defined(__APPLE__) || defined(__FreeBSD__)
681#define _LIBCPP_HAS_DEFAULTRUNELOCALE
682#endif
683
684#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
685#define _LIBCPP_WCTYPE_IS_MASK
686#endif
687
688#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
689#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
690#endif
691
692#ifndef _LIBCPP_STD_VER
693#  if  __cplusplus <= 201103L
694#    define _LIBCPP_STD_VER 11
695#  else
696#    define _LIBCPP_STD_VER 13  // current year, or date of c++14 ratification
697#  endif
698#endif  // _LIBCPP_STD_VER
699
700#if _LIBCPP_STD_VER > 11
701#define _LIBCPP_DEPRECATED [[deprecated]]
702#else
703#define _LIBCPP_DEPRECATED
704#endif
705
706#if _LIBCPP_STD_VER <= 11
707#define _LIBCPP_CONSTEXPR_AFTER_CXX11
708#define _LIBCPP_EXPLICIT_AFTER_CXX11
709#define _LIBCPP_DEPRECATED_AFTER_CXX11
710#else
711#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
712#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
713#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
714#endif
715
716#ifndef _LIBCPP_HAS_NO_ASAN
717extern "C" void __sanitizer_annotate_contiguous_container(
718  const void *, const void *, const void *, const void *);
719#endif
720
721// Try to find out if RTTI is disabled.
722// g++ and cl.exe have RTTI on by default and define a macro when it is.
723// g++ only defines the macro in 4.3.2 and onwards.
724#if !defined(_LIBCPP_NO_RTTI)
725#  if defined(__GNUG__) && ((__GNUC__ >= 5 ) || (__GNUC__ == 4 && \
726   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
727#    define _LIBCPP_NO_RTTI
728#  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
729#    define _LIBCPP_NO_RTTI
730#  endif
731#endif
732
733#ifndef _LIBCPP_WEAK
734#  define _LIBCPP_WEAK __attribute__((__weak__))
735#endif
736
737#endif  // _LIBCPP_CONFIG
738