blob: c3cf8c7b1b3d6619821653bfb1bc23bfd2c5c171 [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
93#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
94#define _LIBCPP_HAS_NO_STRONG_USING
95#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
96
97#ifndef __GXX_EXPERIMENTAL_CXX0X__
98
99#define _LIBCPP_HAS_NO_DECLTYPE
100#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
101#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
102#define _LIBCPP_HAS_NO_NULLPTR
103#define _LIBCPP_HAS_NO_STATIC_ASSERT
104#define _LIBCPP_HAS_NO_UNICODE_CHARS
105#define _LIBCPP_HAS_NO_VARIADICS
106
107#else
108
109#if __has_feature(cxx_rvalue_references)
110#define _LIBCPP_MOVE
111#endif
112
113#if !(__has_feature(cxx_decltype))
114#define _LIBCPP_HAS_NO_DECLTYPE
115#endif
116
117#if !(__has_feature(cxx_deleted_functions))
118#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
119#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
120#endif
121
122#if !(__has_feature(cxx_nullptr))
123#define _LIBCPP_HAS_NO_NULLPTR
124#endif
125
126#if !(__has_feature(cxx_static_assert))
127#define _LIBCPP_HAS_NO_STATIC_ASSERT
128#endif
129
130#if !(__has_feature(cxx_variadic_templates))
131#define _LIBCPP_HAS_NO_VARIADICS
132#endif
133
134#endif
135
136#elif defined(__GNUC__)
137
138#if !__EXCEPTIONS
139#define _LIBCPP_NO_EXCEPTIONS
140#endif
141
142#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
143
144#ifndef __GXX_EXPERIMENTAL_CXX0X__
145
146#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
147#define _LIBCPP_HAS_NO_DECLTYPE
148#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
149#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
150#define _LIBCPP_HAS_NO_NULLPTR
151#define _LIBCPP_HAS_NO_STATIC_ASSERT
152#define _LIBCPP_HAS_NO_UNICODE_CHARS
153#define _LIBCPP_HAS_NO_VARIADICS
154
155#else
156
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000157#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
158#define _LIBCPP_MOVE
159#endif
160
161#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
162#define _LIBCPP_HAS_NO_STATIC_ASSERT
163#endif
164
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000165#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000166#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000167#define _LIBCPP_HAS_NO_DECLTYPE
168#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
169#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
170#define _LIBCPP_HAS_NO_UNICODE_CHARS
171#define _LIBCPP_HAS_NO_VARIADICS
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000172#endif
173
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000174#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
175#define _LIBCPP_HAS_NO_NULLPTR
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000176#endif
177
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000178#endif
179
180#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000181
182#ifdef _LIBCPP_HAS_NO_STRONG_USING
183#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
184#define _LIBCPP_END_NAMESPACE_STD }
185#define _STD std
186#else
187#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
188#define _LIBCPP_END_NAMESPACE_STD } }
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000189#define _STD std::_LIBCPP_NAMESPACE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000190
191namespace std {
192namespace _LIBCPP_NAMESPACE {
193}
194using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
195}
196
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000197#endif
198
199#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000200typedef unsigned short char16_t;
201typedef unsigned int char32_t;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000202#endif
203
204#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
205
206template <bool> struct __static_assert_test;
207template <> struct __static_assert_test<true> {};
208template <unsigned> struct __static_assert_check {};
209#define static_assert(__b, __m) \
210 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
211 _LIBCPP_CONCAT(__t, __LINE__)
212
213#endif
214
215#ifdef _LIBCPP_HAS_NO_DECLTYPE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000216#define decltype(x) __typeof__(x)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000217#endif
218
219#endif // _LIBCPP_CONFIG