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#endif
195
196#ifndef _LIBCPP_EXCEPTION_ABI
197#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
198#endif
199
200#ifndef _LIBCPP_ALWAYS_INLINE
201#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
202#endif
203
204#if defined(__clang__)
205
206#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&        \
207    !defined(__arm__)
208#define _LIBCPP_ALTERNATE_STRING_LAYOUT
209#endif
210
211#if __has_feature(cxx_alignas)
212#  define _ALIGNAS_TYPE(x) alignas(x)
213#  define _ALIGNAS(x) alignas(x)
214#else
215#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
216#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
217#endif
218
219#if !__has_feature(cxx_alias_templates)
220#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
221#endif
222
223#if __cplusplus < 201103L
224#ifdef __linux__
225#define _LIBCPP_HAS_NO_UNICODE_CHARS
226#else
227typedef __char16_t char16_t;
228typedef __char32_t char32_t;
229#endif
230#endif
231
232#if !(__has_feature(cxx_exceptions))
233#define _LIBCPP_NO_EXCEPTIONS
234#endif
235
236#if !(__has_feature(cxx_rtti))
237#define _LIBCPP_NO_RTTI
238#endif
239
240#if !(__has_feature(cxx_strong_enums))
241#define _LIBCPP_HAS_NO_STRONG_ENUMS
242#endif
243
244#if !(__has_feature(cxx_decltype))
245#define _LIBCPP_HAS_NO_DECLTYPE
246#endif
247
248#if __has_feature(cxx_attributes)
249#  define _LIBCPP_NORETURN [[noreturn]]
250#else
251#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
252#endif
253
254#if !(__has_feature(cxx_defaulted_functions))
255#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
256#endif  // !(__has_feature(cxx_defaulted_functions))
257
258#if !(__has_feature(cxx_deleted_functions))
259#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
260#endif  // !(__has_feature(cxx_deleted_functions))
261
262#if !(__has_feature(cxx_lambdas))
263#define _LIBCPP_HAS_NO_LAMBDAS
264#endif
265
266#if !(__has_feature(cxx_nullptr))
267#define _LIBCPP_HAS_NO_NULLPTR
268#endif
269
270#if !(__has_feature(cxx_rvalue_references))
271#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
272#endif
273
274#if !(__has_feature(cxx_static_assert))
275#define _LIBCPP_HAS_NO_STATIC_ASSERT
276#endif
277
278#if !(__has_feature(cxx_auto_type))
279#define _LIBCPP_HAS_NO_AUTO_TYPE
280#endif
281
282#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
283#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
284#endif
285
286#if !(__has_feature(cxx_variadic_templates))
287#define _LIBCPP_HAS_NO_VARIADICS
288#endif
289
290#if !(__has_feature(cxx_trailing_return))
291#define _LIBCPP_HAS_NO_TRAILING_RETURN
292#endif
293
294#if !(__has_feature(cxx_generalized_initializers))
295#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
296#endif
297
298#if __has_feature(is_base_of)
299#  define _LIBCPP_HAS_IS_BASE_OF
300#endif
301
302// Objective-C++ features (opt-in)
303#if __has_feature(objc_arc)
304#define _LIBCPP_HAS_OBJC_ARC
305#endif
306
307#if __has_feature(objc_arc_weak)
308#define _LIBCPP_HAS_OBJC_ARC_WEAK
309#define _LIBCPP_HAS_NO_STRONG_ENUMS
310#endif
311
312#if !(__has_feature(cxx_constexpr))
313#define _LIBCPP_HAS_NO_CONSTEXPR
314#endif
315
316#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
317#if defined(__FreeBSD__)
318#define _LIBCPP_HAS_QUICK_EXIT
319#define _LIBCPP_HAS_C11_FEATURES
320#elif defined(__linux__)
321#include <features.h>
322#if __GLIBC_PREREQ(2, 15)
323#define _LIBCPP_HAS_QUICK_EXIT
324#endif
325#if __GLIBC_PREREQ(2, 17)
326#define _LIBCPP_HAS_C11_FEATURES
327#endif
328#endif
329#endif
330
331#if (__has_feature(cxx_noexcept))
332#  define _NOEXCEPT noexcept
333#  define _NOEXCEPT_(x) noexcept(x)
334#  define _NOEXCEPT_OR_FALSE(x) noexcept(x)
335#else
336#  define _NOEXCEPT throw()
337#  define _NOEXCEPT_(x)
338#  define _NOEXCEPT_OR_FALSE(x) false
339#endif
340
341#if __has_feature(underlying_type)
342#  define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
343#endif
344
345// Inline namespaces are available in Clang regardless of C++ dialect.
346#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
347#define _LIBCPP_END_NAMESPACE_STD  } }
348#define _VSTD std::_LIBCPP_NAMESPACE
349
350namespace std {
351  inline namespace _LIBCPP_NAMESPACE {
352  }
353}
354
355#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
356#define _LIBCPP_HAS_NO_ASAN
357#endif
358
359#elif defined(__GNUC__)
360
361#define _ALIGNAS(x) __attribute__((__aligned__(x)))
362#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
363
364#define _LIBCPP_NORETURN __attribute__((noreturn))
365
366#if !__EXCEPTIONS
367#define _LIBCPP_NO_EXCEPTIONS
368#endif
369
370#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
371
372// constexpr was added to GCC in 4.6.
373#if _GNUC_VER < 406
374#define _LIBCPP_HAS_NO_CONSTEXPR
375// Can only use constexpr in c++11 mode.
376#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
377#define _LIBCPP_HAS_NO_CONSTEXPR
378#endif
379
380#define _NOEXCEPT throw()
381#define _NOEXCEPT_(x)
382#define _NOEXCEPT_OR_FALSE(x) false
383
384#ifndef __GXX_EXPERIMENTAL_CXX0X__
385
386#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
387#define _LIBCPP_HAS_NO_DECLTYPE
388#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
389#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
390#define _LIBCPP_HAS_NO_NULLPTR
391#define _LIBCPP_HAS_NO_STATIC_ASSERT
392#define _LIBCPP_HAS_NO_UNICODE_CHARS
393#define _LIBCPP_HAS_NO_VARIADICS
394#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
395#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
396#define _LIBCPP_HAS_NO_STRONG_ENUMS
397
398#else  // __GXX_EXPERIMENTAL_CXX0X__
399
400#define _LIBCPP_HAS_NO_TRAILING_RETURN
401#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
402
403#if _GNUC_VER < 403
404#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
405#endif
406
407#if _GNUC_VER < 403
408#define _LIBCPP_HAS_NO_STATIC_ASSERT
409#endif
410
411#if _GNUC_VER < 404
412#define _LIBCPP_HAS_NO_DECLTYPE
413#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
414#define _LIBCPP_HAS_NO_UNICODE_CHARS
415#define _LIBCPP_HAS_NO_VARIADICS
416#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
417#endif  // _GNUC_VER < 404
418
419#if _GNUC_VER < 406
420#define _LIBCPP_HAS_NO_NULLPTR
421#endif
422
423#if _GNUC_VER < 407
424#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
425#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
426#endif
427
428#endif  // __GXX_EXPERIMENTAL_CXX0X__
429
430#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
431#define _LIBCPP_END_NAMESPACE_STD  } }
432#define _VSTD std::_LIBCPP_NAMESPACE
433
434namespace std {
435namespace _LIBCPP_NAMESPACE {
436}
437using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
438}
439
440#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
441#define _LIBCPP_HAS_NO_ASAN
442#endif
443
444#elif defined(_LIBCPP_MSVC)
445
446#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
447#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
448#define _LIBCPP_HAS_NO_CONSTEXPR
449#define _LIBCPP_HAS_NO_UNICODE_CHARS
450#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
451#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
452#define __alignof__ __alignof
453#define _LIBCPP_NORETURN __declspec(noreturn)
454#define _ALIGNAS(x) __declspec(align(x))
455#define _LIBCPP_HAS_NO_VARIADICS
456
457#define _NOEXCEPT throw ()
458#define _NOEXCEPT_(x)
459#define _NOEXCEPT_OR_FALSE(x) false
460
461#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
462#define _LIBCPP_END_NAMESPACE_STD  }
463#define _VSTD std
464
465#  define _LIBCPP_WEAK
466namespace std {
467}
468
469#define _LIBCPP_HAS_NO_ASAN
470
471#elif defined(__IBMCPP__)
472
473#define _ALIGNAS(x) __attribute__((__aligned__(x)))
474#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
475#define _ATTRIBUTE(x) __attribute__((x))
476#define _LIBCPP_NORETURN __attribute__((noreturn))
477
478#define _NOEXCEPT throw()
479#define _NOEXCEPT_(x)
480#define _NOEXCEPT_OR_FALSE(x) false
481
482#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
483#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
484#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
485#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
486#define _LIBCPP_HAS_NO_NULLPTR
487#define _LIBCPP_HAS_NO_UNICODE_CHARS
488#define _LIBCPP_HAS_IS_BASE_OF
489
490#if defined(_AIX)
491#define __MULTILOCALE_API
492#endif
493
494#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
495#define _LIBCPP_END_NAMESPACE_STD  } }
496#define _VSTD std::_LIBCPP_NAMESPACE
497
498namespace std {
499  inline namespace _LIBCPP_NAMESPACE {
500  }
501}
502
503#define _LIBCPP_HAS_NO_ASAN
504
505#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
506
507#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
508typedef unsigned short char16_t;
509typedef unsigned int   char32_t;
510#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
511
512#ifndef __SIZEOF_INT128__
513#define _LIBCPP_HAS_NO_INT128
514#endif
515
516#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
517
518template <bool> struct __static_assert_test;
519template <> struct __static_assert_test<true> {};
520template <unsigned> struct __static_assert_check {};
521#define static_assert(__b, __m) \
522    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
523    _LIBCPP_CONCAT(__t, __LINE__)
524
525#endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
526
527#ifdef _LIBCPP_HAS_NO_DECLTYPE
528#define decltype(x) __typeof__(x)
529#endif
530
531#ifdef _LIBCPP_HAS_NO_CONSTEXPR
532#define _LIBCPP_CONSTEXPR
533#else
534#define _LIBCPP_CONSTEXPR constexpr
535#endif
536
537#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
538#define _LIBCPP_DEFAULT {}
539#else
540#define _LIBCPP_DEFAULT = default;
541#endif
542
543#ifdef __GNUC__
544#define _NOALIAS __attribute__((__malloc__))
545#else
546#define _NOALIAS
547#endif
548
549#ifndef __has_feature
550#define __has_feature(__x) 0
551#endif
552
553#ifndef __has_builtin
554#define __has_builtin(__x) 0
555#endif
556
557#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
558#   define _LIBCPP_EXPLICIT explicit
559#else
560#   define _LIBCPP_EXPLICIT
561#endif
562
563#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
564#   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
565#endif
566
567#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
568#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
569#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
570    __lx __v_; \
571    _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
572    _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
573    _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
574    };
575#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
576#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
577#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
578#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
579
580#ifdef _LIBCPP_DEBUG
581#   if _LIBCPP_DEBUG == 0
582#       define _LIBCPP_DEBUG_LEVEL 1
583#   elif _LIBCPP_DEBUG == 1
584#       define _LIBCPP_DEBUG_LEVEL 2
585#   else
586#       error Supported values for _LIBCPP_DEBUG are 0 and 1
587#   endif
588#   define _LIBCPP_EXTERN_TEMPLATE(...)
589#endif
590
591#ifndef _LIBCPP_EXTERN_TEMPLATE
592#define _LIBCPP_EXTERN_TEMPLATE(...)
593#endif
594
595#ifndef _LIBCPP_EXTERN_TEMPLATE2
596#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
597#endif
598
599#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
600#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
601#endif
602
603#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
604#define _LIBCPP_LOCALE__L_EXTENSIONS 1
605#endif
606
607#ifdef __FreeBSD__
608#define _DECLARE_C99_LDBL_MATH 1
609#endif
610
611#if defined(__APPLE__) || defined(__FreeBSD__)
612#define _LIBCPP_HAS_DEFAULTRUNELOCALE
613#endif
614
615#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
616#define _LIBCPP_WCTYPE_IS_MASK
617#endif
618
619#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
620#  define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
621#endif
622
623#ifndef _LIBCPP_STD_VER
624#  if  __cplusplus <= 201103L
625#    define _LIBCPP_STD_VER 11
626#  elif __cplusplus <= 201402L
627#    define _LIBCPP_STD_VER 14
628#  else
629#    define _LIBCPP_STD_VER 15  // current year, or date of c++17 ratification
630#  endif
631#endif  // _LIBCPP_STD_VER
632
633#if _LIBCPP_STD_VER > 11
634#define _LIBCPP_DEPRECATED [[deprecated]]
635#else
636#define _LIBCPP_DEPRECATED
637#endif
638
639#if _LIBCPP_STD_VER <= 11
640#define _LIBCPP_CONSTEXPR_AFTER_CXX11
641#define _LIBCPP_EXPLICIT_AFTER_CXX11
642#define _LIBCPP_DEPRECATED_AFTER_CXX11
643#else
644#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
645#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
646#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
647#endif
648
649#ifndef _LIBCPP_HAS_NO_ASAN
650extern "C" void __sanitizer_annotate_contiguous_container(
651  const void *, const void *, const void *, const void *);
652#endif
653
654// Try to find out if RTTI is disabled.
655// g++ and cl.exe have RTTI on by default and define a macro when it is.
656// g++ only defines the macro in 4.3.2 and onwards.
657#if !defined(_LIBCPP_NO_RTTI)
658#  if defined(__GNUG__) && (__GNUC__ >= 4 && \
659   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
660#    define _LIBCPP_NO_RTTI
661#  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
662#    define _LIBCPP_NO_RTTI
663#  endif
664#endif
665
666#ifndef _LIBCPP_WEAK
667#  define _LIBCPP_WEAK __attribute__((__weak__))
668#endif
669
670#endif  // _LIBCPP_CONFIG
671