blob: 42797365b47f439f9ea204a9d817b82af84bae61 [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
39#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
Howard Hinnantadff4892010-05-24 17:49:41 +000040# include <endian.h>
41# if __BYTE_ORDER == __LITTLE_ENDIAN
42# define _LIBCPP_LITTLE_ENDIAN 1
43# define _LIBCPP_BIG_ENDIAN 0
44# elif __BYTE_ORDER == __BIG_ENDIAN
45# define _LIBCPP_LITTLE_ENDIAN 0
46# define _LIBCPP_BIG_ENDIAN 1
47# else
48# error unable to determine endian
49# endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000050#endif
51
52#ifndef _LIBCPP_VISIBILITY_TAG
53#define _LIBCPP_VISIBILITY_TAG 1
54#endif
55
56#if _LIBCPP_VISIBILITY_TAG
57#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
58#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
59#else
60#define _LIBCPP_HIDDEN
61#define _LIBCPP_VISIBLE
62#endif
63
64#ifndef _LIBCPP_INLINE_VISIBILITY
65#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
66#endif
67
68#ifndef _LIBCPP_EXCEPTION_ABI
69#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
70#endif
71
72#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
73
74#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
75
Howard Hinnant60a0a8e2010-08-10 20:48:29 +000076#if defined(__clang__)
77
78#if !(__has_feature(cxx_exceptions))
79#define _LIBCPP_NO_EXCEPTIONS
80#endif
81
82#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
83#define _LIBCPP_HAS_NO_STRONG_USING
84#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
85
86#ifndef __GXX_EXPERIMENTAL_CXX0X__
87
88#define _LIBCPP_HAS_NO_DECLTYPE
89#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
90#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
91#define _LIBCPP_HAS_NO_NULLPTR
92#define _LIBCPP_HAS_NO_STATIC_ASSERT
93#define _LIBCPP_HAS_NO_UNICODE_CHARS
94#define _LIBCPP_HAS_NO_VARIADICS
95
96#else
97
98#if __has_feature(cxx_rvalue_references)
99#define _LIBCPP_MOVE
100#endif
101
102#if !(__has_feature(cxx_decltype))
103#define _LIBCPP_HAS_NO_DECLTYPE
104#endif
105
106#if !(__has_feature(cxx_deleted_functions))
107#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
108#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
109#endif
110
111#if !(__has_feature(cxx_nullptr))
112#define _LIBCPP_HAS_NO_NULLPTR
113#endif
114
115#if !(__has_feature(cxx_static_assert))
116#define _LIBCPP_HAS_NO_STATIC_ASSERT
117#endif
118
119#if !(__has_feature(cxx_variadic_templates))
120#define _LIBCPP_HAS_NO_VARIADICS
121#endif
122
123#endif
124
125#elif defined(__GNUC__)
126
127#if !__EXCEPTIONS
128#define _LIBCPP_NO_EXCEPTIONS
129#endif
130
131#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
132
133#ifndef __GXX_EXPERIMENTAL_CXX0X__
134
135#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
136#define _LIBCPP_HAS_NO_DECLTYPE
137#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
138#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
139#define _LIBCPP_HAS_NO_NULLPTR
140#define _LIBCPP_HAS_NO_STATIC_ASSERT
141#define _LIBCPP_HAS_NO_UNICODE_CHARS
142#define _LIBCPP_HAS_NO_VARIADICS
143
144#else
145
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000146#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
147#define _LIBCPP_MOVE
148#endif
149
150#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
151#define _LIBCPP_HAS_NO_STATIC_ASSERT
152#endif
153
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000154#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000155#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000156#define _LIBCPP_HAS_NO_DECLTYPE
157#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
158#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
159#define _LIBCPP_HAS_NO_UNICODE_CHARS
160#define _LIBCPP_HAS_NO_VARIADICS
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000161#endif
162
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000163#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
164#define _LIBCPP_HAS_NO_NULLPTR
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000165#endif
166
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000167#endif
168
169#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000170
171#ifdef _LIBCPP_HAS_NO_STRONG_USING
172#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
173#define _LIBCPP_END_NAMESPACE_STD }
174#define _STD std
175#else
176#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
177#define _LIBCPP_END_NAMESPACE_STD } }
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000178#define _STD std::_LIBCPP_NAMESPACE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000179
180namespace std {
181namespace _LIBCPP_NAMESPACE {
182}
183using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
184}
185
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000186#endif
187
188#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
Howard Hinnant60a0a8e2010-08-10 20:48:29 +0000189typedef unsigned short char16_t;
190typedef unsigned int char32_t;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000191#endif
192
193#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
194
195template <bool> struct __static_assert_test;
196template <> struct __static_assert_test<true> {};
197template <unsigned> struct __static_assert_check {};
198#define static_assert(__b, __m) \
199 typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
200 _LIBCPP_CONCAT(__t, __LINE__)
201
202#endif
203
204#ifdef _LIBCPP_HAS_NO_DECLTYPE
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000205#define decltype(x) __typeof__(x)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000206#endif
207
208#endif // _LIBCPP_CONFIG