2 //===--------------------------- __config ---------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_CONFIG
12 #define _LIBCPP_CONFIG
14 #if defined(_MSC_VER) && !defined(__clang__)
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
20 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
21 #pragma GCC system_header
27 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
28 // The _GNUC_VER_NEW macro better represents the new GCC versioning scheme
29 // introduced in GCC 5.0.
30 #define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__)
33 #define _GNUC_VER_NEW 0
36 #define _LIBCPP_VERSION 6000
38 #ifndef _LIBCPP_ABI_VERSION
39 #define _LIBCPP_ABI_VERSION 1
43 #define _LIBCPP_OBJECT_FORMAT_ELF 1
44 #elif defined(__MACH__)
45 #define _LIBCPP_OBJECT_FORMAT_MACHO 1
47 #define _LIBCPP_OBJECT_FORMAT_COFF 1
48 #elif defined(__wasm__)
49 #define _LIBCPP_OBJECT_FORMAT_WASM 1
51 #error Unknown object file format
54 #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
55 // Change short string representation so that string data starts at offset 0,
56 // improving its alignment in some cases.
57 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
58 // Fix deque iterator type in order to support incomplete types.
59 #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
60 // Fix undefined behavior in how std::list stores its linked nodes.
61 #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
62 // Fix undefined behavior in how __tree stores its end and parent nodes.
63 #define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
64 // Fix undefined behavior in how __hash_table stores its pointer types.
65 #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
66 #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
67 #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
68 // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
69 // provided under the alternate keyword __nullptr, which changes the mangling
70 // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
71 #define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
72 // Define the `pointer_safety` enum as a C++11 strongly typed enumeration
73 // instead of as a class simulating an enum. If this option is enabled
74 // `pointer_safety` and `get_pointer_safety()` will no longer be available
76 #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
77 // Define a key function for `bad_function_call` in the library, to centralize
78 // its vtable and typeinfo to libc++ rather than having all other libraries
79 // using that class define their own copies.
80 #define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
81 // Enable optimized version of __do_get_(un)signed which avoids redundant copies.
82 #define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
83 // Use the smallest possible integer type to represent the index of the variant.
84 // Previously libc++ used "unsigned int" exclusivly.
85 #define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
86 #elif _LIBCPP_ABI_VERSION == 1
87 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
88 // Enable compiling copies of now inline methods into the dylib to support
89 // applications compiled against older libraries. This is unnecessary with
90 // COFF dllexport semantics, since dllexport forces a non-inline definition
91 // of inline functions to be emitted anyway. Our own non-inline copy would
92 // conflict with the dllexport-emitted copy, so we disable it.
93 #define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
95 // Feature macros for disabling pre ABI v1 features. All of these options
97 #if defined(__FreeBSD__)
98 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
102 #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
103 #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
104 use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
107 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
108 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
110 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
112 #if __cplusplus < 201103L
113 #define _LIBCPP_CXX03_LANG
116 #ifndef __has_attribute
117 #define __has_attribute(__x) 0
119 #ifndef __has_builtin
120 #define __has_builtin(__x) 0
122 #ifndef __has_extension
123 #define __has_extension(__x) 0
125 #ifndef __has_feature
126 #define __has_feature(__x) 0
128 #ifndef __has_cpp_attribute
129 #define __has_cpp_attribute(__x) 0
131 // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
132 // the compiler and '1' otherwise.
133 #ifndef __is_identifier
134 #define __is_identifier(__x) 1
136 #ifndef __has_declspec_attribute
137 #define __has_declspec_attribute(__x) 0
140 #define __has_keyword(__x) !(__is_identifier(__x))
143 #define __libcpp_has_include(__x) __has_include(__x)
145 #define __libcpp_has_include(__x) 0
148 #if defined(__clang__)
149 #define _LIBCPP_COMPILER_CLANG
150 # ifndef __apple_build_version__
151 # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
153 #elif defined(__GNUC__)
154 #define _LIBCPP_COMPILER_GCC
155 #elif defined(_MSC_VER)
156 #define _LIBCPP_COMPILER_MSVC
157 #elif defined(__IBMCPP__)
158 #define _LIBCPP_COMPILER_IBM
161 #ifndef _LIBCPP_CLANG_VER
162 #define _LIBCPP_CLANG_VER 0
165 // FIXME: ABI detection should be done via compiler builtin macros. This
166 // is just a placeholder until Clang implements such macros. For now assume
167 // that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
168 // and allow the user to explicitly specify the ABI to handle cases where this
169 // heuristic falls short.
170 #if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT)
171 # error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined"
172 #elif defined(_LIBCPP_ABI_FORCE_ITANIUM)
173 # define _LIBCPP_ABI_ITANIUM
174 #elif defined(_LIBCPP_ABI_FORCE_MICROSOFT)
175 # define _LIBCPP_ABI_MICROSOFT
177 # if defined(_WIN32) && defined(_MSC_VER)
178 # define _LIBCPP_ABI_MICROSOFT
180 # define _LIBCPP_ABI_ITANIUM
184 // Need to detect which libc we're using if we're on Linux.
185 #if defined(__linux__)
186 #include <features.h>
187 #if !defined(__GLIBC_PREREQ)
188 #define __GLIBC_PREREQ(a, b) 0
189 #endif // !defined(__GLIBC_PREREQ)
190 #endif // defined(__linux__)
192 #ifdef __LITTLE_ENDIAN__
193 #if __LITTLE_ENDIAN__
194 #define _LIBCPP_LITTLE_ENDIAN
195 #endif // __LITTLE_ENDIAN__
196 #endif // __LITTLE_ENDIAN__
198 #ifdef __BIG_ENDIAN__
200 #define _LIBCPP_BIG_ENDIAN
201 #endif // __BIG_ENDIAN__
202 #endif // __BIG_ENDIAN__
204 #ifdef __BYTE_ORDER__
205 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
206 #define _LIBCPP_LITTLE_ENDIAN
207 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
208 #define _LIBCPP_BIG_ENDIAN
209 #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
210 #endif // __BYTE_ORDER__
213 # include <sys/endian.h>
214 # if _BYTE_ORDER == _LITTLE_ENDIAN
215 # define _LIBCPP_LITTLE_ENDIAN
216 # else // _BYTE_ORDER == _LITTLE_ENDIAN
217 # define _LIBCPP_BIG_ENDIAN
218 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
219 # ifndef __LONG_LONG_SUPPORTED
220 # define _LIBCPP_HAS_NO_LONG_LONG
221 # endif // __LONG_LONG_SUPPORTED
222 #endif // __FreeBSD__
225 # include <sys/endian.h>
226 # if _BYTE_ORDER == _LITTLE_ENDIAN
227 # define _LIBCPP_LITTLE_ENDIAN
228 # else // _BYTE_ORDER == _LITTLE_ENDIAN
229 # define _LIBCPP_BIG_ENDIAN
230 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
231 # define _LIBCPP_HAS_QUICK_EXIT
235 # define _LIBCPP_WIN32API
236 # define _LIBCPP_LITTLE_ENDIAN
237 # define _LIBCPP_SHORT_WCHAR 1
238 // Both MinGW and native MSVC provide a "MSVC"-like enviroment
239 # define _LIBCPP_MSVCRT_LIKE
240 // If mingw not explicitly detected, assume using MS C runtime only if
241 // a MS compatibility version is specified.
242 # if defined(_MSC_VER) && !defined(__MINGW32__)
243 # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
245 # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
246 # define _LIBCPP_HAS_BITSCAN64
248 # if defined(_LIBCPP_MSVCRT)
249 # define _LIBCPP_HAS_QUICK_EXIT
252 // Some CRT APIs are unavailable to store apps
253 #if defined(WINAPI_FAMILY)
254 #include <winapifamily.h>
255 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \
256 (!defined(WINAPI_PARTITION_SYSTEM) || \
257 !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
258 #define _LIBCPP_WINDOWS_STORE_APP
261 #endif // defined(_WIN32)
264 # include <sys/isa_defs.h>
265 # ifdef _LITTLE_ENDIAN
266 # define _LIBCPP_LITTLE_ENDIAN
268 # define _LIBCPP_BIG_ENDIAN
272 #if defined(__CloudABI__)
273 // Certain architectures provide arc4random(). Prefer using
274 // arc4random() over /dev/{u,}random to make it possible to obtain
275 // random data even when using sandboxing mechanisms such as chroots,
277 # define _LIBCPP_USING_ARC4_RANDOM
278 #elif defined(__Fuchsia__)
279 # define _LIBCPP_USING_GETENTROPY
280 #elif defined(__native_client__)
281 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
282 // including accesses to the special files under /dev. C++11's
283 // std::random_device is instead exposed through a NaCl syscall.
284 # define _LIBCPP_USING_NACL_RANDOM
285 #elif defined(_LIBCPP_WIN32API)
286 # define _LIBCPP_USING_WIN32_RANDOM
288 # define _LIBCPP_USING_DEV_RANDOM
291 #if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
293 # if __BYTE_ORDER == __LITTLE_ENDIAN
294 # define _LIBCPP_LITTLE_ENDIAN
295 # elif __BYTE_ORDER == __BIG_ENDIAN
296 # define _LIBCPP_BIG_ENDIAN
297 # else // __BYTE_ORDER == __BIG_ENDIAN
298 # error unable to determine endian
300 #endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
302 #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
303 #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
305 #define _LIBCPP_NO_CFI
308 #if defined(_LIBCPP_COMPILER_CLANG)
310 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
311 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
312 #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
313 (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \
314 defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
315 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
318 #if __has_feature(cxx_alignas)
319 # define _ALIGNAS_TYPE(x) alignas(x)
320 # define _ALIGNAS(x) alignas(x)
322 # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
323 # define _ALIGNAS(x) __attribute__((__aligned__(x)))
326 #if __cplusplus < 201103L
327 typedef __char16_t char16_t;
328 typedef __char32_t char32_t;
331 #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
332 #define _LIBCPP_NO_EXCEPTIONS
335 #if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI)
336 #define _LIBCPP_NO_RTTI
339 #if !(__has_feature(cxx_strong_enums))
340 #define _LIBCPP_HAS_NO_STRONG_ENUMS
343 #if !(__has_feature(cxx_decltype))
344 #define _LIBCPP_HAS_NO_DECLTYPE
347 #if __has_feature(cxx_attributes)
348 # define _LIBCPP_NORETURN [[noreturn]]
350 # define _LIBCPP_NORETURN __attribute__ ((noreturn))
353 #if !(__has_feature(cxx_lambdas))
354 #define _LIBCPP_HAS_NO_LAMBDAS
357 #if !(__has_feature(cxx_nullptr))
358 # if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
359 # define nullptr __nullptr
361 # define _LIBCPP_HAS_NO_NULLPTR
365 #if !(__has_feature(cxx_rvalue_references))
366 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
369 #if !(__has_feature(cxx_auto_type))
370 #define _LIBCPP_HAS_NO_AUTO_TYPE
373 #if !(__has_feature(cxx_variadic_templates))
374 #define _LIBCPP_HAS_NO_VARIADICS
377 #if !(__has_feature(cxx_generalized_initializers))
378 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
381 #if __has_feature(is_base_of)
382 # define _LIBCPP_HAS_IS_BASE_OF
385 #if __has_feature(is_final)
386 # define _LIBCPP_HAS_IS_FINAL
389 // Objective-C++ features (opt-in)
390 #if __has_feature(objc_arc)
391 #define _LIBCPP_HAS_OBJC_ARC
394 #if __has_feature(objc_arc_weak)
395 #define _LIBCPP_HAS_OBJC_ARC_WEAK
398 #if !(__has_feature(cxx_constexpr))
399 #define _LIBCPP_HAS_NO_CONSTEXPR
402 #if !(__has_feature(cxx_relaxed_constexpr))
403 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
406 #if !(__has_feature(cxx_variable_templates))
407 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
410 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
411 #if defined(__FreeBSD__)
412 #define _LIBCPP_HAS_QUICK_EXIT
413 #define _LIBCPP_HAS_C11_FEATURES
414 #elif defined(__Fuchsia__)
415 #define _LIBCPP_HAS_QUICK_EXIT
416 #define _LIBCPP_HAS_C11_FEATURES
417 #elif defined(__linux__)
418 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
419 #if __GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
420 #define _LIBCPP_HAS_QUICK_EXIT
422 #if __GLIBC_PREREQ(2, 17)
423 #define _LIBCPP_HAS_C11_FEATURES
425 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
426 #define _LIBCPP_HAS_QUICK_EXIT
427 #define _LIBCPP_HAS_C11_FEATURES
432 #if !(__has_feature(cxx_noexcept))
433 #define _LIBCPP_HAS_NO_NOEXCEPT
436 #if __has_feature(underlying_type)
437 # define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
440 #if __has_feature(is_literal)
441 # define _LIBCPP_IS_LITERAL(T) __is_literal(T)
444 // Inline namespaces are available in Clang regardless of C++ dialect.
445 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
446 #define _LIBCPP_END_NAMESPACE_STD } }
447 #define _VSTD std::_LIBCPP_NAMESPACE
450 inline namespace _LIBCPP_NAMESPACE {
454 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
455 #define _LIBCPP_HAS_NO_ASAN
458 // Allow for build-time disabling of unsigned integer sanitization
459 #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
460 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
463 #if __has_builtin(__builtin_launder)
464 #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
467 #elif defined(_LIBCPP_COMPILER_GCC)
469 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
470 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
472 #define _LIBCPP_NORETURN __attribute__((noreturn))
475 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
476 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
477 #define _LIBCPP_HAS_IS_FINAL
480 #if defined(__GNUC__) && _GNUC_VER >= 403
481 # define _LIBCPP_HAS_IS_BASE_OF
485 #define _LIBCPP_NO_EXCEPTIONS
488 // constexpr was added to GCC in 4.6.
490 #define _LIBCPP_HAS_NO_CONSTEXPR
491 // Can only use constexpr in c++11 mode.
492 #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
493 #define _LIBCPP_HAS_NO_CONSTEXPR
496 // Determine if GCC supports relaxed constexpr
497 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
498 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
501 // GCC 5 will support variable templates
502 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
503 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
506 #ifndef __GXX_EXPERIMENTAL_CXX0X__
507 #define _LIBCPP_HAS_NO_DECLTYPE
508 #define _LIBCPP_HAS_NO_NULLPTR
509 #define _LIBCPP_HAS_NO_UNICODE_CHARS
510 #define _LIBCPP_HAS_NO_VARIADICS
511 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
512 #define _LIBCPP_HAS_NO_STRONG_ENUMS
513 #define _LIBCPP_HAS_NO_NOEXCEPT
515 #else // __GXX_EXPERIMENTAL_CXX0X__
518 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
523 #define _LIBCPP_HAS_NO_DECLTYPE
524 #define _LIBCPP_HAS_NO_UNICODE_CHARS
525 #define _LIBCPP_HAS_NO_VARIADICS
526 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
527 #endif // _GNUC_VER < 404
530 #define _LIBCPP_HAS_NO_NOEXCEPT
531 #define _LIBCPP_HAS_NO_NULLPTR
534 #endif // __GXX_EXPERIMENTAL_CXX0X__
536 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
537 #define _LIBCPP_END_NAMESPACE_STD } }
538 #define _VSTD std::_LIBCPP_NAMESPACE
541 inline namespace _LIBCPP_NAMESPACE {
545 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
546 #define _LIBCPP_HAS_NO_ASAN
550 #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
553 #elif defined(_LIBCPP_COMPILER_MSVC)
555 #define _LIBCPP_TOSTRING2(x) #x
556 #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
557 #define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
560 #error "MSVC versions prior to Visual Studio 2015 are not supported"
563 #define _LIBCPP_HAS_IS_BASE_OF
564 #define _LIBCPP_HAS_NO_CONSTEXPR
565 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
566 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
568 #define _LIBCPP_HAS_NO_UNICODE_CHARS
570 #define _LIBCPP_HAS_NO_NOEXCEPT
571 #define __alignof__ __alignof
572 #define _LIBCPP_NORETURN __declspec(noreturn)
573 #define _ALIGNAS(x) __declspec(align(x))
574 #define _LIBCPP_HAS_NO_VARIADICS
576 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
577 #define _LIBCPP_END_NAMESPACE_STD }
580 # define _LIBCPP_WEAK
584 #define _LIBCPP_HAS_NO_ASAN
586 #elif defined(_LIBCPP_COMPILER_IBM)
588 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
589 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
590 #define _ATTRIBUTE(x) __attribute__((x))
591 #define _LIBCPP_NORETURN __attribute__((noreturn))
593 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
594 #define _LIBCPP_HAS_NO_NOEXCEPT
595 #define _LIBCPP_HAS_NO_NULLPTR
596 #define _LIBCPP_HAS_NO_UNICODE_CHARS
597 #define _LIBCPP_HAS_IS_BASE_OF
598 #define _LIBCPP_HAS_IS_FINAL
599 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
602 #define __MULTILOCALE_API
605 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
606 #define _LIBCPP_END_NAMESPACE_STD } }
607 #define _VSTD std::_LIBCPP_NAMESPACE
610 inline namespace _LIBCPP_NAMESPACE {
614 #define _LIBCPP_HAS_NO_ASAN
616 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
618 #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
619 #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
620 # define _LIBCPP_DLL_VIS
621 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
622 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
623 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
624 #elif defined(_LIBCPP_BUILDING_LIBRARY)
625 # define _LIBCPP_DLL_VIS __declspec(dllexport)
626 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
627 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
628 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
630 # define _LIBCPP_DLL_VIS __declspec(dllimport)
631 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
632 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
633 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
636 #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
637 #define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
638 #define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
639 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
640 #define _LIBCPP_HIDDEN
641 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
642 #define _LIBCPP_TEMPLATE_VIS
643 #define _LIBCPP_ENUM_VIS
645 #if defined(_LIBCPP_COMPILER_MSVC)
646 # define _LIBCPP_INLINE_VISIBILITY __forceinline
647 # define _LIBCPP_ALWAYS_INLINE __forceinline
648 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
650 # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
651 # define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
652 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
654 #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
656 #ifndef _LIBCPP_HIDDEN
657 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
658 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
660 #define _LIBCPP_HIDDEN
664 #ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
665 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
666 // The inline should be removed once PR32114 is resolved
667 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
669 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
673 #ifndef _LIBCPP_FUNC_VIS
674 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
675 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
677 #define _LIBCPP_FUNC_VIS
681 #ifndef _LIBCPP_TYPE_VIS
682 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
683 # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
685 # define _LIBCPP_TYPE_VIS
689 #ifndef _LIBCPP_TEMPLATE_VIS
690 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
691 # if __has_attribute(__type_visibility__)
692 # define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
694 # define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
697 # define _LIBCPP_TEMPLATE_VIS
701 #ifndef _LIBCPP_EXTERN_VIS
702 # define _LIBCPP_EXTERN_VIS
705 #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
706 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
709 #ifndef _LIBCPP_EXCEPTION_ABI
710 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
711 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
713 #define _LIBCPP_EXCEPTION_ABI
717 #ifndef _LIBCPP_ENUM_VIS
718 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
719 # define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default")))
721 # define _LIBCPP_ENUM_VIS
725 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
726 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
727 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
729 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
733 #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
734 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
737 #ifndef _LIBCPP_INLINE_VISIBILITY
738 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
739 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
741 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
745 #ifndef _LIBCPP_ALWAYS_INLINE
746 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
747 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
749 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
753 #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
754 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
755 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__))
757 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__))
761 #ifndef _LIBCPP_PREFERRED_OVERLOAD
762 # if __has_attribute(__enable_if__)
763 # define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
767 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
768 # define _NOEXCEPT noexcept
769 # define _NOEXCEPT_(x) noexcept(x)
771 # define _NOEXCEPT throw()
772 # define _NOEXCEPT_(x)
775 #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
776 # if !defined(_LIBCPP_DEBUG)
777 # error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
779 # define _NOEXCEPT_DEBUG noexcept(false)
780 # define _NOEXCEPT_DEBUG_(x) noexcept(false)
782 # define _NOEXCEPT_DEBUG _NOEXCEPT
783 # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
786 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
787 typedef unsigned short char16_t;
788 typedef unsigned int char32_t;
789 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
791 #ifndef __SIZEOF_INT128__
792 #define _LIBCPP_HAS_NO_INT128
795 #ifdef _LIBCPP_CXX03_LANG
796 # if __has_extension(c_static_assert)
797 # define static_assert(__b, __m) _Static_assert(__b, __m)
800 template <bool> struct __static_assert_test;
801 template <> struct __static_assert_test<true> {};
802 template <unsigned> struct __static_assert_check {};
804 #define static_assert(__b, __m) \
805 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
806 _LIBCPP_CONCAT(__t, __LINE__)
807 # endif // __has_extension(c_static_assert)
808 #endif // _LIBCPP_CXX03_LANG
810 #ifdef _LIBCPP_HAS_NO_DECLTYPE
811 // GCC 4.6 provides __decltype in all standard modes.
812 #if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
813 # define decltype(__x) __decltype(__x)
815 # define decltype(__x) __typeof__(__x)
819 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
820 #define _LIBCPP_CONSTEXPR
822 #define _LIBCPP_CONSTEXPR constexpr
825 #ifdef _LIBCPP_CXX03_LANG
826 #define _LIBCPP_DEFAULT {}
828 #define _LIBCPP_DEFAULT = default;
831 #ifdef _LIBCPP_CXX03_LANG
832 #define _LIBCPP_EQUAL_DELETE
834 #define _LIBCPP_EQUAL_DELETE = delete
838 #define _NOALIAS __attribute__((__malloc__))
843 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
844 (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions
845 # define _LIBCPP_EXPLICIT explicit
847 # define _LIBCPP_EXPLICIT
850 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
851 # define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
854 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
855 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
856 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
858 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
859 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
860 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
862 #else // _LIBCPP_HAS_NO_STRONG_ENUMS
863 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
864 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
865 #endif // _LIBCPP_HAS_NO_STRONG_ENUMS
868 # if _LIBCPP_DEBUG == 0
869 # define _LIBCPP_DEBUG_LEVEL 1
870 # elif _LIBCPP_DEBUG == 1
871 # define _LIBCPP_DEBUG_LEVEL 2
873 # error Supported values for _LIBCPP_DEBUG are 0 and 1
875 # if !defined(_LIBCPP_BUILDING_LIBRARY)
876 # define _LIBCPP_EXTERN_TEMPLATE(...)
880 #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
881 #define _LIBCPP_EXTERN_TEMPLATE(...)
882 #define _LIBCPP_EXTERN_TEMPLATE2(...)
885 #ifndef _LIBCPP_EXTERN_TEMPLATE
886 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
889 #ifndef _LIBCPP_EXTERN_TEMPLATE2
890 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
893 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
894 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
897 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
898 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
899 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
902 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
903 // Most unix variants have catopen. These are the specific ones that don't.
904 #if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
905 #define _LIBCPP_HAS_CATOPEN 1
910 #define _DECLARE_C99_LDBL_MATH 1
913 #if defined(__APPLE__)
914 # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
915 defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
916 # define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
918 # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
919 # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
920 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
923 #endif // defined(__APPLE__)
925 #if defined(__APPLE__) || defined(__FreeBSD__)
926 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
929 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
930 #define _LIBCPP_WCTYPE_IS_MASK
933 #ifndef _LIBCPP_STD_VER
934 # if __cplusplus <= 201103L
935 # define _LIBCPP_STD_VER 11
936 # elif __cplusplus <= 201402L
937 # define _LIBCPP_STD_VER 14
938 # elif __cplusplus <= 201703L
939 # define _LIBCPP_STD_VER 17
941 # define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
943 #endif // _LIBCPP_STD_VER
945 #if _LIBCPP_STD_VER > 11
946 #define _LIBCPP_DEPRECATED [[deprecated]]
948 #define _LIBCPP_DEPRECATED
951 #if _LIBCPP_STD_VER <= 11
952 #define _LIBCPP_EXPLICIT_AFTER_CXX11
953 #define _LIBCPP_DEPRECATED_AFTER_CXX11
955 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
956 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
959 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
960 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
962 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
965 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
966 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
968 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
971 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
972 #define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
974 #define _LIBCPP_CONSTEXPR_AFTER_CXX17
977 #if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17)
978 #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
980 #define _LIBCPP_NODISCARD_AFTER_CXX17
983 // FIXME: Remove all usages of this macro once compilers catch up.
984 #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606L)
985 # define _LIBCPP_HAS_NO_INLINE_VARIABLES
988 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
989 # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
991 # define _LIBCPP_EXPLICIT_MOVE(x) (x)
994 #ifndef _LIBCPP_HAS_NO_ASAN
995 _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
996 const void *, const void *, const void *, const void *);
999 // Try to find out if RTTI is disabled.
1000 // g++ and cl.exe have RTTI on by default and define a macro when it is.
1001 // g++ only defines the macro in 4.3.2 and onwards.
1002 #if !defined(_LIBCPP_NO_RTTI)
1003 # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
1004 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
1005 # define _LIBCPP_NO_RTTI
1006 # elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
1007 # define _LIBCPP_NO_RTTI
1011 #ifndef _LIBCPP_WEAK
1012 # define _LIBCPP_WEAK __attribute__((__weak__))
1016 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
1017 !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
1018 !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
1019 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1020 # if defined(__FreeBSD__) || \
1021 defined(__Fuchsia__) || \
1022 defined(__NetBSD__) || \
1023 defined(__linux__) || \
1024 defined(__APPLE__) || \
1025 defined(__CloudABI__) || \
1026 defined(__sun__) || \
1027 (defined(__MINGW32__) && __libcpp_has_include(<pthread.h>))
1028 # define _LIBCPP_HAS_THREAD_API_PTHREAD
1029 # elif defined(_LIBCPP_WIN32API)
1030 # define _LIBCPP_HAS_THREAD_API_WIN32
1032 # error "No thread API"
1033 # endif // _LIBCPP_HAS_THREAD_API
1034 #endif // _LIBCPP_HAS_NO_THREADS
1036 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
1037 # error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
1038 _LIBCPP_HAS_NO_THREADS is not defined.
1041 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1042 # error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
1043 _LIBCPP_HAS_NO_THREADS is defined.
1046 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
1047 # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
1048 _LIBCPP_HAS_NO_THREADS is defined.
1051 // Systems that use capability-based security (FreeBSD with Capsicum,
1052 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
1053 // Functions like open(), rename(), unlink() and stat() should not be
1054 // used, as they attempt to access the global filesystem namespace.
1056 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
1059 // CloudABI is intended for running networked services. Processes do not
1060 // have standard input and output channels.
1062 #define _LIBCPP_HAS_NO_STDIN
1063 #define _LIBCPP_HAS_NO_STDOUT
1066 #if defined(__BIONIC__) || defined(__CloudABI__) || \
1067 defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1068 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
1071 // Thread-unsafe functions such as strtok() and localtime()
1072 // are not available.
1074 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
1077 #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
1078 #define _LIBCPP_HAS_C_ATOMIC_IMP
1079 #elif _GNUC_VER > 407
1080 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
1083 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
1084 || defined(_LIBCPP_HAS_NO_THREADS)
1085 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
1088 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1089 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1092 #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
1093 #if defined(__clang__) && __has_attribute(acquire_capability)
1094 // Work around the attribute handling in clang. When both __declspec and
1095 // __attribute__ are present, the processing goes awry preventing the definition
1097 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
1098 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1103 #if __has_attribute(require_constant_initialization)
1104 #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1106 #define _LIBCPP_SAFE_STATIC
1109 #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
1110 # define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1113 #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
1114 #if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
1115 #define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
1119 #if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
1120 # define _LIBCPP_DIAGNOSE_WARNING(...) \
1121 __attribute__((diagnose_if(__VA_ARGS__, "warning")))
1122 # define _LIBCPP_DIAGNOSE_ERROR(...) \
1123 __attribute__((diagnose_if(__VA_ARGS__, "error")))
1125 # define _LIBCPP_DIAGNOSE_WARNING(...)
1126 # define _LIBCPP_DIAGNOSE_ERROR(...)
1129 #if __has_attribute(fallthough) || _GNUC_VER >= 700
1130 // Use a function like macro to imply that it must be followed by a semicolon
1131 #define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
1133 #define _LIBCPP_FALLTHROUGH() ((void)0)
1136 #if defined(_LIBCPP_ABI_MICROSOFT) && \
1137 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
1138 # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
1140 # define _LIBCPP_DECLSPEC_EMPTY_BASES
1143 #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
1144 # define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
1145 # define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
1146 # define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
1147 # define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
1148 #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
1150 #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
1151 # define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1154 #if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
1155 # define _LIBCPP_HAS_NO_IS_AGGREGATE
1158 #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
1159 # define _LIBCPP_HAS_NO_COROUTINES
1162 // Decide whether to use availability macros.
1163 #if !defined(_LIBCPP_BUILDING_LIBRARY) && \
1164 !defined(_LIBCPP_DISABLE_AVAILABILITY) && \
1165 __has_feature(attribute_availability_with_strict) && \
1166 __has_feature(attribute_availability_in_templates)
1168 #define _LIBCPP_USE_AVAILABILITY_APPLE
1172 // Define availability macros.
1173 #if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
1174 #define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
1175 __attribute__((availability(macosx,strict,introduced=10.12))) \
1176 __attribute__((availability(ios,strict,introduced=10.0))) \
1177 __attribute__((availability(tvos,strict,introduced=10.0))) \
1178 __attribute__((availability(watchos,strict,introduced=3.0)))
1179 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
1180 #define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
1181 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
1182 #define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
1183 __attribute__((availability(macosx,strict,introduced=10.12))) \
1184 __attribute__((availability(ios,strict,introduced=10.0))) \
1185 __attribute__((availability(tvos,strict,introduced=10.0))) \
1186 __attribute__((availability(watchos,strict,introduced=3.0)))
1187 #define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
1188 __attribute__((availability(macosx,strict,introduced=10.12))) \
1189 __attribute__((availability(ios,strict,introduced=10.0))) \
1190 __attribute__((availability(tvos,strict,introduced=10.0))) \
1191 __attribute__((availability(watchos,strict,introduced=3.0)))
1192 #define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
1193 __attribute__((availability(ios,strict,introduced=6.0)))
1194 #define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
1195 __attribute__((availability(macosx,strict,introduced=10.9))) \
1196 __attribute__((availability(ios,strict,introduced=7.0)))
1197 #define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
1198 __attribute__((availability(macosx,strict,introduced=10.9))) \
1199 __attribute__((availability(ios,strict,introduced=7.0)))
1200 #define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
1201 __attribute__((availability(macosx,strict,introduced=10.9))) \
1202 __attribute__((availability(ios,strict,introduced=7.0)))
1204 #define _LIBCPP_AVAILABILITY_SHARED_MUTEX
1205 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1206 #define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
1207 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1208 #define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
1209 #define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
1210 #define _LIBCPP_AVAILABILITY_FUTURE_ERROR
1211 #define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
1212 #define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
1213 #define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
1216 // Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
1217 #ifdef _LIBCPP_NO_EXCEPTIONS
1218 #define _LIBCPP_AVAILABILITY_DYNARRAY
1219 #define _LIBCPP_AVAILABILITY_FUTURE
1220 #define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
1222 #define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
1223 #define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
1224 #define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \
1225 _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1228 // Availability of stream API in the dylib got dropped and re-added. The
1229 // extern template should effectively be available at:
1230 // availability(macosx,introduced=10.9)
1231 // availability(ios,introduced=7.0)
1232 #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \
1233 ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
1234 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \
1235 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
1236 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
1237 #define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
1240 #if defined(_LIBCPP_COMPILER_IBM)
1241 #define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
1244 #if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1245 # define _LIBCPP_PUSH_MACROS
1246 # define _LIBCPP_POP_MACROS
1248 // Don't warn about macro conflicts when we can restore them at the
1249 // end of the header.
1250 # ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1251 # define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1253 # if defined(_LIBCPP_COMPILER_MSVC)
1254 # define _LIBCPP_PUSH_MACROS \
1255 __pragma(push_macro("min")) \
1256 __pragma(push_macro("max"))
1257 # define _LIBCPP_POP_MACROS \
1258 __pragma(pop_macro("min")) \
1259 __pragma(pop_macro("max"))
1261 # define _LIBCPP_PUSH_MACROS \
1262 _Pragma("push_macro(\"min\")") \
1263 _Pragma("push_macro(\"max\")")
1264 # define _LIBCPP_POP_MACROS \
1265 _Pragma("pop_macro(\"min\")") \
1266 _Pragma("pop_macro(\"max\")")
1268 #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1270 #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1272 # pragma(lib, "c++.lib")
1274 # pragma(lib, "libc++.lib")
1276 #endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1278 #endif // __cplusplus
1280 #endif // _LIBCPP_CONFIG