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 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
18 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
19 #pragma GCC system_header
25 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
30 #define _LIBCPP_VERSION 3900
32 #ifndef _LIBCPP_ABI_VERSION
33 #define _LIBCPP_ABI_VERSION 1
36 #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
37 // Change short string represention so that string data starts at offset 0,
38 // improving its alignment in some cases.
39 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
40 // Fix deque iterator type in order to support incomplete types.
41 #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
42 // Fix undefined behavior in how std::list stores it's linked nodes.
43 #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
44 // Fix undefined behavior in how __tree stores its end and parent nodes.
45 #define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
46 #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
47 #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
48 #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
49 #elif _LIBCPP_ABI_VERSION == 1
50 // Feature macros for disabling pre ABI v1 features. All of these options
52 #if defined(__FreeBSD__)
53 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
57 #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
58 #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
59 use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
62 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
63 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
65 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
68 #ifndef __has_attribute
69 #define __has_attribute(__x) 0
72 #define __has_builtin(__x) 0
74 #ifndef __has_extension
75 #define __has_extension(__x) 0
78 #define __has_feature(__x) 0
80 // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
81 // the compiler and '1' otherwise.
82 #ifndef __is_identifier
83 #define __is_identifier(__x) 1
87 #ifdef __LITTLE_ENDIAN__
89 #define _LIBCPP_LITTLE_ENDIAN 1
90 #define _LIBCPP_BIG_ENDIAN 0
91 #endif // __LITTLE_ENDIAN__
92 #endif // __LITTLE_ENDIAN__
96 #define _LIBCPP_LITTLE_ENDIAN 0
97 #define _LIBCPP_BIG_ENDIAN 1
98 #endif // __BIG_ENDIAN__
99 #endif // __BIG_ENDIAN__
101 #ifdef __BYTE_ORDER__
102 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
103 #define _LIBCPP_LITTLE_ENDIAN 1
104 #define _LIBCPP_BIG_ENDIAN 0
105 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
106 #define _LIBCPP_LITTLE_ENDIAN 0
107 #define _LIBCPP_BIG_ENDIAN 1
108 #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
109 #endif // __BYTE_ORDER__
112 # include <sys/endian.h>
113 # if _BYTE_ORDER == _LITTLE_ENDIAN
114 # define _LIBCPP_LITTLE_ENDIAN 1
115 # define _LIBCPP_BIG_ENDIAN 0
116 # else // _BYTE_ORDER == _LITTLE_ENDIAN
117 # define _LIBCPP_LITTLE_ENDIAN 0
118 # define _LIBCPP_BIG_ENDIAN 1
119 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
120 # ifndef __LONG_LONG_SUPPORTED
121 # define _LIBCPP_HAS_NO_LONG_LONG
122 # endif // __LONG_LONG_SUPPORTED
123 #endif // __FreeBSD__
126 # include <sys/endian.h>
127 # if _BYTE_ORDER == _LITTLE_ENDIAN
128 # define _LIBCPP_LITTLE_ENDIAN 1
129 # define _LIBCPP_BIG_ENDIAN 0
130 # else // _BYTE_ORDER == _LITTLE_ENDIAN
131 # define _LIBCPP_LITTLE_ENDIAN 0
132 # define _LIBCPP_BIG_ENDIAN 1
133 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
134 # define _LIBCPP_HAS_QUICK_EXIT
138 # define _LIBCPP_LITTLE_ENDIAN 1
139 # define _LIBCPP_BIG_ENDIAN 0
140 // Compiler intrinsics (MSVC)
141 #if defined(_MSC_VER) && _MSC_VER >= 1400
142 # define _LIBCPP_HAS_IS_BASE_OF
144 # if defined(_MSC_VER) && !defined(__clang__)
145 # define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
146 # define _LIBCPP_TOSTRING2(x) #x
147 # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
148 # define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
150 # // If mingw not explicitly detected, assume using MS C runtime only.
152 # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
157 # include <sys/isa_defs.h>
158 # ifdef _LITTLE_ENDIAN
159 # define _LIBCPP_LITTLE_ENDIAN 1
160 # define _LIBCPP_BIG_ENDIAN 0
162 # define _LIBCPP_LITTLE_ENDIAN 0
163 # define _LIBCPP_BIG_ENDIAN 1
167 #if defined(__CloudABI__)
168 // Certain architectures provide arc4random(). Prefer using
169 // arc4random() over /dev/{u,}random to make it possible to obtain
170 // random data even when using sandboxing mechanisms such as chroots,
172 # define _LIBCPP_USING_ARC4_RANDOM
173 #elif defined(__native_client__)
174 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
175 // including accesses to the special files under /dev. C++11's
176 // std::random_device is instead exposed through a NaCl syscall.
177 # define _LIBCPP_USING_NACL_RANDOM
178 #elif defined(_WIN32)
179 # define _LIBCPP_USING_WIN32_RANDOM
181 # define _LIBCPP_USING_DEV_RANDOM
184 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
186 # if __BYTE_ORDER == __LITTLE_ENDIAN
187 # define _LIBCPP_LITTLE_ENDIAN 1
188 # define _LIBCPP_BIG_ENDIAN 0
189 # elif __BYTE_ORDER == __BIG_ENDIAN
190 # define _LIBCPP_LITTLE_ENDIAN 0
191 # define _LIBCPP_BIG_ENDIAN 1
192 # else // __BYTE_ORDER == __BIG_ENDIAN
193 # error unable to determine endian
195 #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
197 #if __has_attribute(__no_sanitize__)
198 #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
200 #define _LIBCPP_NO_CFI
205 // only really useful for a DLL
206 #ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
208 # define _LIBCPP_HIDDEN
209 # define _LIBCPP_FUNC_VIS __declspec(dllexport)
210 # define _LIBCPP_TYPE_VIS __declspec(dllexport)
212 # define _LIBCPP_HIDDEN
213 # define _LIBCPP_FUNC_VIS __declspec(dllimport)
214 # define _LIBCPP_TYPE_VIS __declspec(dllimport)
217 # define _LIBCPP_HIDDEN
218 # define _LIBCPP_FUNC_VIS
219 # define _LIBCPP_TYPE_VIS
222 #define _LIBCPP_TYPE_VIS_ONLY
223 #define _LIBCPP_FUNC_VIS_ONLY
225 #ifndef _LIBCPP_INLINE_VISIBILITY
227 # define _LIBCPP_INLINE_VISIBILITY __forceinline
228 # else // MinGW GCC and Clang
229 # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
233 #ifndef _LIBCPP_EXCEPTION_ABI
234 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
237 #ifndef _LIBCPP_ALWAYS_INLINE
239 # define _LIBCPP_ALWAYS_INLINE __forceinline
245 #ifndef _LIBCPP_HIDDEN
246 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
249 #ifndef _LIBCPP_FUNC_VIS
250 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
253 #ifndef _LIBCPP_TYPE_VIS
254 # if __has_attribute(__type_visibility__)
255 # define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
257 # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
261 #ifndef _LIBCPP_PREFERRED_OVERLOAD
262 # if __has_attribute(__enable_if__)
263 # define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
267 #ifndef _LIBCPP_TYPE_VIS_ONLY
268 # define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
271 #ifndef _LIBCPP_FUNC_VIS_ONLY
272 # define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
275 #ifndef _LIBCPP_INLINE_VISIBILITY
276 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
279 #ifndef _LIBCPP_EXCEPTION_ABI
280 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
283 #ifndef _LIBCPP_ALWAYS_INLINE
284 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
287 #if defined(__clang__)
289 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
290 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
291 #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
292 !defined(__arm__)) || \
293 defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
294 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
297 #if __has_feature(cxx_alignas)
298 # define _ALIGNAS_TYPE(x) alignas(x)
299 # define _ALIGNAS(x) alignas(x)
301 # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
302 # define _ALIGNAS(x) __attribute__((__aligned__(x)))
305 #if !__has_feature(cxx_alias_templates)
306 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
309 #if __cplusplus < 201103L
310 typedef __char16_t char16_t;
311 typedef __char32_t char32_t;
314 #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
315 #define _LIBCPP_NO_EXCEPTIONS
318 #if !(__has_feature(cxx_rtti))
319 #define _LIBCPP_NO_RTTI
322 #if !(__has_feature(cxx_strong_enums))
323 #define _LIBCPP_HAS_NO_STRONG_ENUMS
326 #if !(__has_feature(cxx_decltype))
327 #define _LIBCPP_HAS_NO_DECLTYPE
330 #if __has_feature(cxx_attributes)
331 # define _LIBCPP_NORETURN [[noreturn]]
333 # define _LIBCPP_NORETURN __attribute__ ((noreturn))
336 #if !(__has_feature(cxx_default_function_template_args))
337 #define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
340 #if !(__has_feature(cxx_defaulted_functions))
341 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
342 #endif // !(__has_feature(cxx_defaulted_functions))
344 #if !(__has_feature(cxx_deleted_functions))
345 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
346 #endif // !(__has_feature(cxx_deleted_functions))
348 #if !(__has_feature(cxx_lambdas))
349 #define _LIBCPP_HAS_NO_LAMBDAS
352 #if !(__has_feature(cxx_nullptr))
353 #define _LIBCPP_HAS_NO_NULLPTR
356 #if !(__has_feature(cxx_rvalue_references))
357 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
360 #if !(__has_feature(cxx_static_assert))
361 #define _LIBCPP_HAS_NO_STATIC_ASSERT
364 #if !(__has_feature(cxx_auto_type))
365 #define _LIBCPP_HAS_NO_AUTO_TYPE
368 #if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
369 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
372 #if !(__has_feature(cxx_variadic_templates))
373 #define _LIBCPP_HAS_NO_VARIADICS
376 #if !(__has_feature(cxx_trailing_return))
377 #define _LIBCPP_HAS_NO_TRAILING_RETURN
380 #if !(__has_feature(cxx_generalized_initializers))
381 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
384 #if __has_feature(is_base_of)
385 # define _LIBCPP_HAS_IS_BASE_OF
388 #if __has_feature(is_final)
389 # define _LIBCPP_HAS_IS_FINAL
392 // Objective-C++ features (opt-in)
393 #if __has_feature(objc_arc)
394 #define _LIBCPP_HAS_OBJC_ARC
397 #if __has_feature(objc_arc_weak)
398 #define _LIBCPP_HAS_OBJC_ARC_WEAK
399 #define _LIBCPP_HAS_NO_STRONG_ENUMS
402 #if !(__has_feature(cxx_constexpr))
403 #define _LIBCPP_HAS_NO_CONSTEXPR
406 #if !(__has_feature(cxx_relaxed_constexpr))
407 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
410 #if !(__has_feature(cxx_variable_templates))
411 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
414 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
415 #if defined(__FreeBSD__)
416 #define _LIBCPP_HAS_QUICK_EXIT
417 #define _LIBCPP_HAS_C11_FEATURES
418 #elif defined(__ANDROID__)
419 #define _LIBCPP_HAS_QUICK_EXIT
420 #elif defined(__linux__)
421 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
422 # include <features.h>
423 #if __GLIBC_PREREQ(2, 15)
424 #define _LIBCPP_HAS_QUICK_EXIT
426 #if __GLIBC_PREREQ(2, 17)
427 #define _LIBCPP_HAS_C11_FEATURES
429 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
430 #define _LIBCPP_HAS_QUICK_EXIT
431 #define _LIBCPP_HAS_C11_FEATURES
436 #if !(__has_feature(cxx_noexcept))
437 #define _LIBCPP_HAS_NO_NOEXCEPT
440 #if __has_feature(underlying_type)
441 # define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
444 #if __has_feature(is_literal)
445 # define _LIBCPP_IS_LITERAL(T) __is_literal(T)
448 // Inline namespaces are available in Clang regardless of C++ dialect.
449 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
450 #define _LIBCPP_END_NAMESPACE_STD } }
451 #define _VSTD std::_LIBCPP_NAMESPACE
454 inline namespace _LIBCPP_NAMESPACE {
458 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
459 #define _LIBCPP_HAS_NO_ASAN
462 // Allow for build-time disabling of unsigned integer sanitization
463 #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
464 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
467 #elif defined(__GNUC__)
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__
508 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
509 #define _LIBCPP_HAS_NO_DECLTYPE
510 #define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
511 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
512 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
513 #define _LIBCPP_HAS_NO_NULLPTR
514 #define _LIBCPP_HAS_NO_STATIC_ASSERT
515 #define _LIBCPP_HAS_NO_UNICODE_CHARS
516 #define _LIBCPP_HAS_NO_VARIADICS
517 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
518 #define _LIBCPP_HAS_NO_STRONG_ENUMS
519 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
520 #define _LIBCPP_HAS_NO_NOEXCEPT
522 #else // __GXX_EXPERIMENTAL_CXX0X__
525 #define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
526 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
527 #define _LIBCPP_HAS_NO_STATIC_ASSERT
532 #define _LIBCPP_HAS_NO_DECLTYPE
533 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
534 #define _LIBCPP_HAS_NO_TRAILING_RETURN
535 #define _LIBCPP_HAS_NO_UNICODE_CHARS
536 #define _LIBCPP_HAS_NO_VARIADICS
537 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
538 #endif // _GNUC_VER < 404
541 #define _LIBCPP_HAS_NO_NOEXCEPT
542 #define _LIBCPP_HAS_NO_NULLPTR
543 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
547 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
548 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
551 #endif // __GXX_EXPERIMENTAL_CXX0X__
553 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
554 #define _LIBCPP_END_NAMESPACE_STD } }
555 #define _VSTD std::_LIBCPP_NAMESPACE
558 namespace _LIBCPP_NAMESPACE {
560 using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
563 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
564 #define _LIBCPP_HAS_NO_ASAN
567 #elif defined(_LIBCPP_MSVC)
569 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
570 #define _LIBCPP_HAS_NO_CONSTEXPR
571 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
572 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
573 #define _LIBCPP_HAS_NO_UNICODE_CHARS
574 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
575 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
576 #define _LIBCPP_HAS_NO_NOEXCEPT
577 #define __alignof__ __alignof
578 #define _LIBCPP_NORETURN __declspec(noreturn)
579 #define _ALIGNAS(x) __declspec(align(x))
580 #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(__IBMCPP__)
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_DEFAULT_FUNCTION_TEMPLATE_ARGS
602 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
603 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
604 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
605 #define _LIBCPP_HAS_NO_NOEXCEPT
606 #define _LIBCPP_HAS_NO_NULLPTR
607 #define _LIBCPP_HAS_NO_UNICODE_CHARS
608 #define _LIBCPP_HAS_IS_BASE_OF
609 #define _LIBCPP_HAS_IS_FINAL
610 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
613 #define __MULTILOCALE_API
616 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
617 #define _LIBCPP_END_NAMESPACE_STD } }
618 #define _VSTD std::_LIBCPP_NAMESPACE
621 inline namespace _LIBCPP_NAMESPACE {
625 #define _LIBCPP_HAS_NO_ASAN
627 #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
629 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
630 # define _NOEXCEPT noexcept
631 # define _NOEXCEPT_(x) noexcept(x)
633 # define _NOEXCEPT throw()
634 # define _NOEXCEPT_(x)
637 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
638 typedef unsigned short char16_t;
639 typedef unsigned int char32_t;
640 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
642 #ifndef __SIZEOF_INT128__
643 #define _LIBCPP_HAS_NO_INT128
646 #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
649 template <bool> struct __static_assert_test;
650 template <> struct __static_assert_test<true> {};
651 template <unsigned> struct __static_assert_check {};
653 #define static_assert(__b, __m) \
654 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
655 _LIBCPP_CONCAT(__t, __LINE__)
657 #endif // _LIBCPP_HAS_NO_STATIC_ASSERT
659 #ifdef _LIBCPP_HAS_NO_DECLTYPE
660 // GCC 4.6 provides __decltype in all standard modes.
661 #if !__is_identifier(__decltype) || _GNUC_VER >= 406
662 # define decltype(__x) __decltype(__x)
664 # define decltype(__x) __typeof__(__x)
668 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
669 #define _LIBCPP_CONSTEXPR
671 #define _LIBCPP_CONSTEXPR constexpr
674 #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
675 #define _LIBCPP_DEFAULT {}
677 #define _LIBCPP_DEFAULT = default;
680 #ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
681 #define _LIBCPP_EQUAL_DELETE
683 #define _LIBCPP_EQUAL_DELETE = delete
687 #define _NOALIAS __attribute__((__malloc__))
692 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
693 # define _LIBCPP_EXPLICIT explicit
695 # define _LIBCPP_EXPLICIT
698 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
699 # define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
702 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
703 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
704 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
706 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
707 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
708 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
710 #else // _LIBCPP_HAS_NO_STRONG_ENUMS
711 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
712 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
713 #endif // _LIBCPP_HAS_NO_STRONG_ENUMS
716 # if _LIBCPP_DEBUG == 0
717 # define _LIBCPP_DEBUG_LEVEL 1
718 # elif _LIBCPP_DEBUG == 1
719 # define _LIBCPP_DEBUG_LEVEL 2
721 # error Supported values for _LIBCPP_DEBUG are 0 and 1
723 # define _LIBCPP_EXTERN_TEMPLATE(...)
726 #ifndef _LIBCPP_EXTERN_TEMPLATE
727 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
730 #ifndef _LIBCPP_EXTERN_TEMPLATE2
731 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
734 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
735 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
738 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
739 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
740 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
743 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
744 // Most unix variants have catopen. These are the specific ones that don't.
745 #if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
746 #define _LIBCPP_HAS_CATOPEN 1
751 #define _DECLARE_C99_LDBL_MATH 1
754 #if defined(__APPLE__) || defined(__FreeBSD__)
755 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
758 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
759 #define _LIBCPP_WCTYPE_IS_MASK
762 #ifndef _LIBCPP_STD_VER
763 # if __cplusplus <= 201103L
764 # define _LIBCPP_STD_VER 11
765 # elif __cplusplus <= 201402L
766 # define _LIBCPP_STD_VER 14
768 # define _LIBCPP_STD_VER 16 // current year, or date of c++17 ratification
770 #endif // _LIBCPP_STD_VER
772 #if _LIBCPP_STD_VER > 11
773 #define _LIBCPP_DEPRECATED [[deprecated]]
775 #define _LIBCPP_DEPRECATED
778 #if _LIBCPP_STD_VER <= 11
779 #define _LIBCPP_EXPLICIT_AFTER_CXX11
780 #define _LIBCPP_DEPRECATED_AFTER_CXX11
782 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
783 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
786 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
787 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
789 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
792 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
793 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
795 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
798 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
799 # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
801 # define _LIBCPP_EXPLICIT_MOVE(x) (x)
804 #ifndef _LIBCPP_HAS_NO_ASAN
805 extern "C" void __sanitizer_annotate_contiguous_container(
806 const void *, const void *, const void *, const void *);
809 // Try to find out if RTTI is disabled.
810 // g++ and cl.exe have RTTI on by default and define a macro when it is.
811 // g++ only defines the macro in 4.3.2 and onwards.
812 #if !defined(_LIBCPP_NO_RTTI)
813 # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
814 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
815 # define _LIBCPP_NO_RTTI
816 # elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
817 # define _LIBCPP_NO_RTTI
822 # define _LIBCPP_WEAK __attribute__((__weak__))
826 #if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
827 # if defined(__FreeBSD__) || \
828 defined(__NetBSD__) || \
829 defined(__linux__) || \
830 defined(__APPLE__) || \
831 defined(__CloudABI__) || \
833 # define _LIBCPP_HAS_THREAD_API_PTHREAD
835 # error "No thread API"
836 # endif // _LIBCPP_HAS_THREAD_API
837 #endif // _LIBCPP_HAS_NO_THREADS
839 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
840 # error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
841 _LIBCPP_HAS_NO_THREADS is not defined.
844 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
845 # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
846 _LIBCPP_HAS_NO_THREADS is defined.
849 // Systems that use capability-based security (FreeBSD with Capsicum,
850 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
851 // Functions like open(), rename(), unlink() and stat() should not be
852 // used, as they attempt to access the global filesystem namespace.
854 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
857 // CloudABI is intended for running networked services. Processes do not
858 // have standard input and output channels.
860 #define _LIBCPP_HAS_NO_STDIN
861 #define _LIBCPP_HAS_NO_STDOUT
864 #if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
865 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
868 // Thread-unsafe functions such as strtok(), mbtowc() and localtime()
869 // are not available.
871 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
874 #if __has_feature(cxx_atomic) || __has_extension(c_atomic)
875 #define _LIBCPP_HAS_C_ATOMIC_IMP
876 #elif _GNUC_VER > 407
877 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
880 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
881 || defined(_LIBCPP_HAS_NO_THREADS)
882 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
885 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
886 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
889 #if __cplusplus < 201103L
890 #define _LIBCPP_CXX03_LANG
892 #if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
893 #error Libc++ requires a feature complete C++11 compiler in C++11 or greater.
897 #if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \
898 && __has_attribute(acquire_capability))
899 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
902 #endif // __cplusplus
904 #endif // _LIBCPP_CONFIG