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