11
11
#ifndef _LIBCPP_CONFIG
12
12
#define _LIBCPP_CONFIG
13
13
14
- #ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file
14
+ #if !defined( _MSC_VER) || defined(__clang__)
15
15
#pragma GCC system_header
16
16
#endif
17
17
56
56
# endif // __LONG_LONG_SUPPORTED
57
57
#endif // __FreeBSD__
58
58
59
+ #ifdef __NetBSD__
60
+ # include < sys/endian.h>
61
+ # if _BYTE_ORDER == _LITTLE_ENDIAN
62
+ # define _LIBCPP_LITTLE_ENDIAN 1
63
+ # define _LIBCPP_BIG_ENDIAN 0
64
+ # else // _BYTE_ORDER == _LITTLE_ENDIAN
65
+ # define _LIBCPP_LITTLE_ENDIAN 0
66
+ # define _LIBCPP_BIG_ENDIAN 1
67
+ # endif // _BYTE_ORDER == _LITTLE_ENDIAN
68
+ # define _LIBCPP_HAS_QUICK_EXIT
69
+ #endif // __NetBSD__
70
+
59
71
#ifdef _WIN32
60
72
# define _LIBCPP_LITTLE_ENDIAN 1
61
73
# define _LIBCPP_BIG_ENDIAN 0
62
74
// Compiler intrinsics (GCC or MSVC)
63
- # if (defined(_MSC_VER) && _MSC_VER >= 1400) \
75
+ # if defined(__clang__) \
76
+ || (defined(_MSC_VER) && _MSC_VER >= 1400 ) \
64
77
|| (defined(__GNUC__) && _GNUC_VER > 403 )
65
- # define _LIBCP_HAS_IS_BASE_OF
78
+ # define _LIBCPP_HAS_IS_BASE_OF
66
79
# endif
80
+ # if defined(_MSC_VER) && !defined(__clang__)
81
+ # define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
82
+ # endif
83
+ # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
67
84
#endif // _WIN32
68
85
69
86
#ifdef __linux__
70
87
# if defined(__GNUC__) && _GNUC_VER >= 403
71
- # define _LIBCP_HAS_IS_BASE_OF
88
+ # define _LIBCPP_HAS_IS_BASE_OF
72
89
# endif
73
90
#endif
74
91
116
133
#endif
117
134
118
135
#ifndef _LIBCPP_INLINE_VISIBILITY
119
- # ifdef _MSC_VER
136
+ # ifdef _LIBCPP_MSVC
120
137
# define _LIBCPP_INLINE_VISIBILITY __forceinline
121
138
# else // MinGW GCC and Clang
122
139
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
128
145
#endif
129
146
130
147
#ifndef _LIBCPP_ALWAYS_INLINE
131
- # ifdef _MSC_VER
148
+ # ifdef _LIBCPP_MSVC
132
149
# define _LIBCPP_ALWAYS_INLINE __forceinline
133
150
# endif
134
151
#endif
135
152
136
153
#endif // _WIN32
137
154
155
+ #ifndef __has_attribute
156
+ #define __has_attribute (__x ) 0
157
+ #endif
158
+
138
159
#ifndef _LIBCPP_HIDDEN
139
160
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__(" hidden" )))
140
161
#endif
@@ -212,7 +233,9 @@ typedef __char32_t char32_t;
212
233
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
213
234
#endif
214
235
236
+ #if !(__has_feature(cxx_defaulted_functions))
215
237
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
238
+ #endif // !(__has_feature(cxx_defaulted_functions))
216
239
217
240
#if !(__has_feature(cxx_deleted_functions))
218
241
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
@@ -255,7 +278,7 @@ typedef __char32_t char32_t;
255
278
#endif
256
279
257
280
#if __has_feature(is_base_of)
258
- # define _LIBCP_HAS_IS_BASE_OF
281
+ # define _LIBCPP_HAS_IS_BASE_OF
259
282
#endif
260
283
261
284
// Objective-C++ features (opt-in)
@@ -272,9 +295,19 @@ typedef __char32_t char32_t;
272
295
#define _LIBCPP_HAS_NO_CONSTEXPR
273
296
#endif
274
297
275
- #if defined(__FreeBSD__) && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
298
+ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
299
+ #if defined(__FreeBSD__)
276
300
#define _LIBCPP_HAS_QUICK_EXIT
277
301
#define _LIBCPP_HAS_C11_FEATURES
302
+ #elif defined(__linux__)
303
+ #include < features.h>
304
+ #if __GLIBC_PREREQ(2, 15)
305
+ #define _LIBCPP_HAS_QUICK_EXIT
306
+ #endif
307
+ #if __GLIBC_PREREQ(2, 17)
308
+ #define _LIBCPP_HAS_C11_FEATURES
309
+ #endif
310
+ #endif
278
311
#endif
279
312
280
313
#if (__has_feature(cxx_noexcept))
@@ -368,7 +401,7 @@ namespace _LIBCPP_NAMESPACE {
368
401
using namespace _LIBCPP_NAMESPACE __attribute__ ((__strong__));
369
402
}
370
403
371
- #elif defined(_MSC_VER )
404
+ #elif defined(_LIBCPP_MSVC )
372
405
373
406
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
374
407
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
@@ -390,7 +423,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
390
423
namespace std {
391
424
}
392
425
393
- #endif // __clang__ || __GNUC___ || _MSC_VER
426
+ #endif // __clang__ || __GNUC__ || _LIBCPP_MSVC
394
427
395
428
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
396
429
typedef unsigned short char16_t ;
@@ -418,8 +451,14 @@ template <unsigned> struct __static_assert_check {};
418
451
#define _LIBCPP_CONSTEXPR constexpr
419
452
#endif
420
453
454
+ #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
455
+ #define _LIBCPP_DEFAULT {}
456
+ #else
457
+ #define _LIBCPP_DEFAULT = default ;
458
+ #endif
459
+
421
460
#ifdef __GNUC__
422
- #define _NOALIAS __attribute__ ((malloc ))
461
+ #define _NOALIAS __attribute__ ((__malloc__ ))
423
462
#else
424
463
#define _NOALIAS
425
464
#endif
@@ -451,7 +490,7 @@ template <unsigned> struct __static_assert_check {};
451
490
#define _LIBCPP_EXTERN_TEMPLATE (...) extern template __VA_ARGS__;
452
491
#endif
453
492
454
- #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__)
493
+ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
455
494
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
456
495
#endif
457
496
#ifdef __FreeBSD__
@@ -476,10 +515,18 @@ template <unsigned> struct __static_assert_check {};
476
515
# endif
477
516
#endif
478
517
479
- #ifdef _LIBCPP_DEBUG2
480
- # include < __debug>
518
+ #ifndef _LIBCPP_STD_VER
519
+ # if __cplusplus <= 201103L
520
+ # define _LIBCPP_STD_VER 11
521
+ # else
522
+ # define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification
523
+ # endif
524
+ #endif // _LIBCPP_STD_VER
525
+
526
+ #if _LIBCPP_STD_VER <= 11
527
+ #define _LIBCPP_CONSTEXPR_AFTER_CXX11
481
528
#else
482
- # define _LIBCPP_ASSERT ( x, m ) (( void ) 0 )
529
+ #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
483
530
#endif
484
531
485
532
#endif // _LIBCPP_CONFIG
0 commit comments