]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libc++/include/__config
MFV r341618:
[FreeBSD/FreeBSD.git] / contrib / libc++ / include / __config
1 // -*- C++ -*-
2 //===--------------------------- __config ---------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef _LIBCPP_CONFIG
12 #define _LIBCPP_CONFIG
13
14 #if defined(_MSC_VER) && !defined(__clang__)
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
17 #endif
18 #endif
19
20 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
21 #pragma GCC system_header
22 #endif
23
24 #ifdef __cplusplus
25
26 #ifdef __GNUC__
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__)
31 #else
32 #define _GNUC_VER 0
33 #define _GNUC_VER_NEW 0
34 #endif
35
36 #define _LIBCPP_VERSION 6000
37
38 #ifndef _LIBCPP_ABI_VERSION
39 #define _LIBCPP_ABI_VERSION 1
40 #endif
41
42 #if defined(__ELF__)
43 #define _LIBCPP_OBJECT_FORMAT_ELF   1
44 #elif defined(__MACH__)
45 #define _LIBCPP_OBJECT_FORMAT_MACHO 1
46 #elif defined(_WIN32)
47 #define _LIBCPP_OBJECT_FORMAT_COFF  1
48 #elif defined(__wasm__)
49 #define _LIBCPP_OBJECT_FORMAT_WASM  1
50 #else
51 #error Unknown object file format
52 #endif
53
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
75 // in C++03.
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
94 #endif
95 // Feature macros for disabling pre ABI v1 features. All of these options
96 // are deprecated.
97 #if defined(__FreeBSD__)
98 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
99 #endif
100 #endif
101
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
105 #endif
106
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)
109
110 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
111
112 #if __cplusplus < 201103L
113 #define _LIBCPP_CXX03_LANG
114 #endif
115
116 #ifndef __has_attribute
117 #define __has_attribute(__x) 0
118 #endif
119 #ifndef __has_builtin
120 #define __has_builtin(__x) 0
121 #endif
122 #ifndef __has_extension
123 #define __has_extension(__x) 0
124 #endif
125 #ifndef __has_feature
126 #define __has_feature(__x) 0
127 #endif
128 #ifndef __has_cpp_attribute
129 #define __has_cpp_attribute(__x) 0
130 #endif
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
135 #endif
136 #ifndef __has_declspec_attribute
137 #define __has_declspec_attribute(__x) 0
138 #endif
139
140 #define __has_keyword(__x) !(__is_identifier(__x))
141
142 #ifdef __has_include
143 #define __libcpp_has_include(__x) __has_include(__x)
144 #else
145 #define __libcpp_has_include(__x) 0
146 #endif
147
148 #if defined(__clang__)
149 #define _LIBCPP_COMPILER_CLANG
150 # ifndef __apple_build_version__
151 #   define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
152 # endif
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
159 #endif
160
161 #ifndef _LIBCPP_CLANG_VER
162 #define _LIBCPP_CLANG_VER 0
163 #endif
164
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
176 #else
177 # if defined(_WIN32) && defined(_MSC_VER)
178 #  define _LIBCPP_ABI_MICROSOFT
179 # else
180 #  define _LIBCPP_ABI_ITANIUM
181 # endif
182 #endif
183
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__)
191
192 #ifdef __LITTLE_ENDIAN__
193 #if __LITTLE_ENDIAN__
194 #define _LIBCPP_LITTLE_ENDIAN
195 #endif  // __LITTLE_ENDIAN__
196 #endif  // __LITTLE_ENDIAN__
197
198 #ifdef __BIG_ENDIAN__
199 #if __BIG_ENDIAN__
200 #define _LIBCPP_BIG_ENDIAN
201 #endif  // __BIG_ENDIAN__
202 #endif  // __BIG_ENDIAN__
203
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__
211
212 #ifdef __FreeBSD__
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__
223
224 #ifdef __NetBSD__
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
232 #endif  // __NetBSD__
233
234 #if defined(_WIN32)
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
244 #  endif
245 #  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
246 #    define _LIBCPP_HAS_BITSCAN64
247 #  endif
248 # if defined(_LIBCPP_MSVCRT)
249 #   define _LIBCPP_HAS_QUICK_EXIT
250 # endif
251
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
259 #endif
260 #endif
261 #endif // defined(_WIN32)
262
263 #ifdef __sun__
264 # include <sys/isa_defs.h>
265 # ifdef _LITTLE_ENDIAN
266 #   define _LIBCPP_LITTLE_ENDIAN
267 # else
268 #   define _LIBCPP_BIG_ENDIAN
269 # endif
270 #endif // __sun__
271
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,
276   // Capsicum, etc.
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
287 #else
288 # define _LIBCPP_USING_DEV_RANDOM
289 #endif
290
291 #if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
292 # include <endian.h>
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
299 # endif
300 #endif  // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
301
302 #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
303 #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
304 #else
305 #define _LIBCPP_NO_CFI
306 #endif
307
308 #if defined(_LIBCPP_COMPILER_CLANG)
309
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
316 #endif
317
318 #if __has_feature(cxx_alignas)
319 #  define _ALIGNAS_TYPE(x) alignas(x)
320 #  define _ALIGNAS(x) alignas(x)
321 #else
322 #  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
323 #  define _ALIGNAS(x) __attribute__((__aligned__(x)))
324 #endif
325
326 #if __cplusplus < 201103L
327 typedef __char16_t char16_t;
328 typedef __char32_t char32_t;
329 #endif
330
331 #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
332 #define _LIBCPP_NO_EXCEPTIONS
333 #endif
334
335 #if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI)
336 #define _LIBCPP_NO_RTTI
337 #endif
338
339 #if !(__has_feature(cxx_strong_enums))
340 #define _LIBCPP_HAS_NO_STRONG_ENUMS
341 #endif
342
343 #if !(__has_feature(cxx_decltype))
344 #define _LIBCPP_HAS_NO_DECLTYPE
345 #endif
346
347 #if __has_feature(cxx_attributes)
348 #  define _LIBCPP_NORETURN [[noreturn]]
349 #else
350 #  define _LIBCPP_NORETURN __attribute__ ((noreturn))
351 #endif
352
353 #if !(__has_feature(cxx_lambdas))
354 #define _LIBCPP_HAS_NO_LAMBDAS
355 #endif
356
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
360 # else
361 #   define _LIBCPP_HAS_NO_NULLPTR
362 # endif
363 #endif
364
365 #if !(__has_feature(cxx_rvalue_references))
366 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
367 #endif
368
369 #if !(__has_feature(cxx_auto_type))
370 #define _LIBCPP_HAS_NO_AUTO_TYPE
371 #endif
372
373 #if !(__has_feature(cxx_variadic_templates))
374 #define _LIBCPP_HAS_NO_VARIADICS
375 #endif
376
377 #if !(__has_feature(cxx_generalized_initializers))
378 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
379 #endif
380
381 #if __has_feature(is_base_of)
382 #  define _LIBCPP_HAS_IS_BASE_OF
383 #endif
384
385 #if __has_feature(is_final)
386 #  define _LIBCPP_HAS_IS_FINAL
387 #endif
388
389 // Objective-C++ features (opt-in)
390 #if __has_feature(objc_arc)
391 #define _LIBCPP_HAS_OBJC_ARC
392 #endif
393
394 #if __has_feature(objc_arc_weak)
395 #define _LIBCPP_HAS_OBJC_ARC_WEAK
396 #endif
397
398 #if !(__has_feature(cxx_constexpr))
399 #define _LIBCPP_HAS_NO_CONSTEXPR
400 #endif
401
402 #if !(__has_feature(cxx_relaxed_constexpr))
403 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
404 #endif
405
406 #if !(__has_feature(cxx_variable_templates))
407 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
408 #endif
409
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
421 #endif
422 #if __GLIBC_PREREQ(2, 17)
423 #define _LIBCPP_HAS_C11_FEATURES
424 #endif
425 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
426 #define _LIBCPP_HAS_QUICK_EXIT
427 #define _LIBCPP_HAS_C11_FEATURES
428 #endif
429 #endif // __linux__
430 #endif
431
432 #if !(__has_feature(cxx_noexcept))
433 #define _LIBCPP_HAS_NO_NOEXCEPT
434 #endif
435
436 #if __has_feature(underlying_type)
437 #  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
438 #endif
439
440 #if __has_feature(is_literal)
441 #  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
442 #endif
443
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
448
449 namespace std {
450   inline namespace _LIBCPP_NAMESPACE {
451   }
452 }
453
454 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
455 #define _LIBCPP_HAS_NO_ASAN
456 #endif
457
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")))
461 #endif 
462
463 #if __has_builtin(__builtin_launder)
464 #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
465 #endif
466
467 #if !__is_identifier(__has_unique_object_representations)
468 #define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
469 #endif
470
471 #elif defined(_LIBCPP_COMPILER_GCC)
472
473 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
474 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
475
476 #define _LIBCPP_NORETURN __attribute__((noreturn))
477
478 #if _GNUC_VER >= 407
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
482 #endif
483
484 #if defined(__GNUC__) && _GNUC_VER >= 403
485 #  define _LIBCPP_HAS_IS_BASE_OF
486 #endif
487
488 #if !__EXCEPTIONS
489 #define _LIBCPP_NO_EXCEPTIONS
490 #endif
491
492 // constexpr was added to GCC in 4.6.
493 #if _GNUC_VER < 406
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
498 #endif
499
500 // Determine if GCC supports relaxed constexpr
501 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
502 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
503 #endif
504
505 // GCC 5 will support variable templates
506 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
507 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
508 #endif
509
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
518
519 #else  // __GXX_EXPERIMENTAL_CXX0X__
520
521 #if _GNUC_VER < 403
522 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
523 #endif
524
525
526 #if _GNUC_VER < 404
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
532
533 #if _GNUC_VER < 406
534 #define _LIBCPP_HAS_NO_NOEXCEPT
535 #define _LIBCPP_HAS_NO_NULLPTR
536 #endif
537
538 #endif  // __GXX_EXPERIMENTAL_CXX0X__
539
540 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
541 #define _LIBCPP_END_NAMESPACE_STD  } }
542 #define _VSTD std::_LIBCPP_NAMESPACE
543
544 namespace std {
545   inline namespace _LIBCPP_NAMESPACE {
546   }
547 }
548
549 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
550 #define _LIBCPP_HAS_NO_ASAN
551 #endif
552
553 #if _GNUC_VER >= 700
554 #define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
555 #endif
556
557 #if _GNUC_VER >= 700
558 #define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
559 #endif
560
561 #elif defined(_LIBCPP_COMPILER_MSVC)
562
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))
566
567 #if _MSC_VER < 1900
568 #error "MSVC versions prior to Visual Studio 2015 are not supported"
569 #endif
570
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
575 #if _MSC_VER <= 1800
576 #define _LIBCPP_HAS_NO_UNICODE_CHARS
577 #endif
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
583
584 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
585 #define _LIBCPP_END_NAMESPACE_STD  }
586 #define _VSTD std
587
588 #  define _LIBCPP_WEAK
589 namespace std {
590 }
591
592 #define _LIBCPP_HAS_NO_ASAN
593
594 #elif defined(_LIBCPP_COMPILER_IBM)
595
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))
600
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
608
609 #if defined(_AIX)
610 #define __MULTILOCALE_API
611 #endif
612
613 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
614 #define _LIBCPP_END_NAMESPACE_STD  } }
615 #define _VSTD std::_LIBCPP_NAMESPACE
616
617 namespace std {
618   inline namespace _LIBCPP_NAMESPACE {
619   }
620 }
621
622 #define _LIBCPP_HAS_NO_ASAN
623
624 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
625
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
637 #else
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
642 #endif
643
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
652
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
657 #else
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__))
661 #endif
662 #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
663
664 #ifndef _LIBCPP_HIDDEN
665 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
666 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
667 #else
668 #define _LIBCPP_HIDDEN
669 #endif
670 #endif
671
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
676 #else
677 #define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
678 #endif
679 #endif
680
681 #ifndef _LIBCPP_FUNC_VIS
682 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
683 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
684 #else
685 #define _LIBCPP_FUNC_VIS
686 #endif
687 #endif
688
689 #ifndef _LIBCPP_TYPE_VIS
690 #  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
691 #    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
692 #  else
693 #    define _LIBCPP_TYPE_VIS
694 #  endif
695 #endif
696
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")))
701 #    else
702 #      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
703 #    endif
704 #  else
705 #    define _LIBCPP_TEMPLATE_VIS
706 #  endif
707 #endif
708
709 #ifndef _LIBCPP_EXTERN_VIS
710 # define _LIBCPP_EXTERN_VIS
711 #endif
712
713 #ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
714 # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
715 #endif
716
717 #ifndef _LIBCPP_EXCEPTION_ABI
718 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
719 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
720 #else
721 #define _LIBCPP_EXCEPTION_ABI
722 #endif
723 #endif
724
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")))
728 #  else
729 #    define _LIBCPP_ENUM_VIS
730 #  endif
731 #endif
732
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")))
736 #  else
737 #    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
738 #  endif
739 #endif
740
741 #ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
742 #  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
743 #endif
744
745 #ifndef _LIBCPP_INLINE_VISIBILITY
746 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
747 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
748 #else
749 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
750 #endif
751 #endif
752
753 #ifndef _LIBCPP_ALWAYS_INLINE
754 #if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
755 #define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
756 #else
757 #define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__always_inline__))
758 #endif
759 #endif
760
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__))
764 # else
765 #  define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__))
766 # endif
767 #endif
768
769 #ifndef _LIBCPP_PREFERRED_OVERLOAD
770 #  if __has_attribute(__enable_if__)
771 #    define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
772 #  endif
773 #endif
774
775 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
776 #  define _NOEXCEPT noexcept
777 #  define _NOEXCEPT_(x) noexcept(x)
778 #else
779 #  define _NOEXCEPT throw()
780 #  define _NOEXCEPT_(x)
781 #endif
782
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
786 # endif
787 # define _NOEXCEPT_DEBUG noexcept(false)
788 # define _NOEXCEPT_DEBUG_(x) noexcept(false)
789 #else
790 # define _NOEXCEPT_DEBUG _NOEXCEPT
791 # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
792 #endif
793
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
798
799 #ifndef __SIZEOF_INT128__
800 #define _LIBCPP_HAS_NO_INT128
801 #endif
802
803 #ifdef _LIBCPP_CXX03_LANG
804 # if __has_extension(c_static_assert)
805 #   define static_assert(__b, __m) _Static_assert(__b, __m)
806 # else
807 extern "C++" {
808 template <bool> struct __static_assert_test;
809 template <> struct __static_assert_test<true> {};
810 template <unsigned> struct __static_assert_check {};
811 }
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
817
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)
822 #else
823 #  define decltype(__x) __typeof__(__x)
824 #endif
825 #endif
826
827 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
828 #define _LIBCPP_CONSTEXPR
829 #else
830 #define _LIBCPP_CONSTEXPR constexpr
831 #endif
832
833 #ifdef _LIBCPP_CXX03_LANG
834 #define _LIBCPP_DEFAULT {}
835 #else
836 #define _LIBCPP_DEFAULT = default;
837 #endif
838
839 #ifdef _LIBCPP_CXX03_LANG
840 #define _LIBCPP_EQUAL_DELETE
841 #else
842 #define _LIBCPP_EQUAL_DELETE = delete
843 #endif
844
845 #ifdef __GNUC__
846 #define _NOALIAS __attribute__((__malloc__))
847 #else
848 #define _NOALIAS
849 #endif
850
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
854 #else
855 #   define _LIBCPP_EXPLICIT
856 #endif
857
858 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
859 #   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
860 #endif
861
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) \
865     __lx __v_; \
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_;} \
869     };
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
874
875 #ifdef _LIBCPP_DEBUG
876 #   if _LIBCPP_DEBUG == 0
877 #       define _LIBCPP_DEBUG_LEVEL 1
878 #   elif _LIBCPP_DEBUG == 1
879 #       define _LIBCPP_DEBUG_LEVEL 2
880 #   else
881 #       error Supported values for _LIBCPP_DEBUG are 0 and 1
882 #   endif
883 # if !defined(_LIBCPP_BUILDING_LIBRARY)
884 #   define _LIBCPP_EXTERN_TEMPLATE(...)
885 # endif
886 #endif
887
888 #ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
889 #define _LIBCPP_EXTERN_TEMPLATE(...)
890 #define _LIBCPP_EXTERN_TEMPLATE2(...)
891 #endif
892
893 #ifndef _LIBCPP_EXTERN_TEMPLATE
894 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
895 #endif
896
897 #ifndef _LIBCPP_EXTERN_TEMPLATE2
898 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
899 #endif
900
901 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
902 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
903 #endif
904
905 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
906     defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
907 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
908 #endif
909
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
914 #endif
915 #endif
916
917 #ifdef __FreeBSD__
918 #define _DECLARE_C99_LDBL_MATH 1
919 #endif
920
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__
925 # endif
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
929 #   endif
930 # endif
931 #endif // defined(__APPLE__)
932
933 #if defined(__APPLE__) || defined(__FreeBSD__)
934 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
935 #endif
936
937 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
938 #define _LIBCPP_WCTYPE_IS_MASK
939 #endif
940
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
948 #  else
949 #    define _LIBCPP_STD_VER 18  // current year, or date of c++2a ratification
950 #  endif
951 #endif  // _LIBCPP_STD_VER
952
953 #if _LIBCPP_STD_VER > 11
954 #define _LIBCPP_DEPRECATED [[deprecated]]
955 #else
956 #define _LIBCPP_DEPRECATED
957 #endif
958
959 #if _LIBCPP_STD_VER <= 11
960 #define _LIBCPP_EXPLICIT_AFTER_CXX11
961 #define _LIBCPP_DEPRECATED_AFTER_CXX11
962 #else
963 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
964 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
965 #endif
966
967 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
968 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
969 #else
970 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
971 #endif
972
973 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
974 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
975 #else
976 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
977 #endif
978
979 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
980 #define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
981 #else
982 #define _LIBCPP_CONSTEXPR_AFTER_CXX17
983 #endif
984
985 #if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17)
986 #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
987 #else
988 #define _LIBCPP_NODISCARD_AFTER_CXX17
989 #endif
990
991 #if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
992 # define _LIBCPP_INLINE_VAR  inline
993 #else
994 # define _LIBCPP_INLINE_VAR  
995 #endif
996
997 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
998 #  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
999 #else
1000 #  define _LIBCPP_EXPLICIT_MOVE(x) (x)
1001 #endif
1002
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 *);
1006 #endif
1007
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
1017 #  endif
1018 #endif
1019
1020 #ifndef _LIBCPP_WEAK
1021 #  define _LIBCPP_WEAK __attribute__((__weak__))
1022 #endif
1023
1024 // Thread API
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
1040 # else
1041 #  error "No thread API"
1042 # endif // _LIBCPP_HAS_THREAD_API
1043 #endif // _LIBCPP_HAS_NO_THREADS
1044
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.
1048 #endif
1049
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.
1053 #endif
1054
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.
1058 #endif
1059
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.
1064 #ifdef __CloudABI__
1065 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
1066 #endif
1067
1068 // CloudABI is intended for running networked services. Processes do not
1069 // have standard input and output channels.
1070 #ifdef __CloudABI__
1071 #define _LIBCPP_HAS_NO_STDIN
1072 #define _LIBCPP_HAS_NO_STDOUT
1073 #endif
1074
1075 #if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
1076     defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1077 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
1078 #endif
1079
1080 // Thread-unsafe functions such as strtok() and localtime()
1081 // are not available.
1082 #ifdef __CloudABI__
1083 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
1084 #endif
1085
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
1090 #endif
1091
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
1095 #endif
1096
1097 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1098 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1099 #endif
1100
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
1105 // of the types.
1106 #if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
1107 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1108 #endif
1109 #endif
1110 #endif
1111
1112 #if __has_attribute(require_constant_initialization)
1113 #define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1114 #else
1115 #define _LIBCPP_SAFE_STATIC
1116 #endif
1117
1118 #if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
1119 # define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1120 #endif
1121
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
1125 #endif
1126 #endif
1127
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")))
1133 #else
1134 # define _LIBCPP_DIAGNOSE_WARNING(...)
1135 # define _LIBCPP_DIAGNOSE_ERROR(...)
1136 #endif
1137
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__))
1141 #else
1142 #define _LIBCPP_FALLTHROUGH() ((void)0)
1143 #endif
1144
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)
1148 #else
1149 # define _LIBCPP_DECLSPEC_EMPTY_BASES
1150 #endif
1151
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
1158
1159 #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
1160 # define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1161 #endif
1162
1163 #if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
1164 # define _LIBCPP_HAS_NO_IS_AGGREGATE
1165 #endif
1166
1167 #if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
1168 # define _LIBCPP_HAS_NO_COROUTINES
1169 #endif
1170
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)
1176 #ifdef __APPLE__
1177 #define _LIBCPP_USE_AVAILABILITY_APPLE
1178 #endif
1179 #endif
1180
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)))
1212 #else
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
1223 #endif
1224
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
1230 #else
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
1235 #endif
1236
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
1247 #endif
1248
1249 #if defined(_LIBCPP_COMPILER_IBM)
1250 #define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
1251 #endif
1252
1253 #if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1254 # define _LIBCPP_PUSH_MACROS
1255 # define _LIBCPP_POP_MACROS
1256 #else
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
1261 # endif
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"))
1269 # else
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\")")
1276 # endif
1277 #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1278
1279 #if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1280 # if defined(_DLL)
1281 #   pragma(lib, "c++.lib")
1282 # else
1283 #   pragma(lib, "libc++.lib")
1284 # endif
1285 #endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1286
1287 #endif // __cplusplus
1288
1289 #endif // _LIBCPP_CONFIG