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 3800
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
44 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
45 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
47 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
50 #ifndef __has_attribute
51 #define __has_attribute(__x) 0
54 #define __has_builtin(__x) 0
56 #ifndef __has_extension
57 #define __has_extension(__x) 0
60 #define __has_feature(__x) 0
62 // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
63 // the compiler and '1' otherwise.
64 #ifndef __is_identifier
65 #define __is_identifier(__x) 1
69 #ifdef __LITTLE_ENDIAN__
71 #define _LIBCPP_LITTLE_ENDIAN 1
72 #define _LIBCPP_BIG_ENDIAN 0
73 #endif // __LITTLE_ENDIAN__
74 #endif // __LITTLE_ENDIAN__
78 #define _LIBCPP_LITTLE_ENDIAN 0
79 #define _LIBCPP_BIG_ENDIAN 1
80 #endif // __BIG_ENDIAN__
81 #endif // __BIG_ENDIAN__
84 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
85 #define _LIBCPP_LITTLE_ENDIAN 1
86 #define _LIBCPP_BIG_ENDIAN 0
87 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
88 #define _LIBCPP_LITTLE_ENDIAN 0
89 #define _LIBCPP_BIG_ENDIAN 1
90 #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
91 #endif // __BYTE_ORDER__
94 # include <sys/endian.h>
95 # if _BYTE_ORDER == _LITTLE_ENDIAN
96 # define _LIBCPP_LITTLE_ENDIAN 1
97 # define _LIBCPP_BIG_ENDIAN 0
98 # else // _BYTE_ORDER == _LITTLE_ENDIAN
99 # define _LIBCPP_LITTLE_ENDIAN 0
100 # define _LIBCPP_BIG_ENDIAN 1
101 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
102 # ifndef __LONG_LONG_SUPPORTED
103 # define _LIBCPP_HAS_NO_LONG_LONG
104 # endif // __LONG_LONG_SUPPORTED
105 #endif // __FreeBSD__
108 # include <sys/endian.h>
109 # if _BYTE_ORDER == _LITTLE_ENDIAN
110 # define _LIBCPP_LITTLE_ENDIAN 1
111 # define _LIBCPP_BIG_ENDIAN 0
112 # else // _BYTE_ORDER == _LITTLE_ENDIAN
113 # define _LIBCPP_LITTLE_ENDIAN 0
114 # define _LIBCPP_BIG_ENDIAN 1
115 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
116 # define _LIBCPP_HAS_QUICK_EXIT
120 # define _LIBCPP_LITTLE_ENDIAN 1
121 # define _LIBCPP_BIG_ENDIAN 0
122 // Compiler intrinsics (MSVC)
123 #if defined(_MSC_VER) && _MSC_VER >= 1400
124 # define _LIBCPP_HAS_IS_BASE_OF
126 # if defined(_MSC_VER) && !defined(__clang__)
127 # define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
128 # define _LIBCPP_TOSTRING2(x) #x
129 # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
130 # define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
132 # // If mingw not explicitly detected, assume using MS C runtime only.
134 # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
139 # include <sys/isa_defs.h>
140 # ifdef _LITTLE_ENDIAN
141 # define _LIBCPP_LITTLE_ENDIAN 1
142 # define _LIBCPP_BIG_ENDIAN 0
144 # define _LIBCPP_LITTLE_ENDIAN 0
145 # define _LIBCPP_BIG_ENDIAN 1
149 #if defined(__CloudABI__)
150 // Certain architectures provide arc4random(). Prefer using
151 // arc4random() over /dev/{u,}random to make it possible to obtain
152 // random data even when using sandboxing mechanisms such as chroots,
154 # define _LIBCPP_USING_ARC4_RANDOM
155 #elif defined(__native_client__)
156 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
157 // including accesses to the special files under /dev. C++11's
158 // std::random_device is instead exposed through a NaCl syscall.
159 # define _LIBCPP_USING_NACL_RANDOM
160 #elif defined(_WIN32)
161 # define _LIBCPP_USING_WIN32_RANDOM
163 # define _LIBCPP_USING_DEV_RANDOM
166 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
168 # if __BYTE_ORDER == __LITTLE_ENDIAN
169 # define _LIBCPP_LITTLE_ENDIAN 1
170 # define _LIBCPP_BIG_ENDIAN 0
171 # elif __BYTE_ORDER == __BIG_ENDIAN
172 # define _LIBCPP_LITTLE_ENDIAN 0
173 # define _LIBCPP_BIG_ENDIAN 1
174 # else // __BYTE_ORDER == __BIG_ENDIAN
175 # error unable to determine endian
177 #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
181 // only really useful for a DLL
182 #ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
184 # define _LIBCPP_HIDDEN
185 # define _LIBCPP_FUNC_VIS __declspec(dllexport)
186 # define _LIBCPP_TYPE_VIS __declspec(dllexport)
188 # define _LIBCPP_HIDDEN
189 # define _LIBCPP_FUNC_VIS __declspec(dllimport)
190 # define _LIBCPP_TYPE_VIS __declspec(dllimport)
193 # define _LIBCPP_HIDDEN
194 # define _LIBCPP_FUNC_VIS
195 # define _LIBCPP_TYPE_VIS
198 #define _LIBCPP_TYPE_VIS_ONLY
199 #define _LIBCPP_FUNC_VIS_ONLY
201 #ifndef _LIBCPP_INLINE_VISIBILITY
203 # define _LIBCPP_INLINE_VISIBILITY __forceinline
204 # else // MinGW GCC and Clang
205 # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
209 #ifndef _LIBCPP_EXCEPTION_ABI
210 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
213 #ifndef _LIBCPP_ALWAYS_INLINE
215 # define _LIBCPP_ALWAYS_INLINE __forceinline
221 #ifndef _LIBCPP_HIDDEN
222 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
225 #ifndef _LIBCPP_FUNC_VIS
226 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
229 #ifndef _LIBCPP_TYPE_VIS
230 # if __has_attribute(__type_visibility__)
231 # define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
233 # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
237 #ifndef _LIBCPP_TYPE_VIS_ONLY
238 # define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
241 #ifndef _LIBCPP_FUNC_VIS_ONLY
242 # define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
245 #ifndef _LIBCPP_INLINE_VISIBILITY
246 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
249 #ifndef _LIBCPP_EXCEPTION_ABI
250 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
253 #ifndef _LIBCPP_ALWAYS_INLINE
254 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
257 #if defined(__clang__)
259 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
260 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
261 #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
262 !defined(__arm__)) || \
263 defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
264 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
267 #if __has_feature(cxx_alignas)
268 # define _ALIGNAS_TYPE(x) alignas(x)
269 # define _ALIGNAS(x) alignas(x)
271 # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
272 # define _ALIGNAS(x) __attribute__((__aligned__(x)))
275 #if !__has_feature(cxx_alias_templates)
276 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
279 #if __cplusplus < 201103L
280 typedef __char16_t char16_t;
281 typedef __char32_t char32_t;
284 #if !(__has_feature(cxx_exceptions))
285 #define _LIBCPP_NO_EXCEPTIONS
288 #if !(__has_feature(cxx_rtti))
289 #define _LIBCPP_NO_RTTI
292 #if !(__has_feature(cxx_strong_enums))
293 #define _LIBCPP_HAS_NO_STRONG_ENUMS
296 #if !(__has_feature(cxx_decltype))
297 #define _LIBCPP_HAS_NO_DECLTYPE
300 #if __has_feature(cxx_attributes)
301 # define _LIBCPP_NORETURN [[noreturn]]
303 # define _LIBCPP_NORETURN __attribute__ ((noreturn))
306 #define _LIBCPP_UNUSED __attribute__((__unused__))
308 #if !(__has_feature(cxx_defaulted_functions))
309 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
310 #endif // !(__has_feature(cxx_defaulted_functions))
312 #if !(__has_feature(cxx_deleted_functions))
313 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
314 #endif // !(__has_feature(cxx_deleted_functions))
316 #if !(__has_feature(cxx_lambdas))
317 #define _LIBCPP_HAS_NO_LAMBDAS
320 #if !(__has_feature(cxx_nullptr))
321 #define _LIBCPP_HAS_NO_NULLPTR
324 #if !(__has_feature(cxx_rvalue_references))
325 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
328 #if !(__has_feature(cxx_static_assert))
329 #define _LIBCPP_HAS_NO_STATIC_ASSERT
332 #if !(__has_feature(cxx_auto_type))
333 #define _LIBCPP_HAS_NO_AUTO_TYPE
336 #if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
337 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
340 #if !(__has_feature(cxx_variadic_templates))
341 #define _LIBCPP_HAS_NO_VARIADICS
344 #if !(__has_feature(cxx_trailing_return))
345 #define _LIBCPP_HAS_NO_TRAILING_RETURN
348 #if !(__has_feature(cxx_generalized_initializers))
349 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
352 #if __has_feature(is_base_of)
353 # define _LIBCPP_HAS_IS_BASE_OF
356 #if __has_feature(is_final)
357 # define _LIBCPP_HAS_IS_FINAL
360 // Objective-C++ features (opt-in)
361 #if __has_feature(objc_arc)
362 #define _LIBCPP_HAS_OBJC_ARC
365 #if __has_feature(objc_arc_weak)
366 #define _LIBCPP_HAS_OBJC_ARC_WEAK
367 #define _LIBCPP_HAS_NO_STRONG_ENUMS
370 #if !(__has_feature(cxx_constexpr))
371 #define _LIBCPP_HAS_NO_CONSTEXPR
374 #if !(__has_feature(cxx_relaxed_constexpr))
375 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
378 #if !(__has_feature(cxx_variable_templates))
379 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
382 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
383 #if defined(__FreeBSD__)
384 #define _LIBCPP_HAS_QUICK_EXIT
385 #define _LIBCPP_HAS_C11_FEATURES
386 #elif defined(__ANDROID__)
387 #define _LIBCPP_HAS_QUICK_EXIT
388 #elif defined(__linux__)
389 #include <features.h>
390 #if __GLIBC_PREREQ(2, 15)
391 #define _LIBCPP_HAS_QUICK_EXIT
393 #if __GLIBC_PREREQ(2, 17)
394 #define _LIBCPP_HAS_C11_FEATURES
399 #if (__has_feature(cxx_noexcept))
400 # define _NOEXCEPT noexcept
401 # define _NOEXCEPT_(x) noexcept(x)
402 # define _NOEXCEPT_OR_FALSE(x) noexcept(x)
404 # define _NOEXCEPT throw()
405 # define _NOEXCEPT_(x)
406 # define _NOEXCEPT_OR_FALSE(x) false
409 #if __has_feature(underlying_type)
410 # define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
413 #if __has_feature(is_literal)
414 # define _LIBCPP_IS_LITERAL(T) __is_literal(T)
417 // Inline namespaces are available in Clang regardless of C++ dialect.
418 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
419 #define _LIBCPP_END_NAMESPACE_STD } }
420 #define _VSTD std::_LIBCPP_NAMESPACE
423 inline namespace _LIBCPP_NAMESPACE {
427 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
428 #define _LIBCPP_HAS_NO_ASAN
431 #elif defined(__GNUC__)
433 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
434 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
436 #define _LIBCPP_NORETURN __attribute__((noreturn))
438 #define _LIBCPP_UNUSED __attribute__((__unused__))
441 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
442 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
443 #define _LIBCPP_HAS_IS_FINAL
446 #if defined(__GNUC__) && _GNUC_VER >= 403
447 # define _LIBCPP_HAS_IS_BASE_OF
451 #define _LIBCPP_NO_EXCEPTIONS
454 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
456 // constexpr was added to GCC in 4.6.
458 #define _LIBCPP_HAS_NO_CONSTEXPR
459 // Can only use constexpr in c++11 mode.
460 #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
461 #define _LIBCPP_HAS_NO_CONSTEXPR
464 // Determine if GCC supports relaxed constexpr
465 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
466 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
469 // GCC 5 will support variable templates
470 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
472 #define _NOEXCEPT throw()
473 #define _NOEXCEPT_(x)
474 #define _NOEXCEPT_OR_FALSE(x) false
476 #ifndef __GXX_EXPERIMENTAL_CXX0X__
478 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
479 #define _LIBCPP_HAS_NO_DECLTYPE
480 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
481 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
482 #define _LIBCPP_HAS_NO_NULLPTR
483 #define _LIBCPP_HAS_NO_STATIC_ASSERT
484 #define _LIBCPP_HAS_NO_UNICODE_CHARS
485 #define _LIBCPP_HAS_NO_VARIADICS
486 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
487 #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
488 #define _LIBCPP_HAS_NO_STRONG_ENUMS
490 #else // __GXX_EXPERIMENTAL_CXX0X__
492 #define _LIBCPP_HAS_NO_TRAILING_RETURN
493 #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
496 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
500 #define _LIBCPP_HAS_NO_STATIC_ASSERT
504 #define _LIBCPP_HAS_NO_DECLTYPE
505 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
506 #define _LIBCPP_HAS_NO_UNICODE_CHARS
507 #define _LIBCPP_HAS_NO_VARIADICS
508 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
509 #endif // _GNUC_VER < 404
512 #define _LIBCPP_HAS_NO_NULLPTR
516 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
517 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
520 #endif // __GXX_EXPERIMENTAL_CXX0X__
522 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
523 #define _LIBCPP_END_NAMESPACE_STD } }
524 #define _VSTD std::_LIBCPP_NAMESPACE
527 namespace _LIBCPP_NAMESPACE {
529 using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
532 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
533 #define _LIBCPP_HAS_NO_ASAN
536 #elif defined(_LIBCPP_MSVC)
538 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
539 #define _LIBCPP_HAS_NO_CONSTEXPR
540 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
541 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
542 #define _LIBCPP_HAS_NO_UNICODE_CHARS
543 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
544 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
545 #define __alignof__ __alignof
546 #define _LIBCPP_NORETURN __declspec(noreturn)
547 #define _LIBCPP_UNUSED
548 #define _ALIGNAS(x) __declspec(align(x))
549 #define _LIBCPP_HAS_NO_VARIADICS
551 #define _NOEXCEPT throw ()
552 #define _NOEXCEPT_(x)
553 #define _NOEXCEPT_OR_FALSE(x) false
555 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
556 #define _LIBCPP_END_NAMESPACE_STD }
559 # define _LIBCPP_WEAK
563 #define _LIBCPP_HAS_NO_ASAN
565 #elif defined(__IBMCPP__)
567 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
568 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
569 #define _ATTRIBUTE(x) __attribute__((x))
570 #define _LIBCPP_NORETURN __attribute__((noreturn))
571 #define _LIBCPP_UNUSED
573 #define _NOEXCEPT throw()
574 #define _NOEXCEPT_(x)
575 #define _NOEXCEPT_OR_FALSE(x) false
577 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
578 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
579 #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
580 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
581 #define _LIBCPP_HAS_NO_NULLPTR
582 #define _LIBCPP_HAS_NO_UNICODE_CHARS
583 #define _LIBCPP_HAS_IS_BASE_OF
584 #define _LIBCPP_HAS_IS_FINAL
585 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
588 #define __MULTILOCALE_API
591 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
592 #define _LIBCPP_END_NAMESPACE_STD } }
593 #define _VSTD std::_LIBCPP_NAMESPACE
596 inline namespace _LIBCPP_NAMESPACE {
600 #define _LIBCPP_HAS_NO_ASAN
602 #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
604 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
605 typedef unsigned short char16_t;
606 typedef unsigned int char32_t;
607 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
609 #ifndef __SIZEOF_INT128__
610 #define _LIBCPP_HAS_NO_INT128
613 #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
616 template <bool> struct __static_assert_test;
617 template <> struct __static_assert_test<true> {};
618 template <unsigned> struct __static_assert_check {};
620 #define static_assert(__b, __m) \
621 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
622 _LIBCPP_CONCAT(__t, __LINE__)
624 #endif // _LIBCPP_HAS_NO_STATIC_ASSERT
626 #ifdef _LIBCPP_HAS_NO_DECLTYPE
627 // GCC 4.6 provides __decltype in all standard modes.
628 #if !__is_identifier(__decltype) || _GNUC_VER >= 406
629 # define decltype(__x) __decltype(__x)
631 # define decltype(__x) __typeof__(__x)
635 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
636 #define _LIBCPP_CONSTEXPR
638 #define _LIBCPP_CONSTEXPR constexpr
641 #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
642 #define _LIBCPP_DEFAULT {}
644 #define _LIBCPP_DEFAULT = default;
648 #define _NOALIAS __attribute__((__malloc__))
653 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
654 # define _LIBCPP_EXPLICIT explicit
656 # define _LIBCPP_EXPLICIT
659 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
660 # define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
663 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
664 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
665 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
667 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
668 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
669 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
671 #else // _LIBCPP_HAS_NO_STRONG_ENUMS
672 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
673 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
674 #endif // _LIBCPP_HAS_NO_STRONG_ENUMS
677 # if _LIBCPP_DEBUG == 0
678 # define _LIBCPP_DEBUG_LEVEL 1
679 # elif _LIBCPP_DEBUG == 1
680 # define _LIBCPP_DEBUG_LEVEL 2
682 # error Supported values for _LIBCPP_DEBUG are 0 and 1
684 # define _LIBCPP_EXTERN_TEMPLATE(...)
687 #ifndef _LIBCPP_EXTERN_TEMPLATE
688 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
691 #ifndef _LIBCPP_EXTERN_TEMPLATE2
692 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
695 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
696 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
699 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
700 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
701 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
704 #if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \
705 !defined(__CloudABI__)
706 #define _LIBCPP_HAS_CATOPEN 1
710 #define _DECLARE_C99_LDBL_MATH 1
713 #if defined(__APPLE__) || defined(__FreeBSD__)
714 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
717 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
718 #define _LIBCPP_WCTYPE_IS_MASK
721 #ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
722 # define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
725 #ifndef _LIBCPP_STD_VER
726 # if __cplusplus <= 201103L
727 # define _LIBCPP_STD_VER 11
728 # elif __cplusplus <= 201402L
729 # define _LIBCPP_STD_VER 14
731 # define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification
733 #endif // _LIBCPP_STD_VER
735 #if _LIBCPP_STD_VER > 11
736 #define _LIBCPP_DEPRECATED [[deprecated]]
738 #define _LIBCPP_DEPRECATED
741 #if _LIBCPP_STD_VER <= 11
742 #define _LIBCPP_EXPLICIT_AFTER_CXX11
743 #define _LIBCPP_DEPRECATED_AFTER_CXX11
745 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
746 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
749 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
750 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
752 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
755 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
756 # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
758 # define _LIBCPP_EXPLICIT_MOVE(x) (x)
761 #ifndef _LIBCPP_HAS_NO_ASAN
762 extern "C" void __sanitizer_annotate_contiguous_container(
763 const void *, const void *, const void *, const void *);
766 // Try to find out if RTTI is disabled.
767 // g++ and cl.exe have RTTI on by default and define a macro when it is.
768 // g++ only defines the macro in 4.3.2 and onwards.
769 #if !defined(_LIBCPP_NO_RTTI)
770 # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
771 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
772 # define _LIBCPP_NO_RTTI
773 # elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
774 # define _LIBCPP_NO_RTTI
779 # define _LIBCPP_WEAK __attribute__((__weak__))
782 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
783 # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
784 _LIBCPP_HAS_NO_THREADS is defined.
787 // Systems that use capability-based security (FreeBSD with Capsicum,
788 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
789 // Functions like open(), rename(), unlink() and stat() should not be
790 // used, as they attempt to access the global filesystem namespace.
792 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
795 // CloudABI is intended for running networked services. Processes do not
796 // have standard input and output channels.
798 #define _LIBCPP_HAS_NO_STDIN
799 #define _LIBCPP_HAS_NO_STDOUT
802 #if defined(__ANDROID__) || defined(__CloudABI__)
803 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
806 // Thread-unsafe functions such as strtok(), mbtowc() and localtime()
807 // are not available.
809 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
812 #if __has_feature(cxx_atomic) || __has_extension(c_atomic)
813 #define _LIBCPP_HAS_C_ATOMIC_IMP
814 #elif _GNUC_VER > 407
815 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
818 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
819 || defined(_LIBCPP_HAS_NO_THREADS)
820 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
823 #endif // __cplusplus
825 #endif // _LIBCPP_CONFIG