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