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#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16#    define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
17#  endif
18#endif
19
20#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
21#pragma GCC system_header
22#endif
23
24#ifdef __cplusplus
25
26#ifdef __GNUC__
27#  define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
28// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme
29// introduced in GCC 5.0.
30#  define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__)
31#else
32#  define _GNUC_VER 0
33#  define _GNUC_VER_NEW 0
34#endif
35
36#define _LIBCPP_VERSION 7000
37
38#ifndef _LIBCPP_ABI_VERSION
39#  ifdef __Fuchsia__
40#    define _LIBCPP_ABI_VERSION 2
41#  else
42#    define _LIBCPP_ABI_VERSION 1
43#  endif
44#endif
45
46#ifndef _LIBCPP_STD_VER
47#  if  __cplusplus <= 201103L
48#    define _LIBCPP_STD_VER 11
49#  elif __cplusplus <= 201402L
50#    define _LIBCPP_STD_VER 14
51#  elif __cplusplus <= 201703L
52#    define _LIBCPP_STD_VER 17
53#  else
54#    define _LIBCPP_STD_VER 18  // current year, or date of c++2a ratification
55#  endif
56#endif  // _LIBCPP_STD_VER
57
58#if defined(__ELF__)
59#  define _LIBCPP_OBJECT_FORMAT_ELF   1
60#elif defined(__MACH__)
61#  define _LIBCPP_OBJECT_FORMAT_MACHO 1
62#elif defined(_WIN32)
63#  define _LIBCPP_OBJECT_FORMAT_COFF  1
64#elif defined(__wasm__)
65#  define _LIBCPP_OBJECT_FORMAT_WASM  1
66#else
67#  error Unknown object file format
68#endif
69
70#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
71// Change short string representation so that string data starts at offset 0,
72// improving its alignment in some cases.
73#  define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
74// Fix deque iterator type in order to support incomplete types.
75#  define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
76// Fix undefined behavior in how std::list stores its linked nodes.
77#  define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
78// Fix undefined behavior in  how __tree stores its end and parent nodes.
79#  define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
80// Fix undefined behavior in how __hash_table stores its pointer types.
81#  define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
82#  define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
83#  define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
84// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
85// provided under the alternate keyword __nullptr, which changes the mangling
86// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
87#  define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
88// Define the `pointer_safety` enum as a C++11 strongly typed enumeration
89// instead of as a class simulating an enum. If this option is enabled
90// `pointer_safety` and `get_pointer_safety()` will no longer be available
91// in C++03.
92#  define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
93// Define a key function for `bad_function_call` in the library, to centralize
94// its vtable and typeinfo to libc++ rather than having all other libraries
95// using that class define their own copies.
96#  define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
97// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
98#  define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
99// Use the smallest possible integer type to represent the index of the variant.
100// Previously libc++ used "unsigned int" exclusivly.
101#  define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
102#elif _LIBCPP_ABI_VERSION == 1
103#  if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
104// Enable compiling copies of now inline methods into the dylib to support
105// applications compiled against older libraries. This is unnecessary with
106// COFF dllexport semantics, since dllexport forces a non-inline definition
107// of inline functions to be emitted anyway. Our own non-inline copy would
108// conflict with the dllexport-emitted copy, so we disable it.
109#    define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
110#  endif
111// Feature macros for disabling pre ABI v1 features. All of these options
112// are deprecated.
113#  if defined(__FreeBSD__)
114#    define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
115#  endif
116#endif
117
118#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
119#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
120       use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
121#endif
122
123#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
124#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
125
126#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
127
128#if __cplusplus < 201103L
129#define _LIBCPP_CXX03_LANG
130#endif
131
132#ifndef __has_attribute
133#define __has_attribute(__x) 0
134#endif
135
136#ifndef __has_builtin
137#define __has_builtin(__x) 0
138#endif
139
140#ifndef __has_extension
141#define __has_extension(__x) 0
142#endif
143
144#ifndef __has_feature
145#define __has_feature(__x) 0
146#endif
147
148#ifndef __has_cpp_attribute
149#define __has_cpp_attribute(__x) 0
150#endif
151
152// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
153// the compiler and '1' otherwise.
154#ifndef __is_identifier
155#define __is_identifier(__x) 1
156#endif
157
158#ifndef __has_declspec_attribute
159#define __has_declspec_attribute(__x) 0
160#endif
161
162#define __has_keyword(__x) !(__is_identifier(__x))
163
164#ifndef __has_include
165#define __has_include(...) 0
166#endif
167
168#if defined(__clang__)
169#  define _LIBCPP_COMPILER_CLANG
170#  ifndef __apple_build_version__
171#    define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
172#  endif
173#elif defined(__GNUC__)
174#  define _LIBCPP_COMPILER_GCC
175#elif defined(_MSC_VER)
176#  define _LIBCPP_COMPILER_MSVC
177#elif defined(__IBMCPP__)
178#  define _LIBCPP_COMPILER_IBM
179#endif
180
181#ifndef _LIBCPP_CLANG_VER
182#define _LIBCPP_CLANG_VER 0
183#endif
184
185// FIXME: ABI detection should be done via compiler builtin macros. This
186// is just a placeholder until Clang implements such macros. For now assume
187// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
188// and allow the user to explicitly specify the ABI to handle cases where this
189// heuristic falls short.
190#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT)
191#  error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined"
192#elif defined(_LIBCPP_ABI_FORCE_ITANIUM)
193#  define _LIBCPP_ABI_ITANIUM
194#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT)
195#  define _LIBCPP_ABI_MICROSOFT
196#else
197#  if defined(_WIN32) && defined(_MSC_VER)
198#    define _LIBCPP_ABI_MICROSOFT
199#  else
200#    define _LIBCPP_ABI_ITANIUM
201#  endif
202#endif
203
204// Need to detect which libc we're using if we're on Linux.
205#if defined(__linux__)
206#  include <features.h>
207#  if defined(__GLIBC_PREREQ)
208#    define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
209#  else
210#    define _LIBCPP_GLIBC_PREREQ(a, b) 0
211#  endif // defined(__GLIBC_PREREQ)
212#endif // defined(__linux__)
213
214#ifdef __LITTLE_ENDIAN__
215#  if __LITTLE_ENDIAN__
216#    define _LIBCPP_LITTLE_ENDIAN
217#  endif  // __LITTLE_ENDIAN__
218#endif  // __LITTLE_ENDIAN__
219
220#ifdef __BIG_ENDIAN__
221#  if __BIG_ENDIAN__
222#    define _LIBCPP_BIG_ENDIAN
223#  endif  // __BIG_ENDIAN__
224#endif  // __BIG_ENDIAN__
225
226#ifdef __BYTE_ORDER__
227#  if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
228#    define _LIBCPP_LITTLE_ENDIAN
229#  elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
230#    define _LIBCPP_BIG_ENDIAN
231#  endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
232#endif // __BYTE_ORDER__
233
234#ifdef __FreeBSD__
235#  include <sys/endian.h>
236#  if _BYTE_ORDER == _LITTLE_ENDIAN
237#    define _LIBCPP_LITTLE_ENDIAN
238#  else  // _BYTE_ORDER == _LITTLE_ENDIAN
239#    define _LIBCPP_BIG_ENDIAN
240#  endif  // _BYTE_ORDER == _LITTLE_ENDIAN
241#  ifndef __LONG_LONG_SUPPORTED
242#    define _LIBCPP_HAS_NO_LONG_LONG
243#  endif  // __LONG_LONG_SUPPORTED
244#endif  // __FreeBSD__
245
246#ifdef __NetBSD__
247#  include <sys/endian.h>
248#  if _BYTE_ORDER == _LITTLE_ENDIAN
249#    define _LIBCPP_LITTLE_ENDIAN
250#  else  // _BYTE_ORDER == _LITTLE_ENDIAN
251#    define _LIBCPP_BIG_ENDIAN
252#  endif  // _BYTE_ORDER == _LITTLE_ENDIAN
253#  define _LIBCPP_HAS_QUICK_EXIT
254#endif  // __NetBSD__
255
256#if defined(_WIN32)
257#  define _LIBCPP_WIN32API
258#  define _LIBCPP_LITTLE_ENDIAN
259#  define _LIBCPP_SHORT_WCHAR   1
260// Both MinGW and native MSVC provide a "MSVC"-like enviroment
261#  define _LIBCPP_MSVCRT_LIKE
262// If mingw not explicitly detected, assume using MS C runtime only if
263// a MS compatibility version is specified.
264#  if defined(_MSC_VER) && !defined(__MINGW32__)
265#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
266#  endif
267#  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
268#    define _LIBCPP_HAS_BITSCAN64
269#  endif
270#  define _LIBCPP_HAS_OPEN_WITH_WCHAR
271#  if defined(_LIBCPP_MSVCRT)
272#    define _LIBCPP_HAS_QUICK_EXIT
273#  endif
274
275// Some CRT APIs are unavailable to store apps
276#  if defined(WINAPI_FAMILY)
277#    include <winapifamily.h>
278#    if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) &&                  \
279        (!defined(WINAPI_PARTITION_SYSTEM) ||                                  \
280         !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
281#      define _LIBCPP_WINDOWS_STORE_APP
282#    endif
283#  endif
284#endif // defined(_WIN32)
285
286#ifdef __sun__
287#  include <sys/isa_defs.h>
288#  ifdef _LITTLE_ENDIAN
289#    define _LIBCPP_LITTLE_ENDIAN
290#  else
291#    define _LIBCPP_BIG_ENDIAN
292#  endif
293#endif // __sun__
294
295#if defined(__CloudABI__)
296   // Certain architectures provide arc4random(). Prefer using
297   // arc4random() over /dev/{u,}random to make it possible to obtain
298   // random data even when using sandboxing mechanisms such as chroots,
299   // Capsicum, etc.
300#  define _LIBCPP_USING_ARC4_RANDOM
301#elif defined(__Fuchsia__)
302#  define _LIBCPP_USING_GETENTROPY
303#elif defined(__native_client__)
304   // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
305   // including accesses to the special files under /dev. C++11's
306   // std::random_device is instead exposed through a NaCl syscall.
307#  define _LIBCPP_USING_NACL_RANDOM
308#elif defined(_LIBCPP_WIN32API)
309#  define _LIBCPP_USING_WIN32_RANDOM
310#else
311#  define _LIBCPP_USING_DEV_RANDOM
312#endif
313
314#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
315#  include <endian.h>
316#  if __BYTE_ORDER == __LITTLE_ENDIAN
317#    define _LIBCPP_LITTLE_ENDIAN
318#  elif __BYTE_ORDER == __BIG_ENDIAN
319#    define _LIBCPP_BIG_ENDIAN
320#  else  // __BYTE_ORDER == __BIG_ENDIAN
321#    error unable to determine endian
322#  endif
323#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
324
325#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
326#  define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
327#else
328#  define _LIBCPP_NO_CFI
329#endif
330
331#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
332#  if defined(__FreeBSD__)
333#    define _LIBCPP_HAS_QUICK_EXIT
334#    define _LIBCPP_HAS_C11_FEATURES
335#  elif defined(__Fuchsia__)
336#    define _LIBCPP_HAS_QUICK_EXIT
337#    define _LIBCPP_HAS_TIMESPEC_GET
338#    define _LIBCPP_HAS_C11_FEATURES
339#  elif defined(__linux__)
340#    if !defined(_LIBCPP_HAS_MUSL_LIBC)
341#      if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
342#        define _LIBCPP_HAS_QUICK_EXIT
343#      endif
344#      if _LIBCPP_GLIBC_PREREQ(2, 17)
345#        define _LIBCPP_HAS_C11_FEATURES
346#        define _LIBCPP_HAS_TIMESPEC_GET
347#      endif
348#    else // defined(_LIBCPP_HAS_MUSL_LIBC)
349#      define _LIBCPP_HAS_QUICK_EXIT
350#      define _LIBCPP_HAS_TIMESPEC_GET
351#      define _LIBCPP_HAS_C11_FEATURES
352#    endif
353#  endif // __linux__
354#endif
355
356#if defined(_LIBCPP_COMPILER_CLANG)
357
358// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
359// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
360#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&       \
361     (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) ||                           \
362    defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
363#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
364#endif
365
366#if __has_feature(cxx_alignas)
367#  define _ALIGNAS_TYPE(x) alignas(x)
368#  define _ALIGNAS(x) alignas(x)
369#else
370#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
371#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
372#endif
373
374#if __cplusplus < 201103L
375typedef __char16_t char16_t;
376typedef __char32_t char32_t;
377#endif
378
379#if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
380#define _LIBCPP_NO_EXCEPTIONS
381#endif
382
383#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI)
384#define _LIBCPP_NO_RTTI
385#endif
386
387#if !(__has_feature(cxx_strong_enums))
388#define _LIBCPP_HAS_NO_STRONG_ENUMS
389#endif
390
391#if !(__has_feature(cxx_decltype))
392#define _LIBCPP_HAS_NO_DECLTYPE
393#endif
394
395#if __has_feature(cxx_attributes)
396#  define _LIBCPP_NORETURN [[noreturn]]
397#else
398#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
399#endif
400
401#if !(__has_feature(cxx_lambdas))
402#define _LIBCPP_HAS_NO_LAMBDAS
403#endif
404
405#if !(__has_feature(cxx_nullptr))
406#  if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
407#    define nullptr __nullptr
408#  else
409#    define _LIBCPP_HAS_NO_NULLPTR
410#  endif
411#endif
412
413#if !(__has_feature(cxx_rvalue_references))
414#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
415#endif
416
417#if !(__has_feature(cxx_auto_type))
418#define _LIBCPP_HAS_NO_AUTO_TYPE
419#endif
420
421#if !(__has_feature(cxx_variadic_templates))
422#define _LIBCPP_HAS_NO_VARIADICS
423#endif
424
425#if !(__has_feature(cxx_generalized_initializers))
426#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
427#endif
428
429#if __has_feature(is_base_of)
430#define _LIBCPP_HAS_IS_BASE_OF
431#endif
432
433#if __has_feature(is_final)
434#define _LIBCPP_HAS_IS_FINAL
435#endif
436
437// Objective-C++ features (opt-in)
438#if __has_feature(objc_arc)
439#define _LIBCPP_HAS_OBJC_ARC
440#endif
441
442#if __has_feature(objc_arc_weak)
443#define _LIBCPP_HAS_OBJC_ARC_WEAK
444#endif
445
446#if !(__has_feature(cxx_constexpr))
447#define _LIBCPP_HAS_NO_CONSTEXPR
448#endif
449
450#if !(__has_feature(cxx_relaxed_constexpr))
451#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
452#endif
453
454#if !(__has_feature(cxx_variable_templates))
455#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
456#endif
457
458#if !(__has_feature(cxx_noexcept))
459#define _LIBCPP_HAS_NO_NOEXCEPT
460#endif
461
462#if __has_feature(underlying_type)
463#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
464#endif
465
466#if __has_feature(is_literal)
467#define _LIBCPP_IS_LITERAL(T) __is_literal(T)
468#endif
469
470// Inline namespaces are available in Clang regardless of C++ dialect.
471#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
472#define _LIBCPP_END_NAMESPACE_STD  } }
473#define _VSTD std::_LIBCPP_NAMESPACE
474
475namespace std {
476  inline namespace _LIBCPP_NAMESPACE {
477  }
478}
479
480#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
481#define _LIBCPP_HAS_NO_ASAN
482#endif
483
484// Allow for build-time disabling of unsigned integer sanitization
485#if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
486#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
487#endif
488
489#if __has_builtin(__builtin_launder)
490#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
491#endif
492
493#if !__is_identifier(__has_unique_object_representations)
494#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
495#endif
496
497#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
498
499#elif defined(_LIBCPP_COMPILER_GCC)
500
501#define _ALIGNAS(x) __attribute__((__aligned__(x)))
502#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
503
504#define _LIBCPP_NORETURN __attribute__((noreturn))
505
506#if _GNUC_VER >= 407
507#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
508#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
509#define _LIBCPP_HAS_IS_FINAL
510#endif
511
512#if defined(__GNUC__) && _GNUC_VER >= 403
513#define _LIBCPP_HAS_IS_BASE_OF
514#endif
515
516#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)
517#define _LIBCPP_NO_EXCEPTIONS
518#endif
519
520// constexpr was added to GCC in 4.6.
521#if _GNUC_VER < 406
522#  define _LIBCPP_HAS_NO_CONSTEXPR
523// Can only use constexpr in c++11 mode.
524#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
525#  define _LIBCPP_HAS_NO_CONSTEXPR
526#endif
527
528// Determine if GCC supports relaxed constexpr
529#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
530#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
531#endif
532
533// GCC 5 will support variable templates
534#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
535#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
536#endif
537
538#ifndef __GXX_EXPERIMENTAL_CXX0X__
539
540#define _LIBCPP_HAS_NO_DECLTYPE
541#define _LIBCPP_HAS_NO_NULLPTR
542#define _LIBCPP_HAS_NO_UNICODE_CHARS
543#define _LIBCPP_HAS_NO_VARIADICS
544#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
545#define _LIBCPP_HAS_NO_STRONG_ENUMS
546#define _LIBCPP_HAS_NO_NOEXCEPT
547
548#else  // __GXX_EXPERIMENTAL_CXX0X__
549
550#if _GNUC_VER < 403
551#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
552#endif
553
554
555#if _GNUC_VER < 404
556#define _LIBCPP_HAS_NO_DECLTYPE
557#define _LIBCPP_HAS_NO_UNICODE_CHARS
558#define _LIBCPP_HAS_NO_VARIADICS
559#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
560#endif  // _GNUC_VER < 404
561
562#if _GNUC_VER < 406
563#define _LIBCPP_HAS_NO_NOEXCEPT
564#define _LIBCPP_HAS_NO_NULLPTR
565#endif
566
567#endif  // __GXX_EXPERIMENTAL_CXX0X__
568
569#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
570#define _LIBCPP_END_NAMESPACE_STD  } }
571#define _VSTD std::_LIBCPP_NAMESPACE
572
573namespace std {
574  inline namespace _LIBCPP_NAMESPACE {
575  }
576}
577
578#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
579#define _LIBCPP_HAS_NO_ASAN
580#endif
581
582#if _GNUC_VER >= 700
583#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
584#endif
585
586#if _GNUC_VER >= 700
587#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
588#endif
589
590#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
591
592#elif defined(_LIBCPP_COMPILER_MSVC)
593
594#define _LIBCPP_TOSTRING2(x) #x
595#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
596#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
597
598#if _MSC_VER < 1900
599#error "MSVC versions prior to Visual Studio 2015 are not supported"
600#endif
601
602#define _LIBCPP_HAS_IS_BASE_OF
603#define _LIBCPP_HAS_NO_CONSTEXPR
604#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
605#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
606#define _LIBCPP_HAS_NO_NOEXCEPT
607#define __alignof__ __alignof
608#define _LIBCPP_NORETURN __declspec(noreturn)
609#define _ALIGNAS(x) __declspec(align(x))
610#define _ALIGNAS_TYPE(x) alignas(x)
611#define _LIBCPP_HAS_NO_VARIADICS
612
613#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
614#define _LIBCPP_END_NAMESPACE_STD  }
615#define _VSTD std
616
617namespace std {
618}
619
620#define _LIBCPP_WEAK
621
622#define _LIBCPP_HAS_NO_ASAN
623
624#define _LIBCPP_ALWAYS_INLINE __forceinline
625
626#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
627
628#elif defined(_LIBCPP_COMPILER_IBM)
629
630#define _ALIGNAS(x) __attribute__((__aligned__(x)))
631#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
632#define _ATTRIBUTE(x) __attribute__((x))
633#define _LIBCPP_NORETURN __attribute__((noreturn))
634
635#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
636#define _LIBCPP_HAS_NO_NOEXCEPT
637#define _LIBCPP_HAS_NO_NULLPTR
638#define _LIBCPP_HAS_NO_UNICODE_CHARS
639#define _LIBCPP_HAS_IS_BASE_OF
640#define _LIBCPP_HAS_IS_FINAL
641#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
642
643#if defined(_AIX)
644#define __MULTILOCALE_API
645#endif
646
647#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
648#define _LIBCPP_END_NAMESPACE_STD  } }
649#define _VSTD std::_LIBCPP_NAMESPACE
650
651namespace std {
652  inline namespace _LIBCPP_NAMESPACE {
653  }
654}
655
656#define _LIBCPP_HAS_NO_ASAN
657
658#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
659
660#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
661
662#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
663
664#if _LIBCPP_STD_VER >= 17
665#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
666  _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem {
667#else
668#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
669  _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
670#endif
671
672#define _LIBCPP_END_NAMESPACE_FILESYSTEM \
673  _LIBCPP_END_NAMESPACE_STD } }
674
675#define _VSTD_FS _VSTD::__fs::filesystem
676
677
678#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
679
680#ifdef _DLL
681#  define _LIBCPP_CRT_FUNC __declspec(dllimport)
682#else
683#  define _LIBCPP_CRT_FUNC
684#endif
685
686#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
687#  define _LIBCPP_DLL_VIS
688#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
689#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
690#  define _LIBCPP_OVERRIDABLE_FUNC_VIS
691#elif defined(_LIBCPP_BUILDING_LIBRARY)
692#  define _LIBCPP_DLL_VIS __declspec(dllexport)
693#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
694#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
695#  define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
696#else
697#  define _LIBCPP_DLL_VIS __declspec(dllimport)
698#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
699#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
700#  define _LIBCPP_OVERRIDABLE_FUNC_VIS
701#endif
702
703#define _LIBCPP_TYPE_VIS            _LIBCPP_DLL_VIS
704#define _LIBCPP_FUNC_VIS            _LIBCPP_DLL_VIS
705#define _LIBCPP_EXTERN_VIS          _LIBCPP_DLL_VIS
706#define _LIBCPP_EXCEPTION_ABI       _LIBCPP_DLL_VIS
707#define _LIBCPP_HIDDEN
708#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
709#define _LIBCPP_TEMPLATE_VIS
710#define _LIBCPP_ENUM_VIS
711
712#if defined(_LIBCPP_COMPILER_MSVC)
713#  define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
714#else
715#  define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
716#endif
717
718#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
719
720#ifndef _LIBCPP_HIDDEN
721#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
722#    define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
723#  else
724#    define _LIBCPP_HIDDEN
725#  endif
726#endif
727
728#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
729#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
730// The inline should be removed once PR32114 is resolved
731#    define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
732#  else
733#    define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
734#  endif
735#endif
736
737#ifndef _LIBCPP_FUNC_VIS
738#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
739#    define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
740#  else
741#    define _LIBCPP_FUNC_VIS
742#  endif
743#endif
744
745#ifndef _LIBCPP_TYPE_VIS
746#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
747#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
748#  else
749#    define _LIBCPP_TYPE_VIS
750#  endif
751#endif
752
753#ifndef _LIBCPP_TEMPLATE_VIS
754#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
755#    if __has_attribute(__type_visibility__)
756#      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
757#    else
758#      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
759#    endif
760#  else
761#    define _LIBCPP_TEMPLATE_VIS
762#  endif
763#endif
764
765#ifndef _LIBCPP_EXTERN_VIS
766#define _LIBCPP_EXTERN_VIS
767#endif
768
769#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
770#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
771#endif
772
773#ifndef _LIBCPP_EXCEPTION_ABI
774#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
775#    define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
776#  else
777#    define _LIBCPP_EXCEPTION_ABI
778#  endif
779#endif
780
781#ifndef _LIBCPP_ENUM_VIS
782#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
783#    define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default")))
784#  else
785#    define _LIBCPP_ENUM_VIS
786#  endif
787#endif
788
789#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
790#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
791#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
792#  else
793#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
794#  endif
795#endif
796
797#ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
798#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
799#endif
800
801#if __has_attribute(internal_linkage)
802#  define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage))
803#else
804#  define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE
805#endif
806
807#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU
808#  ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
809#    define _LIBCPP_HIDE_FROM_ABI_PER_TU 0
810#  else
811#    define _LIBCPP_HIDE_FROM_ABI_PER_TU 1
812#  endif
813#endif
814
815#ifndef _LIBCPP_HIDE_FROM_ABI
816#  if _LIBCPP_HIDE_FROM_ABI_PER_TU
817#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
818#  else
819#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE
820#  endif
821#endif
822
823// Just so we can migrate to _LIBCPP_HIDE_FROM_ABI gradually.
824#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
825
826#ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
827#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
828#    define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__))
829#  else
830#    define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__))
831#  endif
832#endif
833
834#ifndef _LIBCPP_PREFERRED_OVERLOAD
835#  if __has_attribute(__enable_if__)
836#    define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
837#  endif
838#endif
839
840#ifndef _LIBCPP_HAS_NO_NOEXCEPT
841#  define _NOEXCEPT noexcept
842#  define _NOEXCEPT_(x) noexcept(x)
843#else
844#  define _NOEXCEPT throw()
845#  define _NOEXCEPT_(x)
846#endif
847
848#if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
849#  if !defined(_LIBCPP_DEBUG)
850#    error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
851#  endif
852#  ifdef _LIBCPP_HAS_NO_NOEXCEPT
853#    define _NOEXCEPT_DEBUG
854#    define _NOEXCEPT_DEBUG_(x)
855#  else
856#    define _NOEXCEPT_DEBUG noexcept(false)
857#    define _NOEXCEPT_DEBUG_(x) noexcept(false)
858#  endif
859#else
860#  define _NOEXCEPT_DEBUG _NOEXCEPT
861#  define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
862#endif
863
864#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
865typedef unsigned short char16_t;
866typedef unsigned int   char32_t;
867#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
868
869#ifndef __SIZEOF_INT128__
870#define _LIBCPP_HAS_NO_INT128
871#endif
872
873#ifdef _LIBCPP_CXX03_LANG
874#  if __has_extension(c_static_assert)
875#    define static_assert(__b, __m) _Static_assert(__b, __m)
876#  else
877extern "C++" {
878template <bool> struct __static_assert_test;
879template <> struct __static_assert_test<true> {};
880template <unsigned> struct __static_assert_check {};
881}
882#    define static_assert(__b, __m) \
883       typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
884       _LIBCPP_CONCAT(__t, __LINE__)
885#  endif // __has_extension(c_static_assert)
886#endif  // _LIBCPP_CXX03_LANG
887
888#ifdef _LIBCPP_HAS_NO_DECLTYPE
889// GCC 4.6 provides __decltype in all standard modes.
890#  if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
891#    define decltype(__x) __decltype(__x)
892#  else
893#    define decltype(__x) __typeof__(__x)
894#  endif
895#endif
896
897#ifdef _LIBCPP_HAS_NO_CONSTEXPR
898#  define _LIBCPP_CONSTEXPR
899#else
900#  define _LIBCPP_CONSTEXPR constexpr
901#endif
902
903#ifdef _LIBCPP_CXX03_LANG
904#  define _LIBCPP_DEFAULT {}
905#else
906#  define _LIBCPP_DEFAULT = default;
907#endif
908
909#ifdef _LIBCPP_CXX03_LANG
910#  define _LIBCPP_EQUAL_DELETE
911#else
912#  define _LIBCPP_EQUAL_DELETE = delete
913#endif
914
915#ifdef __GNUC__
916#  define _NOALIAS __attribute__((__malloc__))
917#else
918#  define _NOALIAS
919#endif
920
921#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
922    (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions
923#  define _LIBCPP_EXPLICIT explicit
924#else
925#  define _LIBCPP_EXPLICIT
926#endif
927
928#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
929#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
930#endif
931
932#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
933#  define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
934#  define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
935     __lx __v_; \
936     _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \
937     _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
938     _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \
939     };
940#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
941#  define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
942#  define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
943#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
944
945#ifdef _LIBCPP_DEBUG
946#  if _LIBCPP_DEBUG == 0
947#    define _LIBCPP_DEBUG_LEVEL 1
948#  elif _LIBCPP_DEBUG == 1
949#    define _LIBCPP_DEBUG_LEVEL 2
950#  else
951#    error Supported values for _LIBCPP_DEBUG are 0 and 1
952#  endif
953#  if !defined(_LIBCPP_BUILDING_LIBRARY)
954#    define _LIBCPP_EXTERN_TEMPLATE(...)
955#  endif
956#endif
957
958#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
959#define _LIBCPP_EXTERN_TEMPLATE(...)
960#define _LIBCPP_EXTERN_TEMPLATE2(...)
961#endif
962
963#ifndef _LIBCPP_EXTERN_TEMPLATE
964#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
965#endif
966
967#ifndef _LIBCPP_EXTERN_TEMPLATE2
968#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
969#endif
970
971#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
972#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
973#endif
974
975#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
976    defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
977#define _LIBCPP_LOCALE__L_EXTENSIONS 1
978#endif
979
980#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
981// Most unix variants have catopen.  These are the specific ones that don't.
982#  if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
983#    define _LIBCPP_HAS_CATOPEN 1
984#  endif
985#endif
986
987#ifdef __FreeBSD__
988#define _DECLARE_C99_LDBL_MATH 1
989#endif
990
991// If we are getting operator new from the MSVC CRT, then allocation overloads
992// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
993#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
994#define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
995#endif
996
997#if defined(__APPLE__)
998#  if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
999      defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
1000#    define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
1001#  endif
1002#  if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
1003#    if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
1004#      define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
1005#    endif
1006#  endif
1007#endif // defined(__APPLE__)
1008
1009#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
1010    !defined(_LIBCPP_BUILDING_LIBRARY) && \
1011    (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
1012#  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
1013#endif
1014
1015#if defined(__APPLE__) || defined(__FreeBSD__)
1016#define _LIBCPP_HAS_DEFAULTRUNELOCALE
1017#endif
1018
1019#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
1020#define _LIBCPP_WCTYPE_IS_MASK
1021#endif
1022
1023#if _LIBCPP_STD_VER > 11
1024#  define _LIBCPP_DEPRECATED [[deprecated]]
1025#else
1026#  define _LIBCPP_DEPRECATED
1027#endif
1028
1029#if _LIBCPP_STD_VER <= 11
1030#  define _LIBCPP_EXPLICIT_AFTER_CXX11
1031#  define _LIBCPP_DEPRECATED_AFTER_CXX11
1032#else
1033#  define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
1034#  define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
1035#endif
1036
1037#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1038#  define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
1039#else
1040#  define _LIBCPP_CONSTEXPR_AFTER_CXX11
1041#endif
1042
1043#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1044#  define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
1045#else
1046#  define _LIBCPP_CONSTEXPR_AFTER_CXX14
1047#endif
1048
1049#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1050#  define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
1051#else
1052#  define _LIBCPP_CONSTEXPR_AFTER_CXX17
1053#endif
1054
1055#if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17)
1056#  define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
1057#else
1058#  define _LIBCPP_NODISCARD_AFTER_CXX17
1059#endif
1060
1061#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
1062#  define _LIBCPP_INLINE_VAR inline
1063#else
1064#  define _LIBCPP_INLINE_VAR
1065#endif
1066
1067#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1068#  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
1069#else
1070#  define _LIBCPP_EXPLICIT_MOVE(x) (x)
1071#endif
1072
1073#ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG
1074#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1075#define _LIBCPP_CONSTEXPR_IF_NODEBUG
1076#else
1077#define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr
1078#endif
1079#endif
1080
1081#ifndef _LIBCPP_HAS_NO_ASAN
1082_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1083  const void *, const void *, const void *, const void *);
1084#endif
1085
1086// Try to find out if RTTI is disabled.
1087// g++ and cl.exe have RTTI on by default and define a macro when it is.
1088// g++ only defines the macro in 4.3.2 and onwards.
1089#if !defined(_LIBCPP_NO_RTTI)
1090#  if defined(__GNUC__) && \
1091      ((__GNUC__ >= 5) || \
1092       (__GNUC__ == 4 && (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && \
1093      !defined(__GXX_RTTI)
1094#    define _LIBCPP_NO_RTTI
1095#  elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
1096#    define _LIBCPP_NO_RTTI
1097#  endif
1098#endif
1099
1100#ifndef _LIBCPP_WEAK
1101#define _LIBCPP_WEAK __attribute__((__weak__))
1102#endif
1103
1104// Thread API
1105#if !defined(_LIBCPP_HAS_NO_THREADS) && \
1106    !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
1107    !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
1108    !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1109#  if defined(__FreeBSD__) || \
1110      defined(__Fuchsia__) || \
1111      defined(__NetBSD__) || \
1112      defined(__linux__) || \
1113      defined(__APPLE__) || \
1114      defined(__CloudABI__) || \
1115      defined(__sun__) || \
1116      (defined(__MINGW32__) && __has_include(<pthread.h>))
1117#    define _LIBCPP_HAS_THREAD_API_PTHREAD
1118#  elif defined(_LIBCPP_WIN32API)
1119#    define _LIBCPP_HAS_THREAD_API_WIN32
1120#  else
1121#    error "No thread API"
1122#  endif // _LIBCPP_HAS_THREAD_API
1123#endif // _LIBCPP_HAS_NO_THREADS
1124
1125#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
1126#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
1127       _LIBCPP_HAS_NO_THREADS is not defined.
1128#endif
1129
1130#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1131#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
1132       _LIBCPP_HAS_NO_THREADS is defined.
1133#endif
1134
1135#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
1136#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
1137       _LIBCPP_HAS_NO_THREADS is defined.
1138#endif
1139
1140// Systems that use capability-based security (FreeBSD with Capsicum,
1141// Nuxi CloudABI) may only provide local filesystem access (using *at()).
1142// Functions like open(), rename(), unlink() and stat() should not be
1143// used, as they attempt to access the global filesystem namespace.
1144#ifdef __CloudABI__
1145#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
1146#endif
1147
1148// CloudABI is intended for running networked services. Processes do not
1149// have standard input and output channels.
1150#ifdef __CloudABI__
1151#define _LIBCPP_HAS_NO_STDIN
1152#define _LIBCPP_HAS_NO_STDOUT
1153#endif
1154
1155#if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
1156    defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1157#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
1158#endif
1159
1160// Thread-unsafe functions such as strtok() and localtime()
1161// are not available.
1162#ifdef __CloudABI__
1163#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
1164#endif
1165
1166#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
1167#  define _LIBCPP_HAS_C_ATOMIC_IMP
1168#elif _GNUC_VER > 407
1169#  define _LIBCPP_HAS_GCC_ATOMIC_IMP
1170#endif
1171
1172#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
1173     || defined(_LIBCPP_HAS_NO_THREADS)
1174#define _LIBCPP_HAS_NO_ATOMIC_HEADER
1175#endif
1176
1177#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1178#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1179#endif
1180
1181#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
1182#  if defined(__clang__) && __has_attribute(acquire_capability)
1183// Work around the attribute handling in clang.  When both __declspec and
1184// __attribute__ are present, the processing goes awry preventing the definition
1185// of the types.
1186#    if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
1187#      define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1188#    endif
1189#  endif
1190#endif
1191
1192#if __has_attribute(require_constant_initialization)
1193#  define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1194#else
1195#  define _LIBCPP_SAFE_STATIC
1196#endif
1197
1198#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
1199#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1200#endif
1201
1202#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
1203#  if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
1204#    define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
1205#  endif
1206#endif
1207
1208#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
1209#  define _LIBCPP_DIAGNOSE_WARNING(...) \
1210     __attribute__((diagnose_if(__VA_ARGS__, "warning")))
1211#  define _LIBCPP_DIAGNOSE_ERROR(...) \
1212     __attribute__((diagnose_if(__VA_ARGS__, "error")))
1213#else
1214#  define _LIBCPP_DIAGNOSE_WARNING(...)
1215#  define _LIBCPP_DIAGNOSE_ERROR(...)
1216#endif
1217
1218#if __has_attribute(fallthough) || _GNUC_VER >= 700
1219// Use a function like macro to imply that it must be followed by a semicolon
1220#  define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
1221#else
1222#  define _LIBCPP_FALLTHROUGH() ((void)0)
1223#endif
1224
1225#if defined(_LIBCPP_ABI_MICROSOFT) && \
1226    (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
1227#  define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
1228#else
1229#  define _LIBCPP_DECLSPEC_EMPTY_BASES
1230#endif
1231
1232#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
1233#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
1234#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
1235#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
1236#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
1237#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
1238
1239#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
1240#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1241#endif
1242
1243#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
1244#define _LIBCPP_HAS_NO_IS_AGGREGATE
1245#endif
1246
1247#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
1248#define _LIBCPP_HAS_NO_COROUTINES
1249#endif
1250
1251// FIXME: Correct this macro when either (A) a feature test macro for the
1252// spaceship operator is provided, or (B) a compiler provides a complete
1253// implementation.
1254#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
1255
1256// Decide whether to use availability macros.
1257#if !defined(_LIBCPP_BUILDING_LIBRARY) &&                                      \
1258    !defined(_LIBCPP_DISABLE_AVAILABILITY) &&                                  \
1259    __has_feature(attribute_availability_with_strict) &&                       \
1260    __has_feature(attribute_availability_in_templates)
1261#  ifdef __APPLE__
1262#    define _LIBCPP_USE_AVAILABILITY_APPLE
1263#  endif
1264#endif
1265
1266// Define availability macros.
1267#if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
1268#  define _LIBCPP_AVAILABILITY_SHARED_MUTEX                                    \
1269     __attribute__((availability(macosx,strict,introduced=10.12)))             \
1270     __attribute__((availability(ios,strict,introduced=10.0)))                 \
1271     __attribute__((availability(tvos,strict,introduced=10.0)))                \
1272     __attribute__((availability(watchos,strict,introduced=3.0)))
1273#  define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
1274#  define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
1275#  define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
1276#  define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS                             \
1277     __attribute__((availability(macosx,strict,introduced=10.12)))             \
1278     __attribute__((availability(ios,strict,introduced=10.0)))                 \
1279     __attribute__((availability(tvos,strict,introduced=10.0)))                \
1280     __attribute__((availability(watchos,strict,introduced=3.0)))
1281#  define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE                                \
1282     __attribute__((availability(macosx,strict,introduced=10.12)))             \
1283     __attribute__((availability(ios,strict,introduced=10.0)))                 \
1284     __attribute__((availability(tvos,strict,introduced=10.0)))                \
1285     __attribute__((availability(watchos,strict,introduced=3.0)))
1286#  define _LIBCPP_AVAILABILITY_FUTURE_ERROR                                    \
1287     __attribute__((availability(ios,strict,introduced=6.0)))
1288#  define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE                                 \
1289     __attribute__((availability(macosx,strict,introduced=10.9)))              \
1290     __attribute__((availability(ios,strict,introduced=7.0)))
1291#  define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY                                 \
1292     __attribute__((availability(macosx,strict,introduced=10.9)))              \
1293     __attribute__((availability(ios,strict,introduced=7.0)))
1294#  define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR                               \
1295     __attribute__((availability(macosx,strict,introduced=10.9)))              \
1296     __attribute__((availability(ios,strict,introduced=7.0)))
1297#else
1298#  define _LIBCPP_AVAILABILITY_SHARED_MUTEX
1299#  define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1300#  define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
1301#  define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1302#  define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
1303#  define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
1304#  define _LIBCPP_AVAILABILITY_FUTURE_ERROR
1305#  define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
1306#  define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
1307#  define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
1308#endif
1309
1310// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
1311#ifdef _LIBCPP_NO_EXCEPTIONS
1312#  define _LIBCPP_AVAILABILITY_DYNARRAY
1313#  define _LIBCPP_AVAILABILITY_FUTURE
1314#  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
1315#else
1316#  define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
1317#  define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
1318#  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST                              \
1319     _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1320#endif
1321
1322// Availability of stream API in the dylib got dropped and re-added.  The
1323// extern template should effectively be available at:
1324//    availability(macosx,introduced=10.9)
1325//    availability(ios,introduced=7.0)
1326#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) &&                                 \
1327    ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                \
1328      __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) ||                 \
1329     (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&               \
1330      __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
1331#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
1332#endif
1333
1334#if defined(_LIBCPP_COMPILER_IBM)
1335#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
1336#endif
1337
1338#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1339#  define _LIBCPP_PUSH_MACROS
1340#  define _LIBCPP_POP_MACROS
1341#else
1342  // Don't warn about macro conflicts when we can restore them at the
1343  // end of the header.
1344#  ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1345#    define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1346#  endif
1347#  if defined(_LIBCPP_COMPILER_MSVC)
1348#    define _LIBCPP_PUSH_MACROS    \
1349       __pragma(push_macro("min")) \
1350       __pragma(push_macro("max"))
1351#    define _LIBCPP_POP_MACROS     \
1352       __pragma(pop_macro("min"))  \
1353       __pragma(pop_macro("max"))
1354#  else
1355#    define _LIBCPP_PUSH_MACROS        \
1356       _Pragma("push_macro(\"min\")")  \
1357       _Pragma("push_macro(\"max\")")
1358#    define _LIBCPP_POP_MACROS         \
1359       _Pragma("pop_macro(\"min\")")   \
1360       _Pragma("pop_macro(\"max\")")
1361#  endif
1362#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1363
1364#ifndef _LIBCPP_NO_AUTO_LINK
1365#  if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1366#    if defined(_DLL)
1367#      pragma comment(lib, "c++.lib")
1368#    else
1369#      pragma comment(lib, "libc++.lib")
1370#    endif
1371#  endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1372#endif // _LIBCPP_NO_AUTO_LINK
1373
1374#endif // __cplusplus
1375
1376#endif // _LIBCPP_CONFIG
1377