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