blob: 31369c8fe3e1533706eb26992d3843bb200480ff [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===--------------------------- __config ---------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
6// This file is distributed under the University of Illinois Open Source
7// License. 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
30#endif
31
32#ifdef __BIG_ENDIAN__
33#if __BIG_ENDIAN__
34#define _LIBCPP_LITTLE_ENDIAN 0
35#define _LIBCPP_BIG_ENDIAN 1
36#endif
37#endif
38
David Chisnall3e13d4f2010-08-11 16:27:20 +000039#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
45# define _LIBCPP_LITTLE_ENDIAN 0
46# define _LIBCPP_BIG_ENDIAN 1
47# endif
48#endif
49
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000050#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
Howard Hinnantadff4892010-05-24 17:49:41 +000051# 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
59# error unable to determine endian
60# endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000061#endif
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
71#define _LIBCPP_HIDDEN
72#define _LIBCPP_VISIBLE
73#endif
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__((__always_inline__))
86
Howard Hinnant60a0a8e2010-08-10 20:48:29 +000087#if defined(__clang__)
88
89#if !(__has_feature(cxx_exceptions))
90#define _LIBCPP_NO_EXCEPTIONS
91#endif
92
Howard Hinnantd4444702010-08-11 17:04:31 +000093#if !(__has_feature(cxx_rtti))
94#define _LIBCPP_NO_RTTI
95#endif
96
Howard Hinnant60a0a8e2010-08-10 20:48:29 +000097#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
98#define _LIBCPP_HAS_NO_STRONG_USING
99#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
100
101#ifndef __GXX_EXPERIMENTAL_CXX0X__
102
103#define _LIBCPP_HAS_NO_DECLTYPE
104#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
105#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
106#define _LIBCPP_HAS_NO_NULLPTR
107#define _LIBCPP_HAS_NO_STATIC_ASSERT
108#define _LIBCPP_HAS_NO_UNICODE_CHARS
109#define _LIBCPP_HAS_NO_VARIADICS
110
111#else
112
113#if __has_feature(cxx_rvalue_references)
114#define _LIBCPP_MOVE
115#endif
116
117#if !(__has_feature(cxx_decltype))
118#define _LIBCPP_HAS_NO_DECLTYPE
119#endif
120
121#if !(__has_feature(cxx_deleted_functions))
122#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
123#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
124#endif
125
126#if !(__has_feature(cxx_nullptr))
127#define _LIBCPP_HAS_NO_NULLPTR
128#endif
129
130#if !(__has_feature(cxx_static_assert))
131#define _LIBCPP_HAS_NO_STATIC_ASSERT
132#endif
133
134#if !(__has_feature(cxx_variadic_templates))
135#define _LIBCPP_HAS_NO_VARIADICS
136#endif
137
138#endif
139
140#elif defined(__GNUC__)
141
142#if !__EXCEPTIONS
143#define _LIBCPP_NO_EXCEPTIONS
144#endif
145
146#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
147
148#ifndef __GXX_EXPERIMENTAL_CXX0X__
149
150#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
151#define _LIBCPP_HAS_NO_DECLTYPE
152#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
153#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
154#define _LIBCPP_HAS_NO_NULLPTR
155#define _LIBCPP_HAS_NO_STATIC_ASSERT
156#define _LIBCPP_HAS_NO_UNICODE_CHARS
157#define _LIBCPP_HAS_NO_VARIADICS
158
159#else
160
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000161#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
162#define _LIBCPP_MOVE
163#endif
164
165#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
166#define _LIBCPP_HAS_NO_STATIC_ASSERT
167#endif
168
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000169#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000170#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000171#define _LIBCPP_HAS_NO_DECLTYPE
172#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
173#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
174#define _LIBCPP_HAS_NO_UNICODE_CHARS
175#define _LIBCPP_HAS_NO_VARIADICS
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000176#endif
177
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000178#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
179#define _LIBCPP_HAS_NO_NULLPTR
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000180#endif
181
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000182#endif
183
184#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000185
186#ifdef _LIBCPP_HAS_NO_STRONG_USING
187#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
188#define _LIBCPP_END_NAMESPACE_STD }
189#define _STD std
190#else
191#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
192#define _LIBCPP_END_NAMESPACE_STD } }
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000193#define _STD std::_LIBCPP_NAMESPACE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000194
195namespace std {
196namespace _LIBCPP_NAMESPACE {
197}
198using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
199}
200
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000201#endif
202
203#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000204typedef unsigned short char16_t;
205typedef unsigned int char32_t;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000206#endif
207
208#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
209
210template <bool> struct __static_assert_test;
211template <> struct __static_assert_test<true> {};
212template <unsigned> struct __static_assert_check {};
213#define static_assert(__b, __m) \
214 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
215 _LIBCPP_CONCAT(__t, __LINE__)
216
217#endif
218
219#ifdef _LIBCPP_HAS_NO_DECLTYPE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000220#define decltype(x) __typeof__(x)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000221#endif
222
223#endif // _LIBCPP_CONFIG