]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libc++/include/__config
Merge ^/vendor/NetBSD/tests/dist@r312294
[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 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
16 #endif
17
18 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
19 #pragma GCC system_header
20 #endif
21
22 #ifdef __cplusplus
23
24 #ifdef __GNUC__
25 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
26 #else
27 #define _GNUC_VER 0
28 #endif
29
30 #define _LIBCPP_VERSION 3900
31
32 #ifndef _LIBCPP_ABI_VERSION
33 #define _LIBCPP_ABI_VERSION 1
34 #endif
35
36 #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
37 // Change short string represention so that string data starts at offset 0,
38 // improving its alignment in some cases.
39 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
40 // Fix deque iterator type in order to support incomplete types.
41 #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
42 // Fix undefined behavior in how std::list stores it's linked nodes.
43 #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
44 // Fix undefined behavior in  how __tree stores its end and parent nodes.
45 #define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
46 #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
47 #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
48 #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
49 #elif _LIBCPP_ABI_VERSION == 1
50 // Feature macros for disabling pre ABI v1 features. All of these options
51 // are deprecated.
52 #if defined(__FreeBSD__)
53 #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
54 #endif
55 #endif
56
57 #ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
58 #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
59        use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
60 #endif
61
62 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
63 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
64
65 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
66
67
68 #ifndef __has_attribute
69 #define __has_attribute(__x) 0
70 #endif
71 #ifndef __has_builtin
72 #define __has_builtin(__x) 0
73 #endif
74 #ifndef __has_extension
75 #define __has_extension(__x) 0
76 #endif
77 #ifndef __has_feature
78 #define __has_feature(__x) 0
79 #endif
80 // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
81 // the compiler and '1' otherwise.
82 #ifndef __is_identifier
83 #define __is_identifier(__x) 1
84 #endif
85
86
87 #ifdef __LITTLE_ENDIAN__
88 #if __LITTLE_ENDIAN__
89 #define _LIBCPP_LITTLE_ENDIAN 1
90 #define _LIBCPP_BIG_ENDIAN    0
91 #endif  // __LITTLE_ENDIAN__
92 #endif  // __LITTLE_ENDIAN__
93
94 #ifdef __BIG_ENDIAN__
95 #if __BIG_ENDIAN__
96 #define _LIBCPP_LITTLE_ENDIAN 0
97 #define _LIBCPP_BIG_ENDIAN    1
98 #endif  // __BIG_ENDIAN__
99 #endif  // __BIG_ENDIAN__
100
101 #ifdef __BYTE_ORDER__
102 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
103 #define _LIBCPP_LITTLE_ENDIAN 1
104 #define _LIBCPP_BIG_ENDIAN 0
105 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
106 #define _LIBCPP_LITTLE_ENDIAN 0
107 #define _LIBCPP_BIG_ENDIAN 1
108 #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
109 #endif // __BYTE_ORDER__
110
111 #ifdef __FreeBSD__
112 # include <sys/endian.h>
113 #  if _BYTE_ORDER == _LITTLE_ENDIAN
114 #   define _LIBCPP_LITTLE_ENDIAN 1
115 #   define _LIBCPP_BIG_ENDIAN    0
116 # else  // _BYTE_ORDER == _LITTLE_ENDIAN
117 #   define _LIBCPP_LITTLE_ENDIAN 0
118 #   define _LIBCPP_BIG_ENDIAN    1
119 # endif  // _BYTE_ORDER == _LITTLE_ENDIAN
120 # ifndef __LONG_LONG_SUPPORTED
121 #  define _LIBCPP_HAS_NO_LONG_LONG
122 # endif  // __LONG_LONG_SUPPORTED
123 #endif  // __FreeBSD__
124
125 #ifdef __NetBSD__
126 # include <sys/endian.h>
127 #  if _BYTE_ORDER == _LITTLE_ENDIAN
128 #   define _LIBCPP_LITTLE_ENDIAN 1
129 #   define _LIBCPP_BIG_ENDIAN    0
130 # else  // _BYTE_ORDER == _LITTLE_ENDIAN
131 #   define _LIBCPP_LITTLE_ENDIAN 0
132 #   define _LIBCPP_BIG_ENDIAN    1
133 # endif  // _BYTE_ORDER == _LITTLE_ENDIAN
134 # define _LIBCPP_HAS_QUICK_EXIT
135 #endif  // __NetBSD__
136
137 #ifdef _WIN32
138 #  define _LIBCPP_LITTLE_ENDIAN 1
139 #  define _LIBCPP_BIG_ENDIAN    0
140 // Compiler intrinsics (MSVC)
141 #if defined(_MSC_VER) && _MSC_VER >= 1400
142 #    define _LIBCPP_HAS_IS_BASE_OF
143 #  endif
144 #  if defined(_MSC_VER) && !defined(__clang__)
145 #    define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
146 #    define _LIBCPP_TOSTRING2(x) #x
147 #    define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
148 #    define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
149 #  endif
150 #  // If mingw not explicitly detected, assume using MS C runtime only.
151 #  ifndef __MINGW32__
152 #    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
153 #  endif
154 #endif  // _WIN32
155
156 #ifdef __sun__
157 # include <sys/isa_defs.h>
158 # ifdef _LITTLE_ENDIAN
159 #   define _LIBCPP_LITTLE_ENDIAN 1
160 #   define _LIBCPP_BIG_ENDIAN    0
161 # else
162 #   define _LIBCPP_LITTLE_ENDIAN 0
163 #   define _LIBCPP_BIG_ENDIAN    1
164 # endif
165 #endif // __sun__
166
167 #if defined(__CloudABI__)
168   // Certain architectures provide arc4random(). Prefer using
169   // arc4random() over /dev/{u,}random to make it possible to obtain
170   // random data even when using sandboxing mechanisms such as chroots,
171   // Capsicum, etc.
172 # define _LIBCPP_USING_ARC4_RANDOM
173 #elif defined(__native_client__)
174   // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
175   // including accesses to the special files under /dev. C++11's
176   // std::random_device is instead exposed through a NaCl syscall.
177 # define _LIBCPP_USING_NACL_RANDOM
178 #elif defined(_WIN32)
179 # define _LIBCPP_USING_WIN32_RANDOM
180 #else
181 # define _LIBCPP_USING_DEV_RANDOM
182 #endif
183
184 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
185 # include <endian.h>
186 # if __BYTE_ORDER == __LITTLE_ENDIAN
187 #  define _LIBCPP_LITTLE_ENDIAN 1
188 #  define _LIBCPP_BIG_ENDIAN    0
189 # elif __BYTE_ORDER == __BIG_ENDIAN
190 #  define _LIBCPP_LITTLE_ENDIAN 0
191 #  define _LIBCPP_BIG_ENDIAN    1
192 # else  // __BYTE_ORDER == __BIG_ENDIAN
193 #  error unable to determine endian
194 # endif
195 #endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
196
197 #if __has_attribute(__no_sanitize__)
198 #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
199 #else
200 #define _LIBCPP_NO_CFI
201 #endif
202
203 #ifdef _WIN32
204
205 // only really useful for a DLL
206 #ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
207 # ifdef cxx_EXPORTS
208 #  define _LIBCPP_HIDDEN
209 #  define _LIBCPP_FUNC_VIS __declspec(dllexport)
210 #  define _LIBCPP_TYPE_VIS __declspec(dllexport)
211 # else
212 #  define _LIBCPP_HIDDEN
213 #  define _LIBCPP_FUNC_VIS __declspec(dllimport)
214 #  define _LIBCPP_TYPE_VIS __declspec(dllimport)
215 # endif
216 #else
217 # define _LIBCPP_HIDDEN
218 # define _LIBCPP_FUNC_VIS
219 # define _LIBCPP_TYPE_VIS
220 #endif
221
222 #define _LIBCPP_TYPE_VIS_ONLY
223 #define _LIBCPP_FUNC_VIS_ONLY
224
225 #ifndef _LIBCPP_INLINE_VISIBILITY
226 # ifdef _LIBCPP_MSVC
227 #  define _LIBCPP_INLINE_VISIBILITY __forceinline
228 # else // MinGW GCC and Clang
229 #  define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
230 # endif
231 #endif
232
233 #ifndef _LIBCPP_EXCEPTION_ABI
234 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
235 #endif
236
237 #ifndef _LIBCPP_ALWAYS_INLINE
238 # ifdef _LIBCPP_MSVC
239 #  define _LIBCPP_ALWAYS_INLINE __forceinline
240 # endif
241 #endif
242
243 #endif // _WIN32
244
245 #ifndef _LIBCPP_HIDDEN
246 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
247 #endif
248
249 #ifndef _LIBCPP_FUNC_VIS
250 #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
251 #endif
252
253 #ifndef _LIBCPP_TYPE_VIS
254 #  if __has_attribute(__type_visibility__)
255 #    define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
256 #  else
257 #    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
258 #  endif
259 #endif
260
261 #ifndef _LIBCPP_PREFERRED_OVERLOAD
262 #  if __has_attribute(__enable_if__)
263 #    define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
264 #  endif
265 #endif
266
267 #ifndef _LIBCPP_TYPE_VIS_ONLY
268 # define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
269 #endif
270
271 #ifndef _LIBCPP_FUNC_VIS_ONLY
272 # define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
273 #endif
274
275 #ifndef _LIBCPP_INLINE_VISIBILITY
276 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
277 #endif
278
279 #ifndef _LIBCPP_EXCEPTION_ABI
280 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
281 #endif
282
283 #ifndef _LIBCPP_ALWAYS_INLINE
284 #define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
285 #endif
286
287 #if defined(__clang__)
288
289 // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
290 // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
291 #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&       \
292      !defined(__arm__)) ||                                                     \
293     defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
294 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
295 #endif
296
297 #if __has_feature(cxx_alignas)
298 #  define _ALIGNAS_TYPE(x) alignas(x)
299 #  define _ALIGNAS(x) alignas(x)
300 #else
301 #  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
302 #  define _ALIGNAS(x) __attribute__((__aligned__(x)))
303 #endif
304
305 #if !__has_feature(cxx_alias_templates)
306 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
307 #endif
308
309 #if __cplusplus < 201103L
310 typedef __char16_t char16_t;
311 typedef __char32_t char32_t;
312 #endif
313
314 #if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
315 #define _LIBCPP_NO_EXCEPTIONS
316 #endif
317
318 #if !(__has_feature(cxx_rtti))
319 #define _LIBCPP_NO_RTTI
320 #endif
321
322 #if !(__has_feature(cxx_strong_enums))
323 #define _LIBCPP_HAS_NO_STRONG_ENUMS
324 #endif
325
326 #if !(__has_feature(cxx_decltype))
327 #define _LIBCPP_HAS_NO_DECLTYPE
328 #endif
329
330 #if __has_feature(cxx_attributes)
331 #  define _LIBCPP_NORETURN [[noreturn]]
332 #else
333 #  define _LIBCPP_NORETURN __attribute__ ((noreturn))
334 #endif
335
336 #if !(__has_feature(cxx_default_function_template_args))
337 #define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
338 #endif
339
340 #if !(__has_feature(cxx_defaulted_functions))
341 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
342 #endif  // !(__has_feature(cxx_defaulted_functions))
343
344 #if !(__has_feature(cxx_deleted_functions))
345 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
346 #endif  // !(__has_feature(cxx_deleted_functions))
347
348 #if !(__has_feature(cxx_lambdas))
349 #define _LIBCPP_HAS_NO_LAMBDAS
350 #endif
351
352 #if !(__has_feature(cxx_nullptr))
353 #define _LIBCPP_HAS_NO_NULLPTR
354 #endif
355
356 #if !(__has_feature(cxx_rvalue_references))
357 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
358 #endif
359
360 #if !(__has_feature(cxx_static_assert))
361 #define _LIBCPP_HAS_NO_STATIC_ASSERT
362 #endif
363
364 #if !(__has_feature(cxx_auto_type))
365 #define _LIBCPP_HAS_NO_AUTO_TYPE
366 #endif
367
368 #if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
369 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
370 #endif
371
372 #if !(__has_feature(cxx_variadic_templates))
373 #define _LIBCPP_HAS_NO_VARIADICS
374 #endif
375
376 #if !(__has_feature(cxx_trailing_return))
377 #define _LIBCPP_HAS_NO_TRAILING_RETURN
378 #endif
379
380 #if !(__has_feature(cxx_generalized_initializers))
381 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
382 #endif
383
384 #if __has_feature(is_base_of)
385 #  define _LIBCPP_HAS_IS_BASE_OF
386 #endif
387
388 #if __has_feature(is_final)
389 #  define _LIBCPP_HAS_IS_FINAL
390 #endif
391
392 // Objective-C++ features (opt-in)
393 #if __has_feature(objc_arc)
394 #define _LIBCPP_HAS_OBJC_ARC
395 #endif
396
397 #if __has_feature(objc_arc_weak)
398 #define _LIBCPP_HAS_OBJC_ARC_WEAK
399 #define _LIBCPP_HAS_NO_STRONG_ENUMS
400 #endif
401
402 #if !(__has_feature(cxx_constexpr))
403 #define _LIBCPP_HAS_NO_CONSTEXPR
404 #endif
405
406 #if !(__has_feature(cxx_relaxed_constexpr))
407 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
408 #endif
409
410 #if !(__has_feature(cxx_variable_templates))
411 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
412 #endif
413
414 #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
415 #if defined(__FreeBSD__)
416 #define _LIBCPP_HAS_QUICK_EXIT
417 #define _LIBCPP_HAS_C11_FEATURES
418 #elif defined(__ANDROID__)
419 #define _LIBCPP_HAS_QUICK_EXIT
420 #elif defined(__linux__)
421 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
422 # include <features.h>
423 #if __GLIBC_PREREQ(2, 15)
424 #define _LIBCPP_HAS_QUICK_EXIT
425 #endif
426 #if __GLIBC_PREREQ(2, 17)
427 #define _LIBCPP_HAS_C11_FEATURES
428 #endif
429 #else // defined(_LIBCPP_HAS_MUSL_LIBC)
430 #define _LIBCPP_HAS_QUICK_EXIT
431 #define _LIBCPP_HAS_C11_FEATURES
432 #endif
433 #endif // __linux__
434 #endif
435
436 #if !(__has_feature(cxx_noexcept))
437 #define _LIBCPP_HAS_NO_NOEXCEPT
438 #endif
439
440 #if __has_feature(underlying_type)
441 #  define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
442 #endif
443
444 #if __has_feature(is_literal)
445 #  define _LIBCPP_IS_LITERAL(T) __is_literal(T)
446 #endif
447
448 // Inline namespaces are available in Clang regardless of C++ dialect.
449 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
450 #define _LIBCPP_END_NAMESPACE_STD  } }
451 #define _VSTD std::_LIBCPP_NAMESPACE
452
453 namespace std {
454   inline namespace _LIBCPP_NAMESPACE {
455   }
456 }
457
458 #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
459 #define _LIBCPP_HAS_NO_ASAN
460 #endif
461
462 // Allow for build-time disabling of unsigned integer sanitization
463 #if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
464 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
465 #endif 
466
467 #elif defined(__GNUC__)
468
469 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
470 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
471
472 #define _LIBCPP_NORETURN __attribute__((noreturn))
473
474 #if _GNUC_VER >= 407
475 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
476 #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
477 #define _LIBCPP_HAS_IS_FINAL
478 #endif
479
480 #if defined(__GNUC__) && _GNUC_VER >= 403
481 #  define _LIBCPP_HAS_IS_BASE_OF
482 #endif
483
484 #if !__EXCEPTIONS
485 #define _LIBCPP_NO_EXCEPTIONS
486 #endif
487
488 // constexpr was added to GCC in 4.6.
489 #if _GNUC_VER < 406
490 #define _LIBCPP_HAS_NO_CONSTEXPR
491 // Can only use constexpr in c++11 mode.
492 #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
493 #define _LIBCPP_HAS_NO_CONSTEXPR
494 #endif
495
496 // Determine if GCC supports relaxed constexpr
497 #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
498 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
499 #endif
500
501 // GCC 5 will support variable templates
502 #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
503 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
504 #endif
505
506 #ifndef __GXX_EXPERIMENTAL_CXX0X__
507
508 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
509 #define _LIBCPP_HAS_NO_DECLTYPE
510 #define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
511 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
512 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
513 #define _LIBCPP_HAS_NO_NULLPTR
514 #define _LIBCPP_HAS_NO_STATIC_ASSERT
515 #define _LIBCPP_HAS_NO_UNICODE_CHARS
516 #define _LIBCPP_HAS_NO_VARIADICS
517 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
518 #define _LIBCPP_HAS_NO_STRONG_ENUMS
519 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
520 #define _LIBCPP_HAS_NO_NOEXCEPT
521
522 #else  // __GXX_EXPERIMENTAL_CXX0X__
523
524 #if _GNUC_VER < 403
525 #define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
526 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
527 #define _LIBCPP_HAS_NO_STATIC_ASSERT
528 #endif
529
530
531 #if _GNUC_VER < 404
532 #define _LIBCPP_HAS_NO_DECLTYPE
533 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
534 #define _LIBCPP_HAS_NO_TRAILING_RETURN
535 #define _LIBCPP_HAS_NO_UNICODE_CHARS
536 #define _LIBCPP_HAS_NO_VARIADICS
537 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
538 #endif  // _GNUC_VER < 404
539
540 #if _GNUC_VER < 406
541 #define _LIBCPP_HAS_NO_NOEXCEPT
542 #define _LIBCPP_HAS_NO_NULLPTR
543 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
544 #endif
545
546 #if _GNUC_VER < 407
547 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
548 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
549 #endif
550
551 #endif  // __GXX_EXPERIMENTAL_CXX0X__
552
553 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
554 #define _LIBCPP_END_NAMESPACE_STD  } }
555 #define _VSTD std::_LIBCPP_NAMESPACE
556
557 namespace std {
558 namespace _LIBCPP_NAMESPACE {
559 }
560 using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
561 }
562
563 #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
564 #define _LIBCPP_HAS_NO_ASAN
565 #endif
566
567 #elif defined(_LIBCPP_MSVC)
568
569 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
570 #define _LIBCPP_HAS_NO_CONSTEXPR
571 #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
572 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
573 #define _LIBCPP_HAS_NO_UNICODE_CHARS
574 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
575 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
576 #define _LIBCPP_HAS_NO_NOEXCEPT
577 #define __alignof__ __alignof
578 #define _LIBCPP_NORETURN __declspec(noreturn)
579 #define _ALIGNAS(x) __declspec(align(x))
580 #define _LIBCPP_HAS_NO_VARIADICS
581
582
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(__IBMCPP__)
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_DEFAULT_FUNCTION_TEMPLATE_ARGS
602 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
603 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
604 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
605 #define _LIBCPP_HAS_NO_NOEXCEPT
606 #define _LIBCPP_HAS_NO_NULLPTR
607 #define _LIBCPP_HAS_NO_UNICODE_CHARS
608 #define _LIBCPP_HAS_IS_BASE_OF
609 #define _LIBCPP_HAS_IS_FINAL
610 #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
611
612 #if defined(_AIX)
613 #define __MULTILOCALE_API
614 #endif
615
616 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
617 #define _LIBCPP_END_NAMESPACE_STD  } }
618 #define _VSTD std::_LIBCPP_NAMESPACE
619
620 namespace std {
621   inline namespace _LIBCPP_NAMESPACE {
622   }
623 }
624
625 #define _LIBCPP_HAS_NO_ASAN
626
627 #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
628
629 #ifndef _LIBCPP_HAS_NO_NOEXCEPT
630 #  define _NOEXCEPT noexcept
631 #  define _NOEXCEPT_(x) noexcept(x)
632 #else
633 #  define _NOEXCEPT throw()
634 #  define _NOEXCEPT_(x)
635 #endif
636
637 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
638 typedef unsigned short char16_t;
639 typedef unsigned int   char32_t;
640 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
641
642 #ifndef __SIZEOF_INT128__
643 #define _LIBCPP_HAS_NO_INT128
644 #endif
645
646 #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
647
648 extern "C++" {
649 template <bool> struct __static_assert_test;
650 template <> struct __static_assert_test<true> {};
651 template <unsigned> struct __static_assert_check {};
652 }
653 #define static_assert(__b, __m) \
654     typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
655     _LIBCPP_CONCAT(__t, __LINE__)
656
657 #endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
658
659 #ifdef _LIBCPP_HAS_NO_DECLTYPE
660 // GCC 4.6 provides __decltype in all standard modes.
661 #if !__is_identifier(__decltype) || _GNUC_VER >= 406
662 #  define decltype(__x) __decltype(__x)
663 #else
664 #  define decltype(__x) __typeof__(__x)
665 #endif
666 #endif
667
668 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
669 #define _LIBCPP_CONSTEXPR
670 #else
671 #define _LIBCPP_CONSTEXPR constexpr
672 #endif
673
674 #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
675 #define _LIBCPP_DEFAULT {}
676 #else
677 #define _LIBCPP_DEFAULT = default;
678 #endif
679
680 #ifdef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
681 #define _LIBCPP_EQUAL_DELETE
682 #else
683 #define _LIBCPP_EQUAL_DELETE = delete
684 #endif
685
686 #ifdef __GNUC__
687 #define _NOALIAS __attribute__((__malloc__))
688 #else
689 #define _NOALIAS
690 #endif
691
692 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
693 #   define _LIBCPP_EXPLICIT explicit
694 #else
695 #   define _LIBCPP_EXPLICIT
696 #endif
697
698 #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
699 #   define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
700 #endif
701
702 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
703 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
704 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
705     __lx __v_; \
706     _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
707     _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
708     _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
709     };
710 #else  // _LIBCPP_HAS_NO_STRONG_ENUMS
711 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
712 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
713 #endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
714
715 #ifdef _LIBCPP_DEBUG
716 #   if _LIBCPP_DEBUG == 0
717 #       define _LIBCPP_DEBUG_LEVEL 1
718 #   elif _LIBCPP_DEBUG == 1
719 #       define _LIBCPP_DEBUG_LEVEL 2
720 #   else
721 #       error Supported values for _LIBCPP_DEBUG are 0 and 1
722 #   endif
723 #   define _LIBCPP_EXTERN_TEMPLATE(...)
724 #endif
725
726 #ifndef _LIBCPP_EXTERN_TEMPLATE
727 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
728 #endif
729
730 #ifndef _LIBCPP_EXTERN_TEMPLATE2
731 #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
732 #endif
733
734 #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
735 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
736 #endif
737
738 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \
739     defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
740 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
741 #endif
742
743 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
744 // Most unix variants have catopen.  These are the specific ones that don't.
745 #if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
746 #define _LIBCPP_HAS_CATOPEN 1
747 #endif
748 #endif
749
750 #ifdef __FreeBSD__
751 #define _DECLARE_C99_LDBL_MATH 1
752 #endif
753
754 #if defined(__APPLE__) || defined(__FreeBSD__)
755 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
756 #endif
757
758 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
759 #define _LIBCPP_WCTYPE_IS_MASK
760 #endif
761
762 #ifndef _LIBCPP_STD_VER
763 #  if  __cplusplus <= 201103L
764 #    define _LIBCPP_STD_VER 11
765 #  elif __cplusplus <= 201402L
766 #    define _LIBCPP_STD_VER 14
767 #  else
768 #    define _LIBCPP_STD_VER 16  // current year, or date of c++17 ratification
769 #  endif
770 #endif  // _LIBCPP_STD_VER
771
772 #if _LIBCPP_STD_VER > 11
773 #define _LIBCPP_DEPRECATED [[deprecated]]
774 #else
775 #define _LIBCPP_DEPRECATED
776 #endif
777
778 #if _LIBCPP_STD_VER <= 11
779 #define _LIBCPP_EXPLICIT_AFTER_CXX11
780 #define _LIBCPP_DEPRECATED_AFTER_CXX11
781 #else
782 #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
783 #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
784 #endif
785
786 #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
787 #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
788 #else
789 #define _LIBCPP_CONSTEXPR_AFTER_CXX11
790 #endif
791
792 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
793 #define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
794 #else
795 #define _LIBCPP_CONSTEXPR_AFTER_CXX14
796 #endif
797
798 #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
799 #  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
800 #else
801 #  define _LIBCPP_EXPLICIT_MOVE(x) (x)
802 #endif
803
804 #ifndef _LIBCPP_HAS_NO_ASAN
805 extern "C" void __sanitizer_annotate_contiguous_container(
806   const void *, const void *, const void *, const void *);
807 #endif
808
809 // Try to find out if RTTI is disabled.
810 // g++ and cl.exe have RTTI on by default and define a macro when it is.
811 // g++ only defines the macro in 4.3.2 and onwards.
812 #if !defined(_LIBCPP_NO_RTTI)
813 #  if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
814    (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
815 #    define _LIBCPP_NO_RTTI
816 #  elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
817 #    define _LIBCPP_NO_RTTI
818 #  endif
819 #endif
820
821 #ifndef _LIBCPP_WEAK
822 #  define _LIBCPP_WEAK __attribute__((__weak__))
823 #endif
824
825 // Thread API
826 #if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
827 # if defined(__FreeBSD__) || \
828     defined(__NetBSD__) || \
829     defined(__linux__) || \
830     defined(__APPLE__) || \
831     defined(__CloudABI__) || \
832     defined(__sun__)
833 #  define _LIBCPP_HAS_THREAD_API_PTHREAD
834 # else
835 #  error "No thread API"
836 # endif // _LIBCPP_HAS_THREAD_API
837 #endif // _LIBCPP_HAS_NO_THREADS
838
839 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
840 #  error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
841          _LIBCPP_HAS_NO_THREADS is not defined.
842 #endif
843
844 #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
845 #  error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
846          _LIBCPP_HAS_NO_THREADS is defined.
847 #endif
848
849 // Systems that use capability-based security (FreeBSD with Capsicum,
850 // Nuxi CloudABI) may only provide local filesystem access (using *at()).
851 // Functions like open(), rename(), unlink() and stat() should not be
852 // used, as they attempt to access the global filesystem namespace.
853 #ifdef __CloudABI__
854 #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
855 #endif
856
857 // CloudABI is intended for running networked services. Processes do not
858 // have standard input and output channels.
859 #ifdef __CloudABI__
860 #define _LIBCPP_HAS_NO_STDIN
861 #define _LIBCPP_HAS_NO_STDOUT
862 #endif
863
864 #if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
865 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
866 #endif
867
868 // Thread-unsafe functions such as strtok(), mbtowc() and localtime()
869 // are not available.
870 #ifdef __CloudABI__
871 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
872 #endif
873
874 #if __has_feature(cxx_atomic) || __has_extension(c_atomic)
875 #define _LIBCPP_HAS_C_ATOMIC_IMP
876 #elif _GNUC_VER > 407
877 #define _LIBCPP_HAS_GCC_ATOMIC_IMP
878 #endif
879
880 #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
881      || defined(_LIBCPP_HAS_NO_THREADS)
882 #define _LIBCPP_HAS_NO_ATOMIC_HEADER
883 #endif
884
885 #ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
886 #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
887 #endif
888
889 #if __cplusplus < 201103L
890 #define _LIBCPP_CXX03_LANG
891 #else
892 #if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
893 #error Libc++ requires a feature complete C++11 compiler in C++11 or greater.
894 #endif
895 #endif
896
897 #if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \
898       && __has_attribute(acquire_capability))
899 #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
900 #endif
901
902 #endif // __cplusplus
903
904 #endif // _LIBCPP_CONFIG