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