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#else
21#define _GNUC_VER 0
22#endif
23
24#define _LIBCPP_VERSION 3700
25
26#define _LIBCPP_ABI_VERSION 1
27
28#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
29#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
30
31#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
32
33
34#ifndef __has_attribute
35#define __has_attribute(__x) 0
36#endif
37#ifndef __has_builtin
38#define __has_builtin(__x) 0
39#endif
40#ifndef __has_feature
41#define __has_feature(__x) 0
42#endif
43// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
44// the compiler and '1' otherwise.
45#ifndef __is_identifier
46#define __is_identifier(__x) 1
47#endif
48
49
50#ifdef __LITTLE_ENDIAN__
51#if __LITTLE_ENDIAN__
52#define _LIBCPP_LITTLE_ENDIAN 1
53#define _LIBCPP_BIG_ENDIAN    0
54#endif  // __LITTLE_ENDIAN__
55#endif  // __LITTLE_ENDIAN__
56
57#ifdef __BIG_ENDIAN__
58#if __BIG_ENDIAN__
59#define _LIBCPP_LITTLE_ENDIAN 0
60#define _LIBCPP_BIG_ENDIAN    1
61#endif  // __BIG_ENDIAN__
62#endif  // __BIG_ENDIAN__
63
64#ifdef __FreeBSD__
65# include <sys/endian.h>
66#  if _BYTE_ORDER == _LITTLE_ENDIAN
67#   define _LIBCPP_LITTLE_ENDIAN 1
68#   define _LIBCPP_BIG_ENDIAN    0
69# else  // _BYTE_ORDER == _LITTLE_ENDIAN
70#   define _LIBCPP_LITTLE_ENDIAN 0
71#   define _LIBCPP_BIG_ENDIAN    1
72# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
73# ifndef __LONG_LONG_SUPPORTED
74#  define _LIBCPP_HAS_NO_LONG_LONG
75# endif  // __LONG_LONG_SUPPORTED
76#endif  // __FreeBSD__
77
78#ifdef __NetBSD__
79# include <sys/endian.h>
80#  if _BYTE_ORDER == _LITTLE_ENDIAN
81#   define _LIBCPP_LITTLE_ENDIAN 1
82#   define _LIBCPP_BIG_ENDIAN    0
83# else  // _BYTE_ORDER == _LITTLE_ENDIAN
84#   define _LIBCPP_LITTLE_ENDIAN 0
85#   define _LIBCPP_BIG_ENDIAN    1
86# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
87# define _LIBCPP_HAS_QUICK_EXIT
88#endif  // __NetBSD__
89
90#ifdef _WIN32
91#  define _LIBCPP_LITTLE_ENDIAN 1
92#  define _LIBCPP_BIG_ENDIAN    0
93// Compiler intrinsics (MSVC)
94#if defined(_MSC_VER) && _MSC_VER >= 1400
95#    define _LIBCPP_HAS_IS_BASE_OF
96#  endif
97#  if defined(_MSC_VER) && !defined(__clang__)
98#    define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
99#    define _LIBCPP_TOSTRING2(x) #x
100#    define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
101#    define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
102#  endif
103#  // If mingw not explicitly detected, assume using MS C runtime only.
104#  ifndef __MINGW32__
105#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
106#  endif
107#endif  // _WIN32
108
109#ifdef __sun__
110# include <sys/isa_defs.h>
111# ifdef _LITTLE_ENDIAN
112#   define _LIBCPP_LITTLE_ENDIAN 1
113#   define _LIBCPP_BIG_ENDIAN    0
114# else
115#   define _LIBCPP_LITTLE_ENDIAN 0
116#   define _LIBCPP_BIG_ENDIAN    1
117# endif
118#endif // __sun__
119
120#if defined(__CloudABI__)
121  // Certain architectures provide arc4random(). Prefer using
122  // arc4random() over /dev/{u,}random to make it possible to obtain
123  // random data even when using sandboxing mechanisms such as chroots,
124  // Capsicum, etc.
125# define _LIBCPP_USING_ARC4_RANDOM
126#elif defined(__native_client__)
127  // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
128  // including accesses to the special files under /dev. C++11's
129  // std::random_device is instead exposed through a NaCl syscall.
130# define _LIBCPP_USING_NACL_RANDOM
131#elif defined(_WIN32)
132# define _LIBCPP_USING_WIN32_RANDOM
133#else
134# define _LIBCPP_USING_DEV_RANDOM
135#endif
136
137#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
138# include <endian.h>
139# if __BYTE_ORDER == __LITTLE_ENDIAN
140#  define _LIBCPP_LITTLE_ENDIAN 1
141#  define _LIBCPP_BIG_ENDIAN    0
142# elif __BYTE_ORDER == __BIG_ENDIAN
143#  define _LIBCPP_LITTLE_ENDIAN 0
144#  define _LIBCPP_BIG_ENDIAN    1
145# else  // __BYTE_ORDER == __BIG_ENDIAN
146#  error unable to determine endian
147# endif
148#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
149
150#ifdef _WIN32
151
152// only really useful for a DLL
153#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
154# ifdef cxx_EXPORTS
155#  define _LIBCPP_HIDDEN
156#  define _LIBCPP_FUNC_VIS __declspec(dllexport)
157#  define _LIBCPP_TYPE_VIS __declspec(dllexport)
158# else
159#  define _LIBCPP_HIDDEN
160#  define _LIBCPP_FUNC_VIS __declspec(dllimport)
161#  define _LIBCPP_TYPE_VIS __declspec(dllimport)
162# endif
163#else
164# define _LIBCPP_HIDDEN
165# define _LIBCPP_FUNC_VIS
166# define _LIBCPP_TYPE_VIS
167#endif
168
169#define _LIBCPP_TYPE_VIS_ONLY
170#define _LIBCPP_FUNC_VIS_ONLY
171
172#ifndef _LIBCPP_INLINE_VISIBILITY
173# ifdef _LIBCPP_MSVC
174#  define _LIBCPP_INLINE_VISIBILITY __forceinline
175# else // MinGW GCC and Clang
176#  define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
177# endif
178#endif
179
180#ifndef _LIBCPP_EXCEPTION_ABI
181#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
182#endif
183
184#ifndef _LIBCPP_ALWAYS_INLINE
185# ifdef _LIBCPP_MSVC
186#  define _LIBCPP_ALWAYS_INLINE __forceinline
187# endif
188#endif
189
190#endif // _WIN32
191
192#ifndef _LIBCPP_HIDDEN
193#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
194#endif
195
196#ifndef _LIBCPP_FUNC_VIS
197#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
198#endif
199
200#ifndef _LIBCPP_TYPE_VIS
201#  if __has_attribute(__type_visibility__)
202#    define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
203#  else
204#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
205#  endif
206#endif
207
208#ifndef _LIBCPP_TYPE_VIS_ONLY
209# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
210#endif
211
212#ifndef _LIBCPP_FUNC_VIS_ONLY
213# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
214#endif
215
216#ifndef _LIBCPP_INLINE_VISIBILITY
217#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
218#endif
219
220#ifndef _LIBCPP_EXCEPTION_ABI
221#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
222#endif
223
224#ifndef _LIBCPP_ALWAYS_INLINE
225#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
226#endif
227
228#if defined(__clang__)
229
230#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&        \
231    !defined(__arm__)
232#define _LIBCPP_ALTERNATE_STRING_LAYOUT
233#endif
234
235#if __has_feature(cxx_alignas)
236#  define _ALIGNAS_TYPE(x) alignas(x)
237#  define _ALIGNAS(x) alignas(x)
238#else
239#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
240#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
241#endif
242
243#if !__has_feature(cxx_alias_templates)
244#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
245#endif
246
247#if __cplusplus < 201103L
248typedef __char16_t char16_t;
249typedef __char32_t char32_t;
250#endif
251
252#if !(__has_feature(cxx_exceptions))
253#define _LIBCPP_NO_EXCEPTIONS
254#endif
255
256#if !(__has_feature(cxx_rtti))
257#define _LIBCPP_NO_RTTI
258#endif
259
260#if !(__has_feature(cxx_strong_enums))
261#define _LIBCPP_HAS_NO_STRONG_ENUMS
262#endif
263
264#if !(__has_feature(cxx_decltype))
265#define _LIBCPP_HAS_NO_DECLTYPE
266#endif
267
268#if __has_feature(cxx_attributes)
269#  define _LIBCPP_NORETURN [[noreturn]]
270#else
271#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
272#endif
273
274#define _LIBCPP_UNUSED __attribute__((__unused__))
275
276#if !(__has_feature(cxx_defaulted_functions))
277#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
278#endif  // !(__has_feature(cxx_defaulted_functions))
279
280#if !(__has_feature(cxx_deleted_functions))
281#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
282#endif  // !(__has_feature(cxx_deleted_functions))
283
284#if !(__has_feature(cxx_lambdas))
285#define _LIBCPP_HAS_NO_LAMBDAS
286#endif
287
288#if !(__has_feature(cxx_nullptr))
289#define _LIBCPP_HAS_NO_NULLPTR
290#endif
291
292#if !(__has_feature(cxx_rvalue_references))
293#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
294#endif
295
296#if !(__has_feature(cxx_static_assert))
297#define _LIBCPP_HAS_NO_STATIC_ASSERT
298#endif
299
300#if !(__has_feature(cxx_auto_type))
301#define _LIBCPP_HAS_NO_AUTO_TYPE
302#endif
303
304#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
305#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
306#endif
307
308#if !(__has_feature(cxx_variadic_templates))
309#define _LIBCPP_HAS_NO_VARIADICS
310#endif
311
312#if !(__has_feature(cxx_trailing_return))
313#define _LIBCPP_HAS_NO_TRAILING_RETURN
314#endif
315
316#if !(__has_feature(cxx_generalized_initializers))
317#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
318#endif
319
320#if __has_feature(is_base_of)
321#  define _LIBCPP_HAS_IS_BASE_OF
322#endif
323
324#if __has_feature(is_final)
325#  define _LIBCPP_HAS_IS_FINAL
326#endif
327
328// Objective-C++ features (opt-in)
329#if __has_feature(objc_arc)
330#define _LIBCPP_HAS_OBJC_ARC
331#endif
332
333#if __has_feature(objc_arc_weak)
334#define _LIBCPP_HAS_OBJC_ARC_WEAK
335#define _LIBCPP_HAS_NO_STRONG_ENUMS
336#endif
337
338#if !(__has_feature(cxx_constexpr))
339#define _LIBCPP_HAS_NO_CONSTEXPR
340#endif
341
342#if !(__has_feature(cxx_relaxed_constexpr))
343#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
344#endif
345
346#if !(__has_feature(cxx_variable_templates))
347#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
348#endif
349
350#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
351#if defined(__FreeBSD__)
352#define _LIBCPP_HAS_QUICK_EXIT
353#define _LIBCPP_HAS_C11_FEATURES
354#elif defined(__ANDROID__)
355#define _LIBCPP_HAS_QUICK_EXIT
356#elif defined(__linux__)
357#include <features.h>
358#if __GLIBC_PREREQ(2, 15)
359#define _LIBCPP_HAS_QUICK_EXIT
360#endif
361#if __GLIBC_PREREQ(2, 17)
362#define _LIBCPP_HAS_C11_FEATURES
363#endif
364#endif
365#endif
366
367#if !(__has_feature(cxx_noexcept))
368#define _LIBCPP_HAS_NO_NOEXCEPT
369#endif
370
371#if __has_feature(underlying_type)
372#  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
373#endif
374
375#if __has_feature(is_literal)
376#  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
377#endif
378
379// Inline namespaces are available in Clang regardless of C++ dialect.
380#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
381#define _LIBCPP_END_NAMESPACE_STD  } }
382#define _VSTD std::_LIBCPP_NAMESPACE
383
384namespace std {
385  inline namespace _LIBCPP_NAMESPACE {
386  }
387}
388
389#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
390#define _LIBCPP_HAS_NO_ASAN
391#endif
392
393#elif defined(__GNUC__)
394
395#define _ALIGNAS(x) __attribute__((__aligned__(x)))
396#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
397
398#define _LIBCPP_NORETURN __attribute__((noreturn))
399
400#define _LIBCPP_UNUSED __attribute__((__unused__))
401
402#if _GNUC_VER >= 407
403#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
404#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
405#define _LIBCPP_HAS_IS_FINAL
406#endif
407
408#if defined(__GNUC__) && _GNUC_VER >= 403
409#  define _LIBCPP_HAS_IS_BASE_OF
410#endif
411
412#if !__EXCEPTIONS
413#define _LIBCPP_NO_EXCEPTIONS
414#endif
415
416#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
417
418// constexpr was added to GCC in 4.6.
419#if _GNUC_VER < 406
420#define _LIBCPP_HAS_NO_CONSTEXPR
421// Can only use constexpr in c++11 mode.
422#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
423#define _LIBCPP_HAS_NO_CONSTEXPR
424#endif
425
426// Determine if GCC supports relaxed constexpr
427#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
428#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
429#endif
430
431// GCC 5 will support variable templates
432#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
433#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
434#endif
435
436#ifndef __GXX_EXPERIMENTAL_CXX0X__
437
438#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
439#define _LIBCPP_HAS_NO_DECLTYPE
440#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
441#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
442#define _LIBCPP_HAS_NO_NULLPTR
443#define _LIBCPP_HAS_NO_STATIC_ASSERT
444#define _LIBCPP_HAS_NO_UNICODE_CHARS
445#define _LIBCPP_HAS_NO_VARIADICS
446#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
447#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
448#define _LIBCPP_HAS_NO_STRONG_ENUMS
449#define _LIBCPP_HAS_NO_NOEXCEPT
450
451#else  // __GXX_EXPERIMENTAL_CXX0X__
452
453#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
454
455#if _GNUC_VER < 403
456#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
457#endif
458
459#if _GNUC_VER < 403
460#define _LIBCPP_HAS_NO_STATIC_ASSERT
461#endif
462
463#if _GNUC_VER < 404
464#define _LIBCPP_HAS_NO_DECLTYPE
465#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
466#define _LIBCPP_HAS_NO_TRAILING_RETURN
467#define _LIBCPP_HAS_NO_UNICODE_CHARS
468#define _LIBCPP_HAS_NO_VARIADICS
469#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
470#endif  // _GNUC_VER < 404
471
472#if _GNUC_VER < 406
473#define _LIBCPP_HAS_NO_NOEXCEPT
474#define _LIBCPP_HAS_NO_NULLPTR
475#endif
476
477#if _GNUC_VER < 407
478#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
479#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
480#endif
481
482#endif  // __GXX_EXPERIMENTAL_CXX0X__
483
484#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
485#define _LIBCPP_END_NAMESPACE_STD  } }
486#define _VSTD std::_LIBCPP_NAMESPACE
487
488namespace std {
489namespace _LIBCPP_NAMESPACE {
490}
491using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
492}
493
494#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
495#define _LIBCPP_HAS_NO_ASAN
496#endif
497
498#elif defined(_LIBCPP_MSVC)
499
500#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
501#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
502#define _LIBCPP_HAS_NO_CONSTEXPR
503#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
504#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
505#define _LIBCPP_HAS_NO_UNICODE_CHARS
506#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
507#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
508#define _LIBCPP_HAS_NO_NOEXCEPT
509#define __alignof__ __alignof
510#define _LIBCPP_NORETURN __declspec(noreturn)
511#define _LIBCPP_UNUSED
512#define _ALIGNAS(x) __declspec(align(x))
513#define _LIBCPP_HAS_NO_VARIADICS
514
515
516
517#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
518#define _LIBCPP_END_NAMESPACE_STD  }
519#define _VSTD std
520
521#  define _LIBCPP_WEAK
522namespace std {
523}
524
525#define _LIBCPP_HAS_NO_ASAN
526
527#elif defined(__IBMCPP__)
528
529#define _ALIGNAS(x) __attribute__((__aligned__(x)))
530#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
531#define _ATTRIBUTE(x) __attribute__((x))
532#define _LIBCPP_NORETURN __attribute__((noreturn))
533#define _LIBCPP_UNUSED
534
535#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
536#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
537#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
538#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
539#define _LIBCPP_HAS_NO_NOEXCEPT
540#define _LIBCPP_HAS_NO_NULLPTR
541#define _LIBCPP_HAS_NO_UNICODE_CHARS
542#define _LIBCPP_HAS_IS_BASE_OF
543#define _LIBCPP_HAS_IS_FINAL
544#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
545
546#if defined(_AIX)
547#define __MULTILOCALE_API
548#endif
549
550#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
551#define _LIBCPP_END_NAMESPACE_STD  } }
552#define _VSTD std::_LIBCPP_NAMESPACE
553
554namespace std {
555  inline namespace _LIBCPP_NAMESPACE {
556  }
557}
558
559#define _LIBCPP_HAS_NO_ASAN
560
561#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
562
563#ifndef _LIBCPP_HAS_NO_NOEXCEPT
564#  define _NOEXCEPT noexcept
565#  define _NOEXCEPT_(x) noexcept(x)
566#else
567#  define _NOEXCEPT throw()
568#  define _NOEXCEPT_(x)
569#endif
570
571#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
572typedef unsigned short char16_t;
573typedef unsigned int   char32_t;
574#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
575
576#ifndef __SIZEOF_INT128__
577#define _LIBCPP_HAS_NO_INT128
578#endif
579
580#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
581
582template <bool> struct __static_assert_test;
583template <> struct __static_assert_test<true> {};
584template <unsigned> struct __static_assert_check {};
585#define static_assert(__b, __m) \
586    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
587    _LIBCPP_CONCAT(__t, __LINE__)
588
589#endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
590
591#ifdef _LIBCPP_HAS_NO_DECLTYPE
592// GCC 4.6 provides __decltype in all standard modes.
593#if !__is_identifier(__decltype) || _GNUC_VER >= 406
594#  define decltype(__x) __decltype(__x)
595#else
596#  define decltype(__x) __typeof__(__x)
597#endif
598#endif
599
600#ifdef _LIBCPP_HAS_NO_CONSTEXPR
601#define _LIBCPP_CONSTEXPR
602#else
603#define _LIBCPP_CONSTEXPR constexpr
604#endif
605
606#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
607#define _LIBCPP_DEFAULT {}
608#else
609#define _LIBCPP_DEFAULT = default;
610#endif
611
612#ifdef __GNUC__
613#define _NOALIAS __attribute__((__malloc__))
614#else
615#define _NOALIAS
616#endif
617
618#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
619#   define _LIBCPP_EXPLICIT explicit
620#else
621#   define _LIBCPP_EXPLICIT
622#endif
623
624#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
625#   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
626#endif
627
628#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
629#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
630#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
631    __lx __v_; \
632    _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
633    _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
634    _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
635    };
636#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
637#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
638#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
639#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
640
641#ifdef _LIBCPP_DEBUG
642#   if _LIBCPP_DEBUG == 0
643#       define _LIBCPP_DEBUG_LEVEL 1
644#   elif _LIBCPP_DEBUG == 1
645#       define _LIBCPP_DEBUG_LEVEL 2
646#   else
647#       error Supported values for _LIBCPP_DEBUG are 0 and 1
648#   endif
649#   define _LIBCPP_EXTERN_TEMPLATE(...)
650#endif
651
652#ifndef _LIBCPP_EXTERN_TEMPLATE
653#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
654#endif
655
656#ifndef _LIBCPP_EXTERN_TEMPLATE2
657#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
658#endif
659
660#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
661#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
662#endif
663
664#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
665    defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
666#define _LIBCPP_LOCALE__L_EXTENSIONS 1
667#endif
668
669#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
670    !defined(__CloudABI__)
671#define _LIBCPP_HAS_CATOPEN 1
672#endif
673
674#ifdef __FreeBSD__
675#define _DECLARE_C99_LDBL_MATH 1
676#endif
677
678#if defined(__APPLE__) || defined(__FreeBSD__)
679#define _LIBCPP_HAS_DEFAULTRUNELOCALE
680#endif
681
682#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
683#define _LIBCPP_WCTYPE_IS_MASK
684#endif
685
686#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
687#  if defined(__FreeBSD__)
688// Making the std::pair copy constructor trivial breaks ABI compatibility with
689// earlier versions of libc++ shipped by FreeBSD, so turn it off by default.
690// See also http://svnweb.freebsd.org/changeset/base/261801
691#    define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
692#  else
693#    define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
694#  endif
695#endif
696
697#ifndef _LIBCPP_STD_VER
698#  if  __cplusplus <= 201103L
699#    define _LIBCPP_STD_VER 11
700#  elif __cplusplus <= 201402L
701#    define _LIBCPP_STD_VER 14
702#  else
703#    define _LIBCPP_STD_VER 15  // current year, or date of c++17 ratification
704#  endif
705#endif  // _LIBCPP_STD_VER
706
707#if _LIBCPP_STD_VER > 11
708#define _LIBCPP_DEPRECATED [[deprecated]]
709#else
710#define _LIBCPP_DEPRECATED
711#endif
712
713#if _LIBCPP_STD_VER <= 11
714#define _LIBCPP_EXPLICIT_AFTER_CXX11
715#define _LIBCPP_DEPRECATED_AFTER_CXX11
716#else
717#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
718#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
719#endif
720
721#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
722#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
723#else
724#define _LIBCPP_CONSTEXPR_AFTER_CXX11
725#endif
726
727#ifndef _LIBCPP_HAS_NO_ASAN
728extern "C" void __sanitizer_annotate_contiguous_container(
729  const void *, const void *, const void *, const void *);
730#endif
731
732// Try to find out if RTTI is disabled.
733// g++ and cl.exe have RTTI on by default and define a macro when it is.
734// g++ only defines the macro in 4.3.2 and onwards.
735#if !defined(_LIBCPP_NO_RTTI)
736#  if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
737   (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
738#    define _LIBCPP_NO_RTTI
739#  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
740#    define _LIBCPP_NO_RTTI
741#  endif
742#endif
743
744#ifndef _LIBCPP_WEAK
745#  define _LIBCPP_WEAK __attribute__((__weak__))
746#endif
747
748#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
749#  error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
750         _LIBCPP_HAS_NO_THREADS is defined.
751#endif
752
753// Systems that use capability-based security (FreeBSD with Capsicum,
754// Nuxi CloudABI) may only provide local filesystem access (using *at()).
755// Functions like open(), rename(), unlink() and stat() should not be
756// used, as they attempt to access the global filesystem namespace.
757#ifdef __CloudABI__
758#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
759#endif
760
761// CloudABI is intended for running networked services. Processes do not
762// have standard input and output channels.
763#ifdef __CloudABI__
764#define _LIBCPP_HAS_NO_STDIN
765#define _LIBCPP_HAS_NO_STDOUT
766#endif
767
768#if defined(__ANDROID__) || defined(__CloudABI__)
769#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
770#endif
771
772// Thread-unsafe functions such as strtok(), mbtowc() and localtime()
773// are not available.
774#ifdef __CloudABI__
775#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
776#endif
777
778#endif  // _LIBCPP_CONFIG
779