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