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#pragma GCC system_header
15
16#define _LIBCPP_VERSION 1000
17
18#define _LIBCPP_ABI_VERSION 1
19
20#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
21#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
22
23#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
24
25#ifdef __LITTLE_ENDIAN__
26#if __LITTLE_ENDIAN__
27#define _LIBCPP_LITTLE_ENDIAN 1
28#define _LIBCPP_BIG_ENDIAN    0
29#endif  // __LITTLE_ENDIAN__
30#endif  // __LITTLE_ENDIAN__
31
32#ifdef __BIG_ENDIAN__
33#if __BIG_ENDIAN__
34#define _LIBCPP_LITTLE_ENDIAN 0
35#define _LIBCPP_BIG_ENDIAN    1
36#endif  // __BIG_ENDIAN__
37#endif  // __BIG_ENDIAN__
38
39#ifdef __FreeBSD__
40# include <sys/endian.h>
41#  if _BYTE_ORDER == _LITTLE_ENDIAN
42#   define _LIBCPP_LITTLE_ENDIAN 1
43#   define _LIBCPP_BIG_ENDIAN    0
44# else  // _BYTE_ORDER == _LITTLE_ENDIAN
45#   define _LIBCPP_LITTLE_ENDIAN 0
46#   define _LIBCPP_BIG_ENDIAN    1
47# endif  // _BYTE_ORDER == _LITTLE_ENDIAN
48#endif  // __FreeBSD__
49
50#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
51# include <endian.h>
52# if __BYTE_ORDER == __LITTLE_ENDIAN
53#  define _LIBCPP_LITTLE_ENDIAN 1
54#  define _LIBCPP_BIG_ENDIAN    0
55# elif __BYTE_ORDER == __BIG_ENDIAN
56#  define _LIBCPP_LITTLE_ENDIAN 0
57#  define _LIBCPP_BIG_ENDIAN    1
58# else  // __BYTE_ORDER == __BIG_ENDIAN
59#  error unable to determine endian
60# endif
61#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
62
63#ifndef _LIBCPP_VISIBILITY_TAG
64#define _LIBCPP_VISIBILITY_TAG 1
65#endif
66
67#if _LIBCPP_VISIBILITY_TAG
68#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
69#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
70#else  // _LIBCPP_VISIBILITY_TAG
71#define _LIBCPP_HIDDEN
72#define _LIBCPP_VISIBLE
73#endif  // _LIBCPP_VISIBILITY_TAG
74
75#ifndef _LIBCPP_INLINE_VISIBILITY
76#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
77#endif
78
79#ifndef _LIBCPP_EXCEPTION_ABI
80#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
81#endif
82
83#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
84
85#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), __always_inline__))
86
87#if defined(__clang__)
88
89#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
90#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
91
92#ifndef __GXX_EXPERIMENTAL_CXX0X__
93#ifdef __linux__
94#define _LIBCPP_HAS_NO_UNICODE_CHARS
95#else
96typedef __char16_t char16_t;
97typedef __char32_t char32_t;
98#endif
99#endif
100
101#if !(__has_feature(cxx_exceptions))
102#define _LIBCPP_NO_EXCEPTIONS
103#endif
104
105#if !(__has_feature(cxx_rtti))
106#define _LIBCPP_NO_RTTI
107#endif
108
109#if !(__has_feature(cxx_decltype))
110#define _LIBCPP_HAS_NO_DECLTYPE
111#endif
112
113#if !(__has_feature(cxx_attributes))
114#define _LIBCPP_HAS_NO_ATTRIBUTES
115#endif
116
117#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
118
119#if !(__has_feature(cxx_deleted_functions))
120#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
121#endif  // !(__has_feature(cxx_deleted_functions))
122
123#if !(__has_feature(cxx_lambdas))
124#define _LIBCPP_HAS_NO_LAMBDAS
125#endif
126
127#if !(__has_feature(cxx_nullptr))
128#define _LIBCPP_HAS_NO_NULLPTR
129#endif
130
131#if !(__has_feature(cxx_rvalue_references))
132#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
133#endif
134
135#if !(__has_feature(cxx_static_assert))
136#define _LIBCPP_HAS_NO_STATIC_ASSERT
137#endif
138
139#if !(__has_feature(cxx_auto_type))
140#define _LIBCPP_HAS_NO_AUTO_TYPE
141#endif
142
143#if !(__has_feature(cxx_variadic_templates))
144#define _LIBCPP_HAS_NO_VARIADICS
145#endif
146
147#if !(__has_feature(cxx_trailing_return))
148#define _LIBCPP_HAS_NO_TRAILING_RETURN
149#endif
150
151// Inline namespaces are available in Clang regardless of C++ dialect.
152#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
153#define _LIBCPP_END_NAMESPACE_STD  } }
154#define _STD std::_LIBCPP_NAMESPACE
155
156namespace std {
157  inline namespace _LIBCPP_NAMESPACE {
158  }
159}
160
161#if !(__has_feature(cxx_constexpr))
162#define _LIBCPP_HAS_NO_CONSTEXPR
163#endif
164
165// end defined(__clang__)
166
167#elif defined(__GNUC__)
168
169#if !__EXCEPTIONS
170#define _LIBCPP_NO_EXCEPTIONS
171#endif
172
173#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
174#define _LIBCPP_HAS_NO_CONSTEXPR
175
176#ifndef __GXX_EXPERIMENTAL_CXX0X__
177
178#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
179#define _LIBCPP_HAS_NO_DECLTYPE
180#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
181#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
182#define _LIBCPP_HAS_NO_NULLPTR
183#define _LIBCPP_HAS_NO_STATIC_ASSERT
184#define _LIBCPP_HAS_NO_UNICODE_CHARS
185#define _LIBCPP_HAS_NO_VARIADICS
186#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
187
188#else  // __GXX_EXPERIMENTAL_CXX0X__
189
190#define _LIBCPP_HAS_NO_TRAILING_RETURN
191
192#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
193#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
194#endif
195
196#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
197#define _LIBCPP_HAS_NO_STATIC_ASSERT
198#endif
199
200#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
201#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
202#define _LIBCPP_HAS_NO_DECLTYPE
203#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
204#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
205#define _LIBCPP_HAS_NO_UNICODE_CHARS
206#define _LIBCPP_HAS_NO_VARIADICS
207#endif  // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
208
209#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
210#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
211#define _LIBCPP_HAS_NO_NULLPTR
212#endif
213
214#endif  // __GXX_EXPERIMENTAL_CXX0X__
215
216#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
217#define _LIBCPP_END_NAMESPACE_STD  } }
218#define _STD std::_LIBCPP_NAMESPACE
219
220namespace std {
221namespace _LIBCPP_NAMESPACE {
222}
223using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
224}
225
226#endif  // defined(__GNUC__)
227
228#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
229typedef unsigned short char16_t;
230typedef unsigned int   char32_t;
231#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
232
233#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
234
235template <bool> struct __static_assert_test;
236template <> struct __static_assert_test<true> {};
237template <unsigned> struct __static_assert_check {};
238#define static_assert(__b, __m) \
239    typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
240    _LIBCPP_CONCAT(__t, __LINE__)
241
242#endif  // _LIBCPP_HAS_NO_STATIC_ASSERT
243
244#ifdef _LIBCPP_HAS_NO_DECLTYPE
245#define decltype(x) __typeof__(x)
246#endif
247
248#ifdef _LIBCPP_HAS_NO_CONSTEXPR
249#define constexpr const
250#endif
251
252#ifndef __has_feature
253#define __has_feature(__x) 0
254#endif
255
256#endif  // _LIBCPP_CONFIG
257