]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libc++/include/__config
Merge OpenSSL 1.0.1e.
[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 !_MSC_VER // explicit macro necessary because it is only defined below in this file
15 #pragma GCC system_header
16 #endif
17
18 #ifdef __GNUC__
19 #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
20 #endif
21
22 #define _LIBCPP_VERSION 1101
23
24 #define _LIBCPP_ABI_VERSION 1
25
26 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
27 #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
28
29 #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
30
31 #ifdef __LITTLE_ENDIAN__
32 #if __LITTLE_ENDIAN__
33 #define _LIBCPP_LITTLE_ENDIAN 1
34 #define _LIBCPP_BIG_ENDIAN    0
35 #endif  // __LITTLE_ENDIAN__
36 #endif  // __LITTLE_ENDIAN__
37
38 #ifdef __BIG_ENDIAN__
39 #if __BIG_ENDIAN__
40 #define _LIBCPP_LITTLE_ENDIAN 0
41 #define _LIBCPP_BIG_ENDIAN    1
42 #endif  // __BIG_ENDIAN__
43 #endif  // __BIG_ENDIAN__
44
45 #ifdef __FreeBSD__
46 # include <sys/endian.h>
47 #  if _BYTE_ORDER == _LITTLE_ENDIAN
48 #   define _LIBCPP_LITTLE_ENDIAN 1
49 #   define _LIBCPP_BIG_ENDIAN    0
50 # else  // _BYTE_ORDER == _LITTLE_ENDIAN
51 #   define _LIBCPP_LITTLE_ENDIAN 0
52 #   define _LIBCPP_BIG_ENDIAN    1
53 # endif  // _BYTE_ORDER == _LITTLE_ENDIAN
54 # ifndef __LONG_LONG_SUPPORTED
55 #  define _LIBCPP_HAS_NO_LONG_LONG
56 # endif  // __LONG_LONG_SUPPORTED
57 #endif  // __FreeBSD__
58
59 #ifdef _WIN32
60 #  define _LIBCPP_LITTLE_ENDIAN 1
61 #  define _LIBCPP_BIG_ENDIAN    0
62 // Compiler intrinsics (GCC or MSVC)
63 #  if (defined(_MSC_VER) && _MSC_VER >= 1400) \
64    || (defined(__GNUC__) && _GNUC_VER > 403)
65 #    define _LIBCP_HAS_IS_BASE_OF
66 #  endif
67 #endif  // _WIN32
68
69 #ifdef __linux__
70 #  if defined(__GNUC__) && _GNUC_VER >= 403
71 #    define _LIBCP_HAS_IS_BASE_OF
72 #  endif
73 #endif
74
75 #ifdef __sun__
76 # include <sys/isa_defs.h>
77 # ifdef _LITTLE_ENDIAN
78 #   define _LIBCPP_LITTLE_ENDIAN 1
79 #   define _LIBCPP_BIG_ENDIAN    0
80 # else
81 #   define _LIBCPP_LITTLE_ENDIAN 0
82 #   define _LIBCPP_BIG_ENDIAN    1
83 # endif
84 #endif // __sun__
85
86 #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
87 # include <endian.h>
88 # if __BYTE_ORDER == __LITTLE_ENDIAN
89 #  define _LIBCPP_LITTLE_ENDIAN 1
90 #  define _LIBCPP_BIG_ENDIAN    0
91 # elif __BYTE_ORDER == __BIG_ENDIAN
92 #  define _LIBCPP_LITTLE_ENDIAN 0
93 #  define _LIBCPP_BIG_ENDIAN    1
94 # else  // __BYTE_ORDER == __BIG_ENDIAN
95 #  error unable to determine endian
96 # endif
97 #endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
98
99 #if _WIN32
100
101 // only really useful for a DLL
102 #ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
103 # ifdef cxx_EXPORTS
104 #  define _LIBCPP_HIDDEN
105 #  define _LIBCPP_VISIBLE __declspec(dllexport)
106 # else
107 #  define _LIBCPP_HIDDEN
108 #  define _LIBCPP_VISIBLE __declspec(dllimport)
109 # endif
110 #else
111 # define _LIBCPP_HIDDEN
112 # define _LIBCPP_VISIBLE
113 #endif
114
115 #ifndef _LIBCPP_INLINE_VISIBILITY
116 # if _MSC_VER
117 #  define _LIBCPP_INLINE_VISIBILITY __forceinline
118 # else // MinGW GCC and Clang
119 #  define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
120 # endif
121 #endif
122
123 #ifndef _LIBCPP_EXCEPTION_ABI
124 #define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
125 #endif
126
127 #ifndef _LIBCPP_ALWAYS_INLINE
128 # if _MSC_VER
129 #  define _LIBCPP_ALWAYS_INLINE __forceinline
130 # endif
131 #endif
132
133 #endif // _WIN32
134
135 #ifndef _LIBCPP_HIDDEN
136 #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
137 #endif
138
139 #ifndef _LIBCPP_VISIBLE
140 #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
141 #endif
142
143 #ifndef _LIBCPP_INLINE_VISIBILITY
144 #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
145 #endif
146
147 #ifndef _LIBCPP_EXCEPTION_ABI
148 #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
149 #endif
150
151 #ifndef _LIBCPP_CANTTHROW
152 #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
153 #endif
154
155 #ifndef _LIBCPP_ALWAYS_INLINE
156 #define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
157 #endif
158
159 #if defined(__clang__)
160
161 #if __has_feature(cxx_alignas)
162 #  define _ALIGNAS_TYPE(x) alignas(x)
163 #  define _ALIGNAS(x) alignas(x)
164 #else
165 #  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
166 #  define _ALIGNAS(x) __attribute__((__aligned__(x)))
167 #endif
168
169 #if !__has_feature(cxx_alias_templates)
170 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
171 #endif
172
173 #ifndef __GXX_EXPERIMENTAL_CXX0X__
174 #ifdef __linux__
175 #define _LIBCPP_HAS_NO_UNICODE_CHARS
176 #else
177 typedef __char16_t char16_t;
178 typedef __char32_t char32_t;
179 #endif
180 #endif
181
182 #if !(__has_feature(cxx_exceptions))
183 #define _LIBCPP_NO_EXCEPTIONS
184 #endif
185
186 #if !(__has_feature(cxx_rtti))
187 #define _LIBCPP_NO_RTTI
188 #endif
189
190 #if !(__has_feature(cxx_strong_enums))
191 #define _LIBCPP_HAS_NO_STRONG_ENUMS
192 #endif
193
194 #if !(__has_feature(cxx_decltype))
195 #define _LIBCPP_HAS_NO_DECLTYPE
196 #endif
197
198 #if __has_feature(cxx_attributes)
199 #  define _LIBCPP_NORETURN [[noreturn]]
200 #else
201 #  define _LIBCPP_NORETURN __attribute__ ((noreturn))
202 #endif
203
204 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
205
206 #if !(__has_feature(cxx_deleted_functions))
207 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
208 #endif  // !(__has_feature(cxx_deleted_functions))
209
210 #if !(__has_feature(cxx_lambdas))
211 #define _LIBCPP_HAS_NO_LAMBDAS
212 #endif
213
214 #if !(__has_feature(cxx_nullptr))
215 #define _LIBCPP_HAS_NO_NULLPTR
216 #endif
217
218 #if !(__has_feature(cxx_rvalue_references))
219 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
220 #endif
221
222 #if !(__has_feature(cxx_static_assert))
223 #define _LIBCPP_HAS_NO_STATIC_ASSERT
224 #endif
225
226 #if !(__has_feature(cxx_auto_type))
227 #define _LIBCPP_HAS_NO_AUTO_TYPE
228 #endif
229
230 #if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
231 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
232 #endif
233
234 #if !(__has_feature(cxx_variadic_templates))
235 #define _LIBCPP_HAS_NO_VARIADICS
236 #endif
237
238 #if !(__has_feature(cxx_trailing_return))
239 #define _LIBCPP_HAS_NO_TRAILING_RETURN
240 #endif
241
242 #if !(__has_feature(cxx_generalized_initializers))
243 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
244 #endif
245
246 #if __has_feature(is_base_of)
247 #  define _LIBCP_HAS_IS_BASE_OF
248 #endif
249
250 // Objective-C++ features (opt-in)
251 #if __has_feature(objc_arc)
252 #define _LIBCPP_HAS_OBJC_ARC
253 #endif
254
255 #if __has_feature(objc_arc_weak)
256 #define _LIBCPP_HAS_OBJC_ARC_WEAK
257 #define _LIBCPP_HAS_NO_STRONG_ENUMS
258 #endif
259
260 #if !(__has_feature(cxx_constexpr))
261 #define _LIBCPP_HAS_NO_CONSTEXPR
262 #endif
263
264 #if __FreeBSD__ && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
265 #define _LIBCPP_HAS_QUICK_EXIT
266 #define _LIBCPP_HAS_C11_FEATURES
267 #endif
268
269 #if (__has_feature(cxx_noexcept))
270 #  define _NOEXCEPT noexcept
271 #  define _NOEXCEPT_(x) noexcept(x)
272 #else
273 #  define _NOEXCEPT throw()
274 #  define _NOEXCEPT_(x)
275 #endif
276
277 #if __has_feature(underlying_type)
278 #  define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
279 #endif
280
281 // Inline namespaces are available in Clang regardless of C++ dialect.
282 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
283 #define _LIBCPP_END_NAMESPACE_STD  } }
284 #define _VSTD std::_LIBCPP_NAMESPACE
285
286 namespace std {
287   inline namespace _LIBCPP_NAMESPACE {
288   }
289 }
290
291 #elif defined(__GNUC__)
292
293 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
294 #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
295
296 #define _LIBCPP_NORETURN __attribute__((noreturn))
297
298 #if !__EXCEPTIONS
299 #define _LIBCPP_NO_EXCEPTIONS
300 #endif
301
302 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
303 #define _LIBCPP_HAS_NO_CONSTEXPR
304
305 #define _NOEXCEPT throw()
306 #define _NOEXCEPT_(x)
307
308 #ifndef __GXX_EXPERIMENTAL_CXX0X__
309
310 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
311 #define _LIBCPP_HAS_NO_DECLTYPE
312 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
313 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
314 #define _LIBCPP_HAS_NO_NULLPTR
315 #define _LIBCPP_HAS_NO_STATIC_ASSERT
316 #define _LIBCPP_HAS_NO_UNICODE_CHARS
317 #define _LIBCPP_HAS_NO_VARIADICS
318 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
319 #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
320
321 #else  // __GXX_EXPERIMENTAL_CXX0X__
322
323 #define _LIBCPP_HAS_NO_TRAILING_RETURN
324 #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
325
326 #if _GNUC_VER < 403
327 #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
328 #endif
329
330 #if _GNUC_VER < 403
331 #define _LIBCPP_HAS_NO_STATIC_ASSERT
332 #endif
333
334 #if _GNUC_VER < 404
335 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
336 #define _LIBCPP_HAS_NO_DECLTYPE
337 #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
338 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
339 #define _LIBCPP_HAS_NO_UNICODE_CHARS
340 #define _LIBCPP_HAS_NO_VARIADICS
341 #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
342 #endif  // _GNUC_VER < 404
343
344 #if _GNUC_VER < 406
345 #define _LIBCPP_HAS_NO_NULLPTR
346 #endif
347
348 #endif  // __GXX_EXPERIMENTAL_CXX0X__
349
350 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
351 #define _LIBCPP_END_NAMESPACE_STD  } }
352 #define _VSTD std::_LIBCPP_NAMESPACE
353
354 namespace std {
355 namespace _LIBCPP_NAMESPACE {
356 }
357 using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
358 }
359
360 #elif defined(_MSC_VER)
361
362 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
363 #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
364 #define _LIBCPP_HAS_NO_CONSTEXPR
365 #define _LIBCPP_HAS_NO_UNICODE_CHARS
366 #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
367 #define __alignof__ __alignof
368 #define _LIBCPP_NORETURN __declspec(noreturn)
369 #define _ALIGNAS(x) __declspec(align(x))
370 #define _LIBCPP_HAS_NO_VARIADICS
371
372 #define _NOEXCEPT throw()
373 #define _NOEXCEPT_(x)
374
375 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
376 #define _LIBCPP_END_NAMESPACE_STD  }
377 #define _VSTD std
378
379 namespace std {
380 }
381
382 #endif // __clang__ || __GNUC___ || _MSC_VER
383
384 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
385 typedef unsigned short char16_t;
386 typedef unsigned int   char32_t;
387 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
388
389 #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
390
391 template <bool> struct __static_assert_test;
392 template <> struct __static_assert_test<true> {};
393 template <unsigned> struct __static_assert_check {};
394 #define static_assert(__b, __m) \
395     typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
396     _LIBCPP_CONCAT(__t, __LINE__)
397
398 #endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
399
400 #ifdef _LIBCPP_HAS_NO_DECLTYPE
401 #define decltype(x) __typeof__(x)
402 #endif
403
404 #ifdef _LIBCPP_HAS_NO_CONSTEXPR
405 #define _LIBCPP_CONSTEXPR
406 #else
407 #define _LIBCPP_CONSTEXPR constexpr
408 #endif
409
410 #ifdef __GNUC__
411 #define _NOALIAS __attribute__((malloc))
412 #else
413 #define _NOALIAS
414 #endif
415
416 #ifndef __has_feature
417 #define __has_feature(__x) 0
418 #endif
419
420 #if __has_feature(cxx_explicit_conversions)
421 #   define _LIBCPP_EXPLICIT explicit
422 #else
423 #   define _LIBCPP_EXPLICIT
424 #endif
425
426 #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
427 #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum __lx
428 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
429     __lx __v_; \
430     _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
431     _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
432     _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
433     };
434 #else  // _LIBCPP_HAS_NO_STRONG_ENUMS
435 #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x
436 #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
437 #endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
438
439 #ifndef _LIBCPP_EXTERN_TEMPLATE
440 #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
441 #endif
442
443 #if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
444 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
445 #endif
446 #if __FreeBSD__
447 #define _DECLARE_C99_LDBL_MATH 1
448 #endif
449
450 #if __APPLE__ || __FreeBSD__
451 #define _LIBCPP_HAS_DEFAULTRUNELOCALE
452 #endif
453
454 #if __APPLE__ || __FreeBSD__ || __sun__
455 #define _LIBCPP_WCTYPE_IS_MASK
456 #endif
457
458 #ifdef _LIBCPP_DEBUG2
459 #   if _LIBCPP_DEBUG2 == 0
460 #       define _LIBCPP_DEBUG_LEVEL 1
461 #   elif _LIBCPP_DEBUG2 == 1
462 #       define _LIBCPP_DEBUG_LEVEL 2
463 #   else
464 #       error Supported values for _LIBCPP_DEBUG2 are 0 and 1
465 #   endif
466 #endif
467
468 #ifdef _LIBCPP_DEBUG2
469 #   include <__debug>
470 #else
471 #   define _LIBCPP_ASSERT(x, m) ((void)0)
472 #endif
473
474 #endif  // _LIBCPP_CONFIG