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 4000
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 representation 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 // Fix undefined behavior in how __hash_table stores it's pointer types
47 #define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
48 #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
49 #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
50 #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
51 // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
52 // provided under the alternate keyword __nullptr, which changes the mangling
53 // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
54 #define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
55 // Define the `pointer_safety` enum as a C++11 strongly typed enumeration
56 // instead of as a class simulating an enum. If this option is enabled
57 // `pointer_safety` and `get_pointer_safety()` will no longer be available
59 #define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
60 #elif _LIBCPP_ABI_VERSION == 1
62 // Enable compiling a definition of error_category() into the libc++ dylib.
63 #define _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR
65 // Feature macros for disabling pre ABI v1 features. All of these options
67 #if defined(__FreeBSD__)
68 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
72 #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
73 #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
74 use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
77 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
78 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
80 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
82 #if __cplusplus < 201103L
83 #define _LIBCPP_CXX03_LANG
86 #ifndef __has_attribute
87 #define __has_attribute(__x) 0
90 #define __has_builtin(__x) 0
92 #ifndef __has_extension
93 #define __has_extension(__x) 0
96 #define __has_feature(__x) 0
98 // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
99 // the compiler and '1' otherwise.
100 #ifndef __is_identifier
101 #define __is_identifier(__x) 1
104 #if defined(__clang__)
105 #define _LIBCPP_COMPILER_CLANG
106 # ifndef __apple_build_version__
107 # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
109 #elif defined(__GNUC__)
110 #define _LIBCPP_COMPILER_GCC
111 #elif defined(_MSC_VER)
112 #define _LIBCPP_COMPILER_MSVC
113 #elif defined(__IBMCPP__)
114 #define _LIBCPP_COMPILER_IBM
117 #ifndef _LIBCPP_CLANG_VER
118 # define _LIBCPP_CLANG_VER 0
121 // FIXME: ABI detection should be done via compiler builtin macros. This
122 // is just a placeholder until Clang implements such macros. For now assume
123 // that Windows compilers pretending to be MSVC++ target the microsoft ABI.
124 #if defined(_WIN32) && defined(_MSC_VER)
125 # define _LIBCPP_ABI_MICROSOFT
127 # define _LIBCPP_ABI_ITANIUM
130 // Need to detect which libc we're using if we're on Linux.
131 #if defined(__linux__)
132 #include <features.h>
133 #if !defined(__GLIBC_PREREQ)
134 #define __GLIBC_PREREQ(a, b) 0
135 #endif // !defined(__GLIBC_PREREQ)
136 #endif // defined(__linux__)
138 #ifdef __LITTLE_ENDIAN__
139 #if __LITTLE_ENDIAN__
140 #define _LIBCPP_LITTLE_ENDIAN 1
141 #define _LIBCPP_BIG_ENDIAN 0
142 #endif // __LITTLE_ENDIAN__
143 #endif // __LITTLE_ENDIAN__
145 #ifdef __BIG_ENDIAN__
147 #define _LIBCPP_LITTLE_ENDIAN 0
148 #define _LIBCPP_BIG_ENDIAN 1
149 #endif // __BIG_ENDIAN__
150 #endif // __BIG_ENDIAN__
152 #ifdef __BYTE_ORDER__
153 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
154 #define _LIBCPP_LITTLE_ENDIAN 1
155 #define _LIBCPP_BIG_ENDIAN 0
156 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
157 #define _LIBCPP_LITTLE_ENDIAN 0
158 #define _LIBCPP_BIG_ENDIAN 1
159 #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
160 #endif // __BYTE_ORDER__
163 # include <sys/endian.h>
164 # if _BYTE_ORDER == _LITTLE_ENDIAN
165 # define _LIBCPP_LITTLE_ENDIAN 1
166 # define _LIBCPP_BIG_ENDIAN 0
167 # else // _BYTE_ORDER == _LITTLE_ENDIAN
168 # define _LIBCPP_LITTLE_ENDIAN 0
169 # define _LIBCPP_BIG_ENDIAN 1
170 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
171 # ifndef __LONG_LONG_SUPPORTED
172 # define _LIBCPP_HAS_NO_LONG_LONG
173 # endif // __LONG_LONG_SUPPORTED
174 #endif // __FreeBSD__
177 # include <sys/endian.h>
178 # if _BYTE_ORDER == _LITTLE_ENDIAN
179 # define _LIBCPP_LITTLE_ENDIAN 1
180 # define _LIBCPP_BIG_ENDIAN 0
181 # else // _BYTE_ORDER == _LITTLE_ENDIAN
182 # define _LIBCPP_LITTLE_ENDIAN 0
183 # define _LIBCPP_BIG_ENDIAN 1
184 # endif // _BYTE_ORDER == _LITTLE_ENDIAN
185 # define _LIBCPP_HAS_QUICK_EXIT
189 # define _LIBCPP_WIN32API 1
190 # define _LIBCPP_LITTLE_ENDIAN 1
191 # define _LIBCPP_BIG_ENDIAN 0
192 # define _LIBCPP_SHORT_WCHAR 1
194 // If mingw not explicitly detected, assume using MS C runtime only.
196 # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
198 # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
199 # define _LIBCPP_HAS_BITSCAN64
201 #endif // defined(_WIN32)
204 # include <sys/isa_defs.h>
205 # ifdef _LITTLE_ENDIAN
206 # define _LIBCPP_LITTLE_ENDIAN 1
207 # define _LIBCPP_BIG_ENDIAN 0
209 # define _LIBCPP_LITTLE_ENDIAN 0
210 # define _LIBCPP_BIG_ENDIAN 1
214 #if defined(__CloudABI__)
215 // Certain architectures provide arc4random(). Prefer using
216 // arc4random() over /dev/{u,}random to make it possible to obtain
217 // random data even when using sandboxing mechanisms such as chroots,
219 # define _LIBCPP_USING_ARC4_RANDOM
220 #elif defined(__native_client__)
221 // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
222 // including accesses to the special files under /dev. C++11's
223 // std::random_device is instead exposed through a NaCl syscall.
224 # define _LIBCPP_USING_NACL_RANDOM
225 #elif defined(_LIBCPP_WIN32API)
226 # define _LIBCPP_USING_WIN32_RANDOM
228 # define _LIBCPP_USING_DEV_RANDOM
231 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
233 # if __BYTE_ORDER == __LITTLE_ENDIAN
234 # define _LIBCPP_LITTLE_ENDIAN 1
235 # define _LIBCPP_BIG_ENDIAN 0
236 # elif __BYTE_ORDER == __BIG_ENDIAN
237 # define _LIBCPP_LITTLE_ENDIAN 0
238 # define _LIBCPP_BIG_ENDIAN 1
239 # else // __BYTE_ORDER == __BIG_ENDIAN
240 # error unable to determine endian
242 #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
244 #if __has_attribute(__no_sanitize__)
245 #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
247 #define _LIBCPP_NO_CFI
250 #if defined(_LIBCPP_COMPILER_CLANG)
252 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
253 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
254 #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
255 !defined(__arm__)) || \
256 defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
257 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
260 #if __has_feature(cxx_alignas)
261 # define _ALIGNAS_TYPE(x) alignas(x)
262 # define _ALIGNAS(x) alignas(x)
264 # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
265 # define _ALIGNAS(x) __attribute__((__aligned__(x)))
268 #if __cplusplus < 201103L
269 typedef __char16_t char16_t;
270 typedef __char32_t char32_t;
273 #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
274 #define _LIBCPP_NO_EXCEPTIONS
277 #if !(__has_feature(cxx_rtti))
278 #define _LIBCPP_NO_RTTI
281 #if !(__has_feature(cxx_strong_enums))
282 #define _LIBCPP_HAS_NO_STRONG_ENUMS
285 #if !(__has_feature(cxx_decltype))
286 #define _LIBCPP_HAS_NO_DECLTYPE
289 #if __has_feature(cxx_attributes)
290 # define _LIBCPP_NORETURN [[noreturn]]
292 # define _LIBCPP_NORETURN __attribute__ ((noreturn))
295 #if !(__has_feature(cxx_lambdas))
296 #define _LIBCPP_HAS_NO_LAMBDAS
299 #if !(__has_feature(cxx_nullptr))
300 # if __has_extension(cxx_nullptr) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
301 # define nullptr __nullptr
303 # define _LIBCPP_HAS_NO_NULLPTR
307 #if !(__has_feature(cxx_rvalue_references))
308 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
311 #if !(__has_feature(cxx_auto_type))
312 #define _LIBCPP_HAS_NO_AUTO_TYPE
315 #if !(__has_feature(cxx_variadic_templates))
316 #define _LIBCPP_HAS_NO_VARIADICS
319 #if !(__has_feature(cxx_generalized_initializers))
320 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
323 #if __has_feature(is_base_of)
324 # define _LIBCPP_HAS_IS_BASE_OF
327 #if __has_feature(is_final)
328 # define _LIBCPP_HAS_IS_FINAL
331 // Objective-C++ features (opt-in)
332 #if __has_feature(objc_arc)
333 #define _LIBCPP_HAS_OBJC_ARC
336 #if __has_feature(objc_arc_weak)
337 #define _LIBCPP_HAS_OBJC_ARC_WEAK
338 #define _LIBCPP_HAS_NO_STRONG_ENUMS
341 #if !(__has_feature(cxx_constexpr))
342 #define _LIBCPP_HAS_NO_CONSTEXPR
345 #if !(__has_feature(cxx_relaxed_constexpr))
346 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
349 #if !(__has_feature(cxx_variable_templates))
350 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
353 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
354 #if defined(__FreeBSD__)
355 #define _LIBCPP_HAS_QUICK_EXIT
356 #define _LIBCPP_HAS_C11_FEATURES
357 #elif defined(__Fuchsia__)
358 #define _LIBCPP_HAS_QUICK_EXIT
359 #define _LIBCPP_HAS_C11_FEATURES
360 #elif defined(__linux__)
361 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
362 #if __GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
363 #define _LIBCPP_HAS_QUICK_EXIT
365 #if __GLIBC_PREREQ(2, 17)
366 #define _LIBCPP_HAS_C11_FEATURES
368 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
369 #define _LIBCPP_HAS_QUICK_EXIT
370 #define _LIBCPP_HAS_C11_FEATURES
375 #if !(__has_feature(cxx_noexcept))
376 #define _LIBCPP_HAS_NO_NOEXCEPT
379 #if __has_feature(underlying_type)
380 # define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
383 #if __has_feature(is_literal)
384 # define _LIBCPP_IS_LITERAL(T) __is_literal(T)
387 // Inline namespaces are available in Clang regardless of C++ dialect.
388 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
389 #define _LIBCPP_END_NAMESPACE_STD } }
390 #define _VSTD std::_LIBCPP_NAMESPACE
393 inline namespace _LIBCPP_NAMESPACE {
397 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
398 #define _LIBCPP_HAS_NO_ASAN
401 // Allow for build-time disabling of unsigned integer sanitization
402 #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
403 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
406 #elif defined(_LIBCPP_COMPILER_GCC)
408 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
409 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
411 #define _LIBCPP_NORETURN __attribute__((noreturn))
414 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
415 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
416 #define _LIBCPP_HAS_IS_FINAL
419 #if defined(__GNUC__) && _GNUC_VER >= 403
420 # define _LIBCPP_HAS_IS_BASE_OF
424 #define _LIBCPP_NO_EXCEPTIONS
427 // constexpr was added to GCC in 4.6.
429 #define _LIBCPP_HAS_NO_CONSTEXPR
430 // Can only use constexpr in c++11 mode.
431 #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
432 #define _LIBCPP_HAS_NO_CONSTEXPR
435 // Determine if GCC supports relaxed constexpr
436 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
437 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
440 // GCC 5 will support variable templates
441 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
442 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
445 #ifndef __GXX_EXPERIMENTAL_CXX0X__
446 #define _LIBCPP_HAS_NO_DECLTYPE
447 #define _LIBCPP_HAS_NO_NULLPTR
448 #define _LIBCPP_HAS_NO_UNICODE_CHARS
449 #define _LIBCPP_HAS_NO_VARIADICS
450 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
451 #define _LIBCPP_HAS_NO_STRONG_ENUMS
452 #define _LIBCPP_HAS_NO_NOEXCEPT
454 #else // __GXX_EXPERIMENTAL_CXX0X__
457 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
462 #define _LIBCPP_HAS_NO_DECLTYPE
463 #define _LIBCPP_HAS_NO_UNICODE_CHARS
464 #define _LIBCPP_HAS_NO_VARIADICS
465 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
466 #endif // _GNUC_VER < 404
469 #define _LIBCPP_HAS_NO_NOEXCEPT
470 #define _LIBCPP_HAS_NO_NULLPTR
473 #endif // __GXX_EXPERIMENTAL_CXX0X__
475 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
476 #define _LIBCPP_END_NAMESPACE_STD } }
477 #define _VSTD std::_LIBCPP_NAMESPACE
480 namespace _LIBCPP_NAMESPACE {
482 using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
485 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
486 #define _LIBCPP_HAS_NO_ASAN
489 #elif defined(_LIBCPP_COMPILER_MSVC)
491 #define _LIBCPP_TOSTRING2(x) #x
492 #define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
493 #define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
496 #error "MSVC versions prior to Visual Studio 2015 are not supported"
499 #define _LIBCPP_HAS_IS_BASE_OF
500 #define _LIBCPP_HAS_NO_CONSTEXPR
501 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
502 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
504 #define _LIBCPP_HAS_NO_UNICODE_CHARS
506 #define _LIBCPP_HAS_NO_NOEXCEPT
507 #define __alignof__ __alignof
508 #define _LIBCPP_NORETURN __declspec(noreturn)
509 #define _ALIGNAS(x) __declspec(align(x))
510 #define _LIBCPP_HAS_NO_VARIADICS
512 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
513 #define _LIBCPP_END_NAMESPACE_STD }
516 # define _LIBCPP_WEAK
520 #define _LIBCPP_HAS_NO_ASAN
522 #elif defined(_LIBCPP_COMPILER_IBM)
524 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
525 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
526 #define _ATTRIBUTE(x) __attribute__((x))
527 #define _LIBCPP_NORETURN __attribute__((noreturn))
529 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
530 #define _LIBCPP_HAS_NO_NOEXCEPT
531 #define _LIBCPP_HAS_NO_NULLPTR
532 #define _LIBCPP_HAS_NO_UNICODE_CHARS
533 #define _LIBCPP_HAS_IS_BASE_OF
534 #define _LIBCPP_HAS_IS_FINAL
535 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
538 #define __MULTILOCALE_API
541 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
542 #define _LIBCPP_END_NAMESPACE_STD } }
543 #define _VSTD std::_LIBCPP_NAMESPACE
546 inline namespace _LIBCPP_NAMESPACE {
550 #define _LIBCPP_HAS_NO_ASAN
552 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
555 #define _LIBCPP_OBJECT_FORMAT_ELF 1
556 #elif defined(__MACH__)
557 #define _LIBCPP_OBJECT_FORMAT_MACHO 1
559 #define _LIBCPP_OBJECT_FORMAT_COFF 1
562 #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
563 #if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
564 # define _LIBCPP_DLL_VIS
565 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
566 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
567 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
568 #elif defined(_LIBCPP_BUILDING_LIBRARY)
569 # define _LIBCPP_DLL_VIS __declspec(dllexport)
570 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
571 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
572 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
574 # define _LIBCPP_DLL_VIS __declspec(dllimport)
575 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
576 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
577 # define _LIBCPP_OVERRIDABLE_FUNC_VIS
580 #define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
581 #define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
582 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
583 #define _LIBCPP_HIDDEN
584 #define _LIBCPP_TEMPLATE_VIS
585 #define _LIBCPP_FUNC_VIS_ONLY
586 #define _LIBCPP_ENUM_VIS
588 #if defined(_LIBCPP_COMPILER_MSVC)
589 # define _LIBCPP_INLINE_VISIBILITY __forceinline
590 # define _LIBCPP_ALWAYS_INLINE __forceinline
591 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
593 # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
594 # define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
595 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
597 #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
599 #ifndef _LIBCPP_HIDDEN
600 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
601 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
603 #define _LIBCPP_HIDDEN
607 #ifndef _LIBCPP_FUNC_VIS
608 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
609 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
611 #define _LIBCPP_FUNC_VIS
615 #ifndef _LIBCPP_TYPE_VIS
616 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
617 # if __has_attribute(__type_visibility__)
618 # define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
620 # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
623 # define _LIBCPP_TYPE_VIS
627 #ifndef _LIBCPP_TEMPLATE_VIS
628 # define _LIBCPP_TEMPLATE_VIS _LIBCPP_TYPE_VIS
631 #ifndef _LIBCPP_FUNC_VIS_ONLY
632 # define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
635 #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
636 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
639 #ifndef _LIBCPP_EXCEPTION_ABI
640 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
641 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
643 #define _LIBCPP_EXCEPTION_ABI
647 #ifndef _LIBCPP_ENUM_VIS
648 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
649 # define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default")))
651 # define _LIBCPP_ENUM_VIS
655 #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
656 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
657 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default")))
659 # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
663 #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
664 # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
667 #ifndef _LIBCPP_INLINE_VISIBILITY
668 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
669 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
671 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
675 #ifndef _LIBCPP_ALWAYS_INLINE
676 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
677 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
679 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
683 #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
684 # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
685 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__))
687 # define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__))
691 #ifndef _LIBCPP_PREFERRED_OVERLOAD
692 # if __has_attribute(__enable_if__)
693 # define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
697 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
698 # define _NOEXCEPT noexcept
699 # define _NOEXCEPT_(x) noexcept(x)
701 # define _NOEXCEPT throw()
702 # define _NOEXCEPT_(x)
705 #if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
706 # if !defined(_LIBCPP_DEBUG)
707 # error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
709 # define _NOEXCEPT_DEBUG noexcept(false)
710 # define _NOEXCEPT_DEBUG_(x) noexcept(false)
712 # define _NOEXCEPT_DEBUG _NOEXCEPT
713 # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
716 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
717 typedef unsigned short char16_t;
718 typedef unsigned int char32_t;
719 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
721 #ifndef __SIZEOF_INT128__
722 #define _LIBCPP_HAS_NO_INT128
725 #ifdef _LIBCPP_CXX03_LANG
726 # if __has_extension(c_static_assert)
727 # define static_assert(__b, __m) _Static_assert(__b, __m)
730 template <bool> struct __static_assert_test;
731 template <> struct __static_assert_test<true> {};
732 template <unsigned> struct __static_assert_check {};
734 #define static_assert(__b, __m) \
735 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
736 _LIBCPP_CONCAT(__t, __LINE__)
737 # endif // __has_extension(c_static_assert)
738 #endif // _LIBCPP_CXX03_LANG
740 #ifdef _LIBCPP_HAS_NO_DECLTYPE
741 // GCC 4.6 provides __decltype in all standard modes.
742 #if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
743 # define decltype(__x) __decltype(__x)
745 # define decltype(__x) __typeof__(__x)
749 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
750 #define _LIBCPP_CONSTEXPR
752 #define _LIBCPP_CONSTEXPR constexpr
755 #ifdef _LIBCPP_CXX03_LANG
756 #define _LIBCPP_DEFAULT {}
758 #define _LIBCPP_DEFAULT = default;
761 #ifdef _LIBCPP_CXX03_LANG
762 #define _LIBCPP_EQUAL_DELETE
764 #define _LIBCPP_EQUAL_DELETE = delete
768 #define _NOALIAS __attribute__((__malloc__))
773 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
774 (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions
775 # define _LIBCPP_EXPLICIT explicit
777 # define _LIBCPP_EXPLICIT
780 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
781 # define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
784 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
785 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
786 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
788 _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
789 _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
790 _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
792 #else // _LIBCPP_HAS_NO_STRONG_ENUMS
793 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
794 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
795 #endif // _LIBCPP_HAS_NO_STRONG_ENUMS
798 # if _LIBCPP_DEBUG == 0
799 # define _LIBCPP_DEBUG_LEVEL 1
800 # elif _LIBCPP_DEBUG == 1
801 # define _LIBCPP_DEBUG_LEVEL 2
803 # error Supported values for _LIBCPP_DEBUG are 0 and 1
805 # define _LIBCPP_EXTERN_TEMPLATE(...)
808 #ifndef _LIBCPP_EXTERN_TEMPLATE
809 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
812 #ifndef _LIBCPP_EXTERN_TEMPLATE2
813 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
816 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
817 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
820 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT) || \
821 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
822 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
825 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
826 // Most unix variants have catopen. These are the specific ones that don't.
827 #if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
828 #define _LIBCPP_HAS_CATOPEN 1
833 #define _DECLARE_C99_LDBL_MATH 1
836 #if defined(__APPLE__)
837 # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
838 defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
839 # define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
841 # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
842 # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
843 # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
846 #endif // defined(__APPLE__)
848 #if defined(__APPLE__) || defined(__FreeBSD__)
849 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
852 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
853 #define _LIBCPP_WCTYPE_IS_MASK
856 #ifndef _LIBCPP_STD_VER
857 # if __cplusplus <= 201103L
858 # define _LIBCPP_STD_VER 11
859 # elif __cplusplus <= 201402L
860 # define _LIBCPP_STD_VER 14
862 # define _LIBCPP_STD_VER 16 // current year, or date of c++17 ratification
864 #endif // _LIBCPP_STD_VER
866 #if _LIBCPP_STD_VER > 11
867 #define _LIBCPP_DEPRECATED [[deprecated]]
869 #define _LIBCPP_DEPRECATED
872 #if _LIBCPP_STD_VER <= 11
873 #define _LIBCPP_EXPLICIT_AFTER_CXX11
874 #define _LIBCPP_DEPRECATED_AFTER_CXX11
876 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
877 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
880 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
881 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
883 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
886 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
887 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
889 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
892 // FIXME: Remove all usages of this macro once compilers catch up.
893 #if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606L)
894 # define _LIBCPP_HAS_NO_INLINE_VARIABLES
897 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
898 # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
900 # define _LIBCPP_EXPLICIT_MOVE(x) (x)
903 #ifndef _LIBCPP_HAS_NO_ASAN
904 _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
905 const void *, const void *, const void *, const void *);
908 // Try to find out if RTTI is disabled.
909 // g++ and cl.exe have RTTI on by default and define a macro when it is.
910 // g++ only defines the macro in 4.3.2 and onwards.
911 #if !defined(_LIBCPP_NO_RTTI)
912 # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
913 (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
914 # define _LIBCPP_NO_RTTI
915 # elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
916 # define _LIBCPP_NO_RTTI
921 # define _LIBCPP_WEAK __attribute__((__weak__))
925 #if !defined(_LIBCPP_HAS_NO_THREADS) && \
926 !defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
927 # if defined(__FreeBSD__) || \
928 defined(__Fuchsia__) || \
929 defined(__NetBSD__) || \
930 defined(__linux__) || \
931 defined(__APPLE__) || \
932 defined(__CloudABI__) || \
934 # define _LIBCPP_HAS_THREAD_API_PTHREAD
935 # elif defined(_LIBCPP_WIN32API)
936 # define _LIBCPP_HAS_THREAD_API_WIN32
938 # error "No thread API"
939 # endif // _LIBCPP_HAS_THREAD_API
940 #endif // _LIBCPP_HAS_NO_THREADS
942 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
943 # error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
944 _LIBCPP_HAS_NO_THREADS is not defined.
947 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
948 # error _LIBCPP_HAS_EXTERNAL_THREAD_API may not be defined when \
949 _LIBCPP_HAS_NO_THREADS is defined.
952 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
953 # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
954 _LIBCPP_HAS_NO_THREADS is defined.
957 // Systems that use capability-based security (FreeBSD with Capsicum,
958 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
959 // Functions like open(), rename(), unlink() and stat() should not be
960 // used, as they attempt to access the global filesystem namespace.
962 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
965 // CloudABI is intended for running networked services. Processes do not
966 // have standard input and output channels.
968 #define _LIBCPP_HAS_NO_STDIN
969 #define _LIBCPP_HAS_NO_STDOUT
972 #if defined(__BIONIC__) || defined(__CloudABI__) || \
973 defined(_LIBCPP_HAS_MUSL_LIBC)
974 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
977 // Thread-unsafe functions such as strtok() and localtime()
978 // are not available.
980 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
983 #if __has_feature(cxx_atomic) || __has_extension(c_atomic)
984 #define _LIBCPP_HAS_C_ATOMIC_IMP
985 #elif _GNUC_VER > 407
986 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
989 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
990 || defined(_LIBCPP_HAS_NO_THREADS)
991 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
994 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
995 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
998 #if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \
999 && __has_attribute(acquire_capability))
1000 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1003 #if __has_attribute(require_constant_initialization)
1004 #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1006 #define _LIBCPP_SAFE_STATIC
1009 #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
1010 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1013 #if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
1014 #if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
1015 #define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
1019 #endif // __cplusplus
1021 #endif // _LIBCPP_CONFIG