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