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 #if !__is_identifier(__has_unique_object_representations)
468 #define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
471 #elif defined(_LIBCPP_COMPILER_GCC)
473 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
474 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
476 #define _LIBCPP_NORETURN __attribute__((noreturn))
479 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
480 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
481 #define _LIBCPP_HAS_IS_FINAL
484 #if defined(__GNUC__) && _GNUC_VER >= 403
485 # define _LIBCPP_HAS_IS_BASE_OF
489 #define _LIBCPP_NO_EXCEPTIONS
492 // constexpr was added to GCC in 4.6.
494 #define _LIBCPP_HAS_NO_CONSTEXPR
495 // Can only use constexpr in c++11 mode.
496 #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
497 #define _LIBCPP_HAS_NO_CONSTEXPR
500 // Determine if GCC supports relaxed constexpr
501 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
502 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
505 // GCC 5 will support variable templates
506 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
507 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
510 #ifndef __GXX_EXPERIMENTAL_CXX0X__
511 #define _LIBCPP_HAS_NO_DECLTYPE
512 #define _LIBCPP_HAS_NO_NULLPTR
513 #define _LIBCPP_HAS_NO_UNICODE_CHARS
514 #define _LIBCPP_HAS_NO_VARIADICS
515 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
516 #define _LIBCPP_HAS_NO_STRONG_ENUMS
517 #define _LIBCPP_HAS_NO_NOEXCEPT
519 #else // __GXX_EXPERIMENTAL_CXX0X__
522 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
527 #define _LIBCPP_HAS_NO_DECLTYPE
528 #define _LIBCPP_HAS_NO_UNICODE_CHARS
529 #define _LIBCPP_HAS_NO_VARIADICS
530 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
531 #endif // _GNUC_VER < 404
534 #define _LIBCPP_HAS_NO_NOEXCEPT
535 #define _LIBCPP_HAS_NO_NULLPTR
538 #endif // __GXX_EXPERIMENTAL_CXX0X__
540 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
541 #define _LIBCPP_END_NAMESPACE_STD } }
542 #define _VSTD std::_LIBCPP_NAMESPACE
545 inline namespace _LIBCPP_NAMESPACE {
549 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
550 #define _LIBCPP_HAS_NO_ASAN
554 #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
558 #define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
561 #elif defined(_LIBCPP_COMPILER_MSVC)
563 #define _LIBCPP_TOSTRING2(x) #x
564 #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
565 #define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
568 #error "MSVC versions prior to Visual Studio 2015 are not supported"
571 #define _LIBCPP_HAS_IS_BASE_OF
572 #define _LIBCPP_HAS_NO_CONSTEXPR
573 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
574 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
576 #define _LIBCPP_HAS_NO_UNICODE_CHARS
578 #define _LIBCPP_HAS_NO_NOEXCEPT
579 #define __alignof__ __alignof
580 #define _LIBCPP_NORETURN __declspec(noreturn)
581 #define _ALIGNAS(x) __declspec(align(x))
582 #define _LIBCPP_HAS_NO_VARIADICS
584 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
585 #define _LIBCPP_END_NAMESPACE_STD }
588 # define _LIBCPP_WEAK
592 #define _LIBCPP_HAS_NO_ASAN
594 #elif defined(_LIBCPP_COMPILER_IBM)
596 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
597 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
598 #define _ATTRIBUTE(x) __attribute__((x))
599 #define _LIBCPP_NORETURN __attribute__((noreturn))
601 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
602 #define _LIBCPP_HAS_NO_NOEXCEPT
603 #define _LIBCPP_HAS_NO_NULLPTR
604 #define _LIBCPP_HAS_NO_UNICODE_CHARS
605 #define _LIBCPP_HAS_IS_BASE_OF
606 #define _LIBCPP_HAS_IS_FINAL
607 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
610 #define __MULTILOCALE_API
613 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
614 #define _LIBCPP_END_NAMESPACE_STD } }
615 #define _VSTD std::_LIBCPP_NAMESPACE
618 inline namespace _LIBCPP_NAMESPACE {
622 #define _LIBCPP_HAS_NO_ASAN
624 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
626 #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
627 #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
628 # define _LIBCPP_DLL_VIS
629 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
630 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
631 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
632 #elif defined(_LIBCPP_BUILDING_LIBRARY)
633 # define _LIBCPP_DLL_VIS __declspec(dllexport)
634 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
635 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
636 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
638 # define _LIBCPP_DLL_VIS __declspec(dllimport)
639 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
640 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
641 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
644 #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
645 #define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
646 #define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
647 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
648 #define _LIBCPP_HIDDEN
649 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
650 #define _LIBCPP_TEMPLATE_VIS
651 #define _LIBCPP_ENUM_VIS
653 #if defined(_LIBCPP_COMPILER_MSVC)
654 # define _LIBCPP_INLINE_VISIBILITY __forceinline
655 # define _LIBCPP_ALWAYS_INLINE __forceinline
656 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
658 # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
659 # define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
660 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
662 #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
664 #ifndef _LIBCPP_HIDDEN
665 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
666 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
668 #define _LIBCPP_HIDDEN
672 #ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
673 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
674 // The inline should be removed once PR32114 is resolved
675 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
677 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
681 #ifndef _LIBCPP_FUNC_VIS
682 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
683 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
685 #define _LIBCPP_FUNC_VIS
689 #ifndef _LIBCPP_TYPE_VIS
690 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
691 # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
693 # define _LIBCPP_TYPE_VIS
697 #ifndef _LIBCPP_TEMPLATE_VIS
698 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
699 # if __has_attribute(__type_visibility__)
700 # define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
702 # define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
705 # define _LIBCPP_TEMPLATE_VIS
709 #ifndef _LIBCPP_EXTERN_VIS
710 # define _LIBCPP_EXTERN_VIS
713 #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
714 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
717 #ifndef _LIBCPP_EXCEPTION_ABI
718 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
719 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
721 #define _LIBCPP_EXCEPTION_ABI
725 #ifndef _LIBCPP_ENUM_VIS
726 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
727 # define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default")))
729 # define _LIBCPP_ENUM_VIS
733 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
734 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
735 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
737 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
741 #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
742 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
745 #ifndef _LIBCPP_INLINE_VISIBILITY
746 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
747 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
749 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
753 #ifndef _LIBCPP_ALWAYS_INLINE
754 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
755 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
757 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
761 #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
762 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
763 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__))
765 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__))
769 #ifndef _LIBCPP_PREFERRED_OVERLOAD
770 # if __has_attribute(__enable_if__)
771 # define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
775 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
776 # define _NOEXCEPT noexcept
777 # define _NOEXCEPT_(x) noexcept(x)
779 # define _NOEXCEPT throw()
780 # define _NOEXCEPT_(x)
783 #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
784 # if !defined(_LIBCPP_DEBUG)
785 # error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
787 # define _NOEXCEPT_DEBUG noexcept(false)
788 # define _NOEXCEPT_DEBUG_(x) noexcept(false)
790 # define _NOEXCEPT_DEBUG _NOEXCEPT
791 # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
794 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
795 typedef unsigned short char16_t;
796 typedef unsigned int char32_t;
797 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
799 #ifndef __SIZEOF_INT128__
800 #define _LIBCPP_HAS_NO_INT128
803 #ifdef _LIBCPP_CXX03_LANG
804 # if __has_extension(c_static_assert)
805 # define static_assert(__b, __m) _Static_assert(__b, __m)
808 template <bool> struct __static_assert_test;
809 template <> struct __static_assert_test<true> {};
810 template <unsigned> struct __static_assert_check {};
812 #define static_assert(__b, __m) \
813 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
814 _LIBCPP_CONCAT(__t, __LINE__)
815 # endif // __has_extension(c_static_assert)
816 #endif // _LIBCPP_CXX03_LANG
818 #ifdef _LIBCPP_HAS_NO_DECLTYPE
819 // GCC 4.6 provides __decltype in all standard modes.
820 #if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
821 # define decltype(__x) __decltype(__x)
823 # define decltype(__x) __typeof__(__x)
827 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
828 #define _LIBCPP_CONSTEXPR
830 #define _LIBCPP_CONSTEXPR constexpr
833 #ifdef _LIBCPP_CXX03_LANG
834 #define _LIBCPP_DEFAULT {}
836 #define _LIBCPP_DEFAULT = default;
839 #ifdef _LIBCPP_CXX03_LANG
840 #define _LIBCPP_EQUAL_DELETE
842 #define _LIBCPP_EQUAL_DELETE = delete
846 #define _NOALIAS __attribute__((__malloc__))
851 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
852 (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions
853 # define _LIBCPP_EXPLICIT explicit
855 # define _LIBCPP_EXPLICIT
858 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
859 # define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
862 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
863 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
864 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
866 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
867 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
868 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
870 #else // _LIBCPP_HAS_NO_STRONG_ENUMS
871 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
872 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
873 #endif // _LIBCPP_HAS_NO_STRONG_ENUMS
876 # if _LIBCPP_DEBUG == 0
877 # define _LIBCPP_DEBUG_LEVEL 1
878 # elif _LIBCPP_DEBUG == 1
879 # define _LIBCPP_DEBUG_LEVEL 2
881 # error Supported values for _LIBCPP_DEBUG are 0 and 1
883 # if !defined(_LIBCPP_BUILDING_LIBRARY)
884 # define _LIBCPP_EXTERN_TEMPLATE(...)
888 #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
889 #define _LIBCPP_EXTERN_TEMPLATE(...)
890 #define _LIBCPP_EXTERN_TEMPLATE2(...)
893 #ifndef _LIBCPP_EXTERN_TEMPLATE
894 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
897 #ifndef _LIBCPP_EXTERN_TEMPLATE2
898 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
901 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
902 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
905 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
906 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
907 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
910 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
911 // Most unix variants have catopen. These are the specific ones that don't.
912 #if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
913 #define _LIBCPP_HAS_CATOPEN 1
918 #define _DECLARE_C99_LDBL_MATH 1
921 #if defined(__APPLE__)
922 # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
923 defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
924 # define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
926 # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
927 # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
928 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
931 #endif // defined(__APPLE__)
933 #if defined(__APPLE__) || defined(__FreeBSD__)
934 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
937 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
938 #define _LIBCPP_WCTYPE_IS_MASK
941 #ifndef _LIBCPP_STD_VER
942 # if __cplusplus <= 201103L
943 # define _LIBCPP_STD_VER 11
944 # elif __cplusplus <= 201402L
945 # define _LIBCPP_STD_VER 14
946 # elif __cplusplus <= 201703L
947 # define _LIBCPP_STD_VER 17
949 # define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
951 #endif // _LIBCPP_STD_VER
953 #if _LIBCPP_STD_VER > 11
954 #define _LIBCPP_DEPRECATED [[deprecated]]
956 #define _LIBCPP_DEPRECATED
959 #if _LIBCPP_STD_VER <= 11
960 #define _LIBCPP_EXPLICIT_AFTER_CXX11
961 #define _LIBCPP_DEPRECATED_AFTER_CXX11
963 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
964 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
967 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
968 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
970 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
973 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
974 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
976 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
979 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
980 #define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
982 #define _LIBCPP_CONSTEXPR_AFTER_CXX17
985 #if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17)
986 #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
988 #define _LIBCPP_NODISCARD_AFTER_CXX17
991 #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
992 # define _LIBCPP_INLINE_VAR inline
994 # define _LIBCPP_INLINE_VAR
997 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
998 # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
1000 # define _LIBCPP_EXPLICIT_MOVE(x) (x)
1003 #ifndef _LIBCPP_HAS_NO_ASAN
1004 _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1005 const void *, const void *, const void *, const void *);
1008 // Try to find out if RTTI is disabled.
1009 // g++ and cl.exe have RTTI on by default and define a macro when it is.
1010 // g++ only defines the macro in 4.3.2 and onwards.
1011 #if !defined(_LIBCPP_NO_RTTI)
1012 # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
1013 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
1014 # define _LIBCPP_NO_RTTI
1015 # elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
1016 # define _LIBCPP_NO_RTTI
1020 #ifndef _LIBCPP_WEAK
1021 # define _LIBCPP_WEAK __attribute__((__weak__))
1025 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
1026 !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
1027 !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
1028 !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1029 # if defined(__FreeBSD__) || \
1030 defined(__Fuchsia__) || \
1031 defined(__NetBSD__) || \
1032 defined(__linux__) || \
1033 defined(__APPLE__) || \
1034 defined(__CloudABI__) || \
1035 defined(__sun__) || \
1036 (defined(__MINGW32__) && __libcpp_has_include(<pthread.h>))
1037 # define _LIBCPP_HAS_THREAD_API_PTHREAD
1038 # elif defined(_LIBCPP_WIN32API)
1039 # define _LIBCPP_HAS_THREAD_API_WIN32
1041 # error "No thread API"
1042 # endif // _LIBCPP_HAS_THREAD_API
1043 #endif // _LIBCPP_HAS_NO_THREADS
1045 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
1046 # error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
1047 _LIBCPP_HAS_NO_THREADS is not defined.
1050 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1051 # error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
1052 _LIBCPP_HAS_NO_THREADS is defined.
1055 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
1056 # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
1057 _LIBCPP_HAS_NO_THREADS is defined.
1060 // Systems that use capability-based security (FreeBSD with Capsicum,
1061 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
1062 // Functions like open(), rename(), unlink() and stat() should not be
1063 // used, as they attempt to access the global filesystem namespace.
1065 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
1068 // CloudABI is intended for running networked services. Processes do not
1069 // have standard input and output channels.
1071 #define _LIBCPP_HAS_NO_STDIN
1072 #define _LIBCPP_HAS_NO_STDOUT
1075 #if defined(__BIONIC__) || defined(__CloudABI__) || \
1076 defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1077 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
1080 // Thread-unsafe functions such as strtok() and localtime()
1081 // are not available.
1083 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
1086 #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
1087 #define _LIBCPP_HAS_C_ATOMIC_IMP
1088 #elif _GNUC_VER > 407
1089 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
1092 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
1093 || defined(_LIBCPP_HAS_NO_THREADS)
1094 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
1097 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1098 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1101 #if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
1102 #if defined(__clang__) && __has_attribute(acquire_capability)
1103 // Work around the attribute handling in clang. When both __declspec and
1104 // __attribute__ are present, the processing goes awry preventing the definition
1106 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
1107 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1112 #if __has_attribute(require_constant_initialization)
1113 #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1115 #define _LIBCPP_SAFE_STATIC
1118 #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
1119 # define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1122 #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
1123 #if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
1124 #define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
1128 #if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
1129 # define _LIBCPP_DIAGNOSE_WARNING(...) \
1130 __attribute__((diagnose_if(__VA_ARGS__, "warning")))
1131 # define _LIBCPP_DIAGNOSE_ERROR(...) \
1132 __attribute__((diagnose_if(__VA_ARGS__, "error")))
1134 # define _LIBCPP_DIAGNOSE_WARNING(...)
1135 # define _LIBCPP_DIAGNOSE_ERROR(...)
1138 #if __has_attribute(fallthough) || _GNUC_VER >= 700
1139 // Use a function like macro to imply that it must be followed by a semicolon
1140 #define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
1142 #define _LIBCPP_FALLTHROUGH() ((void)0)
1145 #if defined(_LIBCPP_ABI_MICROSOFT) && \
1146 (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
1147 # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
1149 # define _LIBCPP_DECLSPEC_EMPTY_BASES
1152 #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
1153 # define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
1154 # define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
1155 # define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
1156 # define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
1157 #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
1159 #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
1160 # define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1163 #if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
1164 # define _LIBCPP_HAS_NO_IS_AGGREGATE
1167 #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
1168 # define _LIBCPP_HAS_NO_COROUTINES
1171 // Decide whether to use availability macros.
1172 #if !defined(_LIBCPP_BUILDING_LIBRARY) && \
1173 !defined(_LIBCPP_DISABLE_AVAILABILITY) && \
1174 __has_feature(attribute_availability_with_strict) && \
1175 __has_feature(attribute_availability_in_templates)
1177 #define _LIBCPP_USE_AVAILABILITY_APPLE
1181 // Define availability macros.
1182 #if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
1183 #define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
1184 __attribute__((availability(macosx,strict,introduced=10.12))) \
1185 __attribute__((availability(ios,strict,introduced=10.0))) \
1186 __attribute__((availability(tvos,strict,introduced=10.0))) \
1187 __attribute__((availability(watchos,strict,introduced=3.0)))
1188 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
1189 #define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
1190 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
1191 #define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
1192 __attribute__((availability(macosx,strict,introduced=10.12))) \
1193 __attribute__((availability(ios,strict,introduced=10.0))) \
1194 __attribute__((availability(tvos,strict,introduced=10.0))) \
1195 __attribute__((availability(watchos,strict,introduced=3.0)))
1196 #define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
1197 __attribute__((availability(macosx,strict,introduced=10.12))) \
1198 __attribute__((availability(ios,strict,introduced=10.0))) \
1199 __attribute__((availability(tvos,strict,introduced=10.0))) \
1200 __attribute__((availability(watchos,strict,introduced=3.0)))
1201 #define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
1202 __attribute__((availability(ios,strict,introduced=6.0)))
1203 #define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
1204 __attribute__((availability(macosx,strict,introduced=10.9))) \
1205 __attribute__((availability(ios,strict,introduced=7.0)))
1206 #define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
1207 __attribute__((availability(macosx,strict,introduced=10.9))) \
1208 __attribute__((availability(ios,strict,introduced=7.0)))
1209 #define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
1210 __attribute__((availability(macosx,strict,introduced=10.9))) \
1211 __attribute__((availability(ios,strict,introduced=7.0)))
1213 #define _LIBCPP_AVAILABILITY_SHARED_MUTEX
1214 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1215 #define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
1216 #define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1217 #define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
1218 #define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
1219 #define _LIBCPP_AVAILABILITY_FUTURE_ERROR
1220 #define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
1221 #define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
1222 #define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
1225 // Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
1226 #ifdef _LIBCPP_NO_EXCEPTIONS
1227 #define _LIBCPP_AVAILABILITY_DYNARRAY
1228 #define _LIBCPP_AVAILABILITY_FUTURE
1229 #define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
1231 #define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
1232 #define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
1233 #define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \
1234 _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1237 // Availability of stream API in the dylib got dropped and re-added. The
1238 // extern template should effectively be available at:
1239 // availability(macosx,introduced=10.9)
1240 // availability(ios,introduced=7.0)
1241 #if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \
1242 ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
1243 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \
1244 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
1245 __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
1246 #define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
1249 #if defined(_LIBCPP_COMPILER_IBM)
1250 #define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
1253 #if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1254 # define _LIBCPP_PUSH_MACROS
1255 # define _LIBCPP_POP_MACROS
1257 // Don't warn about macro conflicts when we can restore them at the
1258 // end of the header.
1259 # ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1260 # define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1262 # if defined(_LIBCPP_COMPILER_MSVC)
1263 # define _LIBCPP_PUSH_MACROS \
1264 __pragma(push_macro("min")) \
1265 __pragma(push_macro("max"))
1266 # define _LIBCPP_POP_MACROS \
1267 __pragma(pop_macro("min")) \
1268 __pragma(pop_macro("max"))
1270 # define _LIBCPP_PUSH_MACROS \
1271 _Pragma("push_macro(\"min\")") \
1272 _Pragma("push_macro(\"max\")")
1273 # define _LIBCPP_POP_MACROS \
1274 _Pragma("pop_macro(\"min\")") \
1275 _Pragma("pop_macro(\"max\")")
1277 #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1279 #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1281 # pragma(lib, "c++.lib")
1283 # pragma(lib, "libc++.lib")
1285 #endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1287 #endif // __cplusplus
1289 #endif // _LIBCPP_CONFIG