Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- __config ---------------------------------===// |
| 3 | // |
Howard Hinnant | c566dc3 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | ee11c31 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_CONFIG |
| 12 | #define _LIBCPP_CONFIG |
| 13 | |
Eric Fiselier | a80af82 | 2015-11-06 06:30:12 +0000 | [diff] [blame^] | 14 | #if defined(_MSC_VER) && !defined(__clang__) |
| 15 | #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
| 16 | #endif |
| 17 | |
| 18 | #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 19 | #pragma GCC system_header |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 20 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 21 | |
Eric Fiselier | a80af82 | 2015-11-06 06:30:12 +0000 | [diff] [blame^] | 22 | #ifdef __cplusplus |
| 23 | |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 24 | #ifdef __GNUC__ |
| 25 | #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) |
Eric Fiselier | 7d22317 | 2015-06-13 02:18:44 +0000 | [diff] [blame] | 26 | #else |
| 27 | #define _GNUC_VER 0 |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 28 | #endif |
| 29 | |
Marshall Clow | 955443b | 2015-07-17 16:36:44 +0000 | [diff] [blame] | 30 | #define _LIBCPP_VERSION 3800 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 31 | |
Evgeniy Stepanov | da2ff7e | 2015-10-13 23:48:28 +0000 | [diff] [blame] | 32 | #ifndef _LIBCPP_ABI_VERSION |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 33 | #define _LIBCPP_ABI_VERSION 1 |
Evgeniy Stepanov | da2ff7e | 2015-10-13 23:48:28 +0000 | [diff] [blame] | 34 | #endif |
| 35 | |
| 36 | #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 |
| 37 | #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT |
| 38 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 39 | |
| 40 | #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y |
| 41 | #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) |
| 42 | |
| 43 | #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) |
| 44 | |
Eric Fiselier | 86fcc92 | 2015-07-10 20:26:38 +0000 | [diff] [blame] | 45 | |
| 46 | #ifndef __has_attribute |
| 47 | #define __has_attribute(__x) 0 |
| 48 | #endif |
| 49 | #ifndef __has_builtin |
| 50 | #define __has_builtin(__x) 0 |
| 51 | #endif |
Eric Fiselier | 8020b6c | 2015-08-19 17:21:46 +0000 | [diff] [blame] | 52 | #ifndef __has_extension |
| 53 | #define __has_extension(__x) 0 |
| 54 | #endif |
Eric Fiselier | 86fcc92 | 2015-07-10 20:26:38 +0000 | [diff] [blame] | 55 | #ifndef __has_feature |
| 56 | #define __has_feature(__x) 0 |
| 57 | #endif |
| 58 | // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by |
| 59 | // the compiler and '1' otherwise. |
| 60 | #ifndef __is_identifier |
| 61 | #define __is_identifier(__x) 1 |
| 62 | #endif |
| 63 | |
| 64 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 65 | #ifdef __LITTLE_ENDIAN__ |
| 66 | #if __LITTLE_ENDIAN__ |
| 67 | #define _LIBCPP_LITTLE_ENDIAN 1 |
| 68 | #define _LIBCPP_BIG_ENDIAN 0 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 69 | #endif // __LITTLE_ENDIAN__ |
| 70 | #endif // __LITTLE_ENDIAN__ |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 71 | |
| 72 | #ifdef __BIG_ENDIAN__ |
| 73 | #if __BIG_ENDIAN__ |
| 74 | #define _LIBCPP_LITTLE_ENDIAN 0 |
| 75 | #define _LIBCPP_BIG_ENDIAN 1 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 76 | #endif // __BIG_ENDIAN__ |
| 77 | #endif // __BIG_ENDIAN__ |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 78 | |
Dan Albert | 98d9779 | 2015-09-16 18:10:47 +0000 | [diff] [blame] | 79 | #ifdef __BYTE_ORDER__ |
| 80 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
| 81 | #define _LIBCPP_LITTLE_ENDIAN 1 |
| 82 | #define _LIBCPP_BIG_ENDIAN 0 |
| 83 | #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 84 | #define _LIBCPP_LITTLE_ENDIAN 0 |
| 85 | #define _LIBCPP_BIG_ENDIAN 1 |
| 86 | #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 87 | #endif // __BYTE_ORDER__ |
| 88 | |
David Chisnall | 93008f0 | 2010-08-11 16:27:20 +0000 | [diff] [blame] | 89 | #ifdef __FreeBSD__ |
| 90 | # include <sys/endian.h> |
| 91 | # if _BYTE_ORDER == _LITTLE_ENDIAN |
| 92 | # define _LIBCPP_LITTLE_ENDIAN 1 |
| 93 | # define _LIBCPP_BIG_ENDIAN 0 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 94 | # else // _BYTE_ORDER == _LITTLE_ENDIAN |
David Chisnall | 93008f0 | 2010-08-11 16:27:20 +0000 | [diff] [blame] | 95 | # define _LIBCPP_LITTLE_ENDIAN 0 |
| 96 | # define _LIBCPP_BIG_ENDIAN 1 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 97 | # endif // _BYTE_ORDER == _LITTLE_ENDIAN |
Howard Hinnant | 1383035 | 2012-11-26 21:18:17 +0000 | [diff] [blame] | 98 | # ifndef __LONG_LONG_SUPPORTED |
| 99 | # define _LIBCPP_HAS_NO_LONG_LONG |
| 100 | # endif // __LONG_LONG_SUPPORTED |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 101 | #endif // __FreeBSD__ |
David Chisnall | 93008f0 | 2010-08-11 16:27:20 +0000 | [diff] [blame] | 102 | |
Joerg Sonnenberger | 153e416 | 2013-05-17 21:17:34 +0000 | [diff] [blame] | 103 | #ifdef __NetBSD__ |
| 104 | # include <sys/endian.h> |
| 105 | # if _BYTE_ORDER == _LITTLE_ENDIAN |
| 106 | # define _LIBCPP_LITTLE_ENDIAN 1 |
| 107 | # define _LIBCPP_BIG_ENDIAN 0 |
| 108 | # else // _BYTE_ORDER == _LITTLE_ENDIAN |
| 109 | # define _LIBCPP_LITTLE_ENDIAN 0 |
| 110 | # define _LIBCPP_BIG_ENDIAN 1 |
| 111 | # endif // _BYTE_ORDER == _LITTLE_ENDIAN |
| 112 | # define _LIBCPP_HAS_QUICK_EXIT |
| 113 | #endif // __NetBSD__ |
| 114 | |
Howard Hinnant | 34bad2a | 2011-05-13 17:16:06 +0000 | [diff] [blame] | 115 | #ifdef _WIN32 |
| 116 | # define _LIBCPP_LITTLE_ENDIAN 1 |
| 117 | # define _LIBCPP_BIG_ENDIAN 0 |
Eric Fiselier | f739430 | 2015-06-13 07:08:02 +0000 | [diff] [blame] | 118 | // Compiler intrinsics (MSVC) |
| 119 | #if defined(_MSC_VER) && _MSC_VER >= 1400 |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 120 | # define _LIBCPP_HAS_IS_BASE_OF |
Howard Hinnant | dd0d702 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 121 | # endif |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 122 | # if defined(_MSC_VER) && !defined(__clang__) |
| 123 | # define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler |
Howard Hinnant | 408927e | 2013-10-04 21:14:44 +0000 | [diff] [blame] | 124 | # define _LIBCPP_TOSTRING2(x) #x |
| 125 | # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) |
| 126 | # define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 127 | # endif |
Howard Hinnant | 8ad7091 | 2013-09-17 01:34:47 +0000 | [diff] [blame] | 128 | # // If mingw not explicitly detected, assume using MS C runtime only. |
| 129 | # ifndef __MINGW32__ |
| 130 | # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library |
| 131 | # endif |
Howard Hinnant | 34bad2a | 2011-05-13 17:16:06 +0000 | [diff] [blame] | 132 | #endif // _WIN32 |
| 133 | |
David Chisnall | 8074c34 | 2012-02-29 13:05:08 +0000 | [diff] [blame] | 134 | #ifdef __sun__ |
| 135 | # include <sys/isa_defs.h> |
| 136 | # ifdef _LITTLE_ENDIAN |
| 137 | # define _LIBCPP_LITTLE_ENDIAN 1 |
| 138 | # define _LIBCPP_BIG_ENDIAN 0 |
| 139 | # else |
| 140 | # define _LIBCPP_LITTLE_ENDIAN 0 |
| 141 | # define _LIBCPP_BIG_ENDIAN 1 |
| 142 | # endif |
| 143 | #endif // __sun__ |
| 144 | |
Ed Schouten | dcf3740 | 2015-03-10 07:46:06 +0000 | [diff] [blame] | 145 | #if defined(__CloudABI__) |
| 146 | // Certain architectures provide arc4random(). Prefer using |
| 147 | // arc4random() over /dev/{u,}random to make it possible to obtain |
| 148 | // random data even when using sandboxing mechanisms such as chroots, |
| 149 | // Capsicum, etc. |
| 150 | # define _LIBCPP_USING_ARC4_RANDOM |
| 151 | #elif defined(__native_client__) |
JF Bastien | d483203 | 2014-12-01 19:19:55 +0000 | [diff] [blame] | 152 | // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, |
| 153 | // including accesses to the special files under /dev. C++11's |
| 154 | // std::random_device is instead exposed through a NaCl syscall. |
| 155 | # define _LIBCPP_USING_NACL_RANDOM |
Ed Schouten | dcf3740 | 2015-03-10 07:46:06 +0000 | [diff] [blame] | 156 | #elif defined(_WIN32) |
| 157 | # define _LIBCPP_USING_WIN32_RANDOM |
| 158 | #else |
| 159 | # define _LIBCPP_USING_DEV_RANDOM |
| 160 | #endif |
JF Bastien | d483203 | 2014-12-01 19:19:55 +0000 | [diff] [blame] | 161 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 162 | #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) |
Howard Hinnant | 155c2af | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 163 | # include <endian.h> |
| 164 | # if __BYTE_ORDER == __LITTLE_ENDIAN |
| 165 | # define _LIBCPP_LITTLE_ENDIAN 1 |
| 166 | # define _LIBCPP_BIG_ENDIAN 0 |
| 167 | # elif __BYTE_ORDER == __BIG_ENDIAN |
| 168 | # define _LIBCPP_LITTLE_ENDIAN 0 |
| 169 | # define _LIBCPP_BIG_ENDIAN 1 |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 170 | # else // __BYTE_ORDER == __BIG_ENDIAN |
Howard Hinnant | 155c2af | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 171 | # error unable to determine endian |
| 172 | # endif |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 173 | #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 174 | |
Marshall Clow | 1f25732 | 2013-03-18 17:04:29 +0000 | [diff] [blame] | 175 | #ifdef _WIN32 |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 176 | |
| 177 | // only really useful for a DLL |
| 178 | #ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally... |
| 179 | # ifdef cxx_EXPORTS |
| 180 | # define _LIBCPP_HIDDEN |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 181 | # define _LIBCPP_FUNC_VIS __declspec(dllexport) |
| 182 | # define _LIBCPP_TYPE_VIS __declspec(dllexport) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 183 | # else |
| 184 | # define _LIBCPP_HIDDEN |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 185 | # define _LIBCPP_FUNC_VIS __declspec(dllimport) |
| 186 | # define _LIBCPP_TYPE_VIS __declspec(dllimport) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 187 | # endif |
| 188 | #else |
| 189 | # define _LIBCPP_HIDDEN |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 190 | # define _LIBCPP_FUNC_VIS |
| 191 | # define _LIBCPP_TYPE_VIS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 192 | #endif |
| 193 | |
Howard Hinnant | a37d3cf | 2013-08-12 18:38:34 +0000 | [diff] [blame] | 194 | #define _LIBCPP_TYPE_VIS_ONLY |
| 195 | #define _LIBCPP_FUNC_VIS_ONLY |
| 196 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 197 | #ifndef _LIBCPP_INLINE_VISIBILITY |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 198 | # ifdef _LIBCPP_MSVC |
Howard Hinnant | 2aa7ad4 | 2011-10-20 12:49:21 +0000 | [diff] [blame] | 199 | # define _LIBCPP_INLINE_VISIBILITY __forceinline |
| 200 | # else // MinGW GCC and Clang |
| 201 | # define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) |
| 202 | # endif |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 203 | #endif |
| 204 | |
| 205 | #ifndef _LIBCPP_EXCEPTION_ABI |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 206 | #define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 207 | #endif |
| 208 | |
| 209 | #ifndef _LIBCPP_ALWAYS_INLINE |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 210 | # ifdef _LIBCPP_MSVC |
Howard Hinnant | 2aa7ad4 | 2011-10-20 12:49:21 +0000 | [diff] [blame] | 211 | # define _LIBCPP_ALWAYS_INLINE __forceinline |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 212 | # endif |
| 213 | #endif |
| 214 | |
| 215 | #endif // _WIN32 |
| 216 | |
| 217 | #ifndef _LIBCPP_HIDDEN |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 218 | #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 219 | #endif |
| 220 | |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 221 | #ifndef _LIBCPP_FUNC_VIS |
| 222 | #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) |
| 223 | #endif |
| 224 | |
| 225 | #ifndef _LIBCPP_TYPE_VIS |
Howard Hinnant | 59f7301 | 2013-11-13 00:39:22 +0000 | [diff] [blame] | 226 | # if __has_attribute(__type_visibility__) |
Howard Hinnant | 411d2c5 | 2013-03-07 19:25:03 +0000 | [diff] [blame] | 227 | # define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) |
| 228 | # else |
| 229 | # define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) |
| 230 | # endif |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 231 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 232 | |
Howard Hinnant | a37d3cf | 2013-08-12 18:38:34 +0000 | [diff] [blame] | 233 | #ifndef _LIBCPP_TYPE_VIS_ONLY |
| 234 | # define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS |
| 235 | #endif |
| 236 | |
| 237 | #ifndef _LIBCPP_FUNC_VIS_ONLY |
| 238 | # define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS |
| 239 | #endif |
| 240 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 241 | #ifndef _LIBCPP_INLINE_VISIBILITY |
| 242 | #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) |
| 243 | #endif |
| 244 | |
| 245 | #ifndef _LIBCPP_EXCEPTION_ABI |
Howard Hinnant | d889383 | 2013-12-04 21:03:23 +0000 | [diff] [blame] | 246 | #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 247 | #endif |
| 248 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 249 | #ifndef _LIBCPP_ALWAYS_INLINE |
Howard Hinnant | cf82332 | 2010-12-17 14:46:43 +0000 | [diff] [blame] | 250 | #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 251 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 252 | |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 253 | #if defined(__clang__) |
| 254 | |
Evgeniy Stepanov | da2ff7e | 2015-10-13 23:48:28 +0000 | [diff] [blame] | 255 | // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for |
| 256 | // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility. |
| 257 | #if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ |
| 258 | !defined(__arm__)) || \ |
| 259 | defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) |
| 260 | #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT |
Tim Northover | ffc9593 | 2014-03-30 11:34:22 +0000 | [diff] [blame] | 261 | #endif |
| 262 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 263 | #if __has_feature(cxx_alignas) |
Howard Hinnant | 62cad69 | 2012-05-31 19:31:14 +0000 | [diff] [blame] | 264 | # define _ALIGNAS_TYPE(x) alignas(x) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 265 | # define _ALIGNAS(x) alignas(x) |
| 266 | #else |
Howard Hinnant | 076b28c | 2012-05-31 20:14:00 +0000 | [diff] [blame] | 267 | # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 268 | # define _ALIGNAS(x) __attribute__((__aligned__(x))) |
| 269 | #endif |
| 270 | |
Howard Hinnant | e13b584 | 2011-05-26 19:07:54 +0000 | [diff] [blame] | 271 | #if !__has_feature(cxx_alias_templates) |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 272 | #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
Howard Hinnant | e13b584 | 2011-05-26 19:07:54 +0000 | [diff] [blame] | 273 | #endif |
Howard Hinnant | 8e6a398 | 2010-09-07 20:31:18 +0000 | [diff] [blame] | 274 | |
Marshall Clow | 2b12c31 | 2014-02-22 15:13:48 +0000 | [diff] [blame] | 275 | #if __cplusplus < 201103L |
Howard Hinnant | 31cd14f | 2010-09-16 23:27:26 +0000 | [diff] [blame] | 276 | typedef __char16_t char16_t; |
| 277 | typedef __char32_t char32_t; |
Howard Hinnant | 8e6a398 | 2010-09-07 20:31:18 +0000 | [diff] [blame] | 278 | #endif |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 279 | |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 280 | #if !(__has_feature(cxx_exceptions)) |
| 281 | #define _LIBCPP_NO_EXCEPTIONS |
| 282 | #endif |
| 283 | |
Howard Hinnant | 72f7358 | 2010-08-11 17:04:31 +0000 | [diff] [blame] | 284 | #if !(__has_feature(cxx_rtti)) |
| 285 | #define _LIBCPP_NO_RTTI |
| 286 | #endif |
| 287 | |
Howard Hinnant | 09bc0c9 | 2011-12-02 19:36:40 +0000 | [diff] [blame] | 288 | #if !(__has_feature(cxx_strong_enums)) |
| 289 | #define _LIBCPP_HAS_NO_STRONG_ENUMS |
| 290 | #endif |
| 291 | |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 292 | #if !(__has_feature(cxx_decltype)) |
| 293 | #define _LIBCPP_HAS_NO_DECLTYPE |
| 294 | #endif |
| 295 | |
Howard Hinnant | 8df9629 | 2011-05-26 17:07:32 +0000 | [diff] [blame] | 296 | #if __has_feature(cxx_attributes) |
Richard Smith | cabd392 | 2012-07-26 02:04:22 +0000 | [diff] [blame] | 297 | # define _LIBCPP_NORETURN [[noreturn]] |
Howard Hinnant | 8df9629 | 2011-05-26 17:07:32 +0000 | [diff] [blame] | 298 | #else |
Richard Smith | cabd392 | 2012-07-26 02:04:22 +0000 | [diff] [blame] | 299 | # define _LIBCPP_NORETURN __attribute__ ((noreturn)) |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 300 | #endif |
| 301 | |
Dimitry Andric | 5785d60 | 2015-02-05 07:40:48 +0000 | [diff] [blame] | 302 | #define _LIBCPP_UNUSED __attribute__((__unused__)) |
| 303 | |
Howard Hinnant | 3d28422 | 2013-05-02 20:18:43 +0000 | [diff] [blame] | 304 | #if !(__has_feature(cxx_defaulted_functions)) |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 305 | #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
Howard Hinnant | 3d28422 | 2013-05-02 20:18:43 +0000 | [diff] [blame] | 306 | #endif // !(__has_feature(cxx_defaulted_functions)) |
Howard Hinnant | 642b34a | 2010-09-29 18:13:54 +0000 | [diff] [blame] | 307 | |
| 308 | #if !(__has_feature(cxx_deleted_functions)) |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 309 | #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 310 | #endif // !(__has_feature(cxx_deleted_functions)) |
| 311 | |
| 312 | #if !(__has_feature(cxx_lambdas)) |
| 313 | #define _LIBCPP_HAS_NO_LAMBDAS |
| 314 | #endif |
| 315 | |
| 316 | #if !(__has_feature(cxx_nullptr)) |
| 317 | #define _LIBCPP_HAS_NO_NULLPTR |
| 318 | #endif |
| 319 | |
| 320 | #if !(__has_feature(cxx_rvalue_references)) |
| 321 | #define _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 322 | #endif |
| 323 | |
| 324 | #if !(__has_feature(cxx_static_assert)) |
| 325 | #define _LIBCPP_HAS_NO_STATIC_ASSERT |
| 326 | #endif |
| 327 | |
| 328 | #if !(__has_feature(cxx_auto_type)) |
| 329 | #define _LIBCPP_HAS_NO_AUTO_TYPE |
Howard Hinnant | 986832c | 2011-07-29 21:35:53 +0000 | [diff] [blame] | 330 | #endif |
| 331 | |
Howard Hinnant | df937d0 | 2011-07-31 17:10:44 +0000 | [diff] [blame] | 332 | #if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return) |
Howard Hinnant | 68d1339 | 2011-05-11 20:19:40 +0000 | [diff] [blame] | 333 | #define _LIBCPP_HAS_NO_ADVANCED_SFINAE |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 334 | #endif |
| 335 | |
| 336 | #if !(__has_feature(cxx_variadic_templates)) |
| 337 | #define _LIBCPP_HAS_NO_VARIADICS |
| 338 | #endif |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 339 | |
Howard Hinnant | 9e9eb95 | 2010-11-16 21:10:23 +0000 | [diff] [blame] | 340 | #if !(__has_feature(cxx_trailing_return)) |
| 341 | #define _LIBCPP_HAS_NO_TRAILING_RETURN |
| 342 | #endif |
| 343 | |
Howard Hinnant | 3371179 | 2011-08-12 21:56:02 +0000 | [diff] [blame] | 344 | #if !(__has_feature(cxx_generalized_initializers)) |
| 345 | #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS |
| 346 | #endif |
| 347 | |
Howard Hinnant | dd0d702 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 348 | #if __has_feature(is_base_of) |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 349 | # define _LIBCPP_HAS_IS_BASE_OF |
Howard Hinnant | dd0d702 | 2011-09-22 19:10:18 +0000 | [diff] [blame] | 350 | #endif |
| 351 | |
Eric Fiselier | f739430 | 2015-06-13 07:08:02 +0000 | [diff] [blame] | 352 | #if __has_feature(is_final) |
| 353 | # define _LIBCPP_HAS_IS_FINAL |
| 354 | #endif |
| 355 | |
Douglas Gregor | 1303444 | 2011-06-22 22:17:44 +0000 | [diff] [blame] | 356 | // Objective-C++ features (opt-in) |
| 357 | #if __has_feature(objc_arc) |
| 358 | #define _LIBCPP_HAS_OBJC_ARC |
| 359 | #endif |
| 360 | |
| 361 | #if __has_feature(objc_arc_weak) |
| 362 | #define _LIBCPP_HAS_OBJC_ARC_WEAK |
Howard Hinnant | 09bc0c9 | 2011-12-02 19:36:40 +0000 | [diff] [blame] | 363 | #define _LIBCPP_HAS_NO_STRONG_ENUMS |
Douglas Gregor | 1303444 | 2011-06-22 22:17:44 +0000 | [diff] [blame] | 364 | #endif |
| 365 | |
Howard Hinnant | 62c8c0b | 2010-09-06 19:10:31 +0000 | [diff] [blame] | 366 | #if !(__has_feature(cxx_constexpr)) |
| 367 | #define _LIBCPP_HAS_NO_CONSTEXPR |
| 368 | #endif |
| 369 | |
Eric Fiselier | b4c0c66 | 2014-07-17 05:16:18 +0000 | [diff] [blame] | 370 | #if !(__has_feature(cxx_relaxed_constexpr)) |
| 371 | #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR |
| 372 | #endif |
| 373 | |
Marshall Clow | faae698 | 2015-03-17 15:30:22 +0000 | [diff] [blame] | 374 | #if !(__has_feature(cxx_variable_templates)) |
| 375 | #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES |
| 376 | #endif |
| 377 | |
David Blaikie | 97ab002 | 2013-05-13 21:53:44 +0000 | [diff] [blame] | 378 | #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L |
| 379 | #if defined(__FreeBSD__) |
David Chisnall | 277ad05 | 2012-03-14 14:10:37 +0000 | [diff] [blame] | 380 | #define _LIBCPP_HAS_QUICK_EXIT |
Howard Hinnant | cabc5a2 | 2012-10-13 18:03:53 +0000 | [diff] [blame] | 381 | #define _LIBCPP_HAS_C11_FEATURES |
Marshall Clow | 3477ec9 | 2014-07-10 15:20:28 +0000 | [diff] [blame] | 382 | #elif defined(__ANDROID__) |
| 383 | #define _LIBCPP_HAS_QUICK_EXIT |
David Blaikie | 97ab002 | 2013-05-13 21:53:44 +0000 | [diff] [blame] | 384 | #elif defined(__linux__) |
| 385 | #include <features.h> |
| 386 | #if __GLIBC_PREREQ(2, 15) |
| 387 | #define _LIBCPP_HAS_QUICK_EXIT |
| 388 | #endif |
| 389 | #if __GLIBC_PREREQ(2, 17) |
| 390 | #define _LIBCPP_HAS_C11_FEATURES |
| 391 | #endif |
| 392 | #endif |
David Chisnall | 277ad05 | 2012-03-14 14:10:37 +0000 | [diff] [blame] | 393 | #endif |
| 394 | |
Howard Hinnant | 68d1339 | 2011-05-11 20:19:40 +0000 | [diff] [blame] | 395 | #if (__has_feature(cxx_noexcept)) |
| 396 | # define _NOEXCEPT noexcept |
| 397 | # define _NOEXCEPT_(x) noexcept(x) |
Marshall Clow | 0869d9f | 2014-01-03 18:21:14 +0000 | [diff] [blame] | 398 | # define _NOEXCEPT_OR_FALSE(x) noexcept(x) |
Howard Hinnant | 68d1339 | 2011-05-11 20:19:40 +0000 | [diff] [blame] | 399 | #else |
| 400 | # define _NOEXCEPT throw() |
| 401 | # define _NOEXCEPT_(x) |
Marshall Clow | 0869d9f | 2014-01-03 18:21:14 +0000 | [diff] [blame] | 402 | # define _NOEXCEPT_OR_FALSE(x) false |
Howard Hinnant | 68d1339 | 2011-05-11 20:19:40 +0000 | [diff] [blame] | 403 | #endif |
| 404 | |
Alexis Hunt | 43b6e8e | 2011-07-18 18:37:21 +0000 | [diff] [blame] | 405 | #if __has_feature(underlying_type) |
Marshall Clow | 2072352 | 2014-06-26 01:07:56 +0000 | [diff] [blame] | 406 | # define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) |
| 407 | #endif |
| 408 | |
| 409 | #if __has_feature(is_literal) |
| 410 | # define _LIBCPP_IS_LITERAL(T) __is_literal(T) |
Alexis Hunt | 43b6e8e | 2011-07-18 18:37:21 +0000 | [diff] [blame] | 411 | #endif |
| 412 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 413 | // Inline namespaces are available in Clang regardless of C++ dialect. |
| 414 | #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { |
| 415 | #define _LIBCPP_END_NAMESPACE_STD } } |
| 416 | #define _VSTD std::_LIBCPP_NAMESPACE |
| 417 | |
| 418 | namespace std { |
| 419 | inline namespace _LIBCPP_NAMESPACE { |
| 420 | } |
| 421 | } |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 422 | |
Marshall Clow | 90fc047 | 2014-04-14 15:44:57 +0000 | [diff] [blame] | 423 | #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) |
| 424 | #define _LIBCPP_HAS_NO_ASAN |
| 425 | #endif |
| 426 | |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 427 | #elif defined(__GNUC__) |
| 428 | |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 429 | #define _ALIGNAS(x) __attribute__((__aligned__(x))) |
Howard Hinnant | 67f7517 | 2012-08-19 17:14:47 +0000 | [diff] [blame] | 430 | #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 431 | |
Richard Smith | cabd392 | 2012-07-26 02:04:22 +0000 | [diff] [blame] | 432 | #define _LIBCPP_NORETURN __attribute__((noreturn)) |
Howard Hinnant | 1e570a3 | 2011-05-31 13:13:49 +0000 | [diff] [blame] | 433 | |
Dimitry Andric | 5785d60 | 2015-02-05 07:40:48 +0000 | [diff] [blame] | 434 | #define _LIBCPP_UNUSED __attribute__((__unused__)) |
| 435 | |
Marshall Clow | 2072352 | 2014-06-26 01:07:56 +0000 | [diff] [blame] | 436 | #if _GNUC_VER >= 407 |
| 437 | #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) |
| 438 | #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) |
Eric Fiselier | f739430 | 2015-06-13 07:08:02 +0000 | [diff] [blame] | 439 | #define _LIBCPP_HAS_IS_FINAL |
| 440 | #endif |
| 441 | |
| 442 | #if defined(__GNUC__) && _GNUC_VER >= 403 |
| 443 | # define _LIBCPP_HAS_IS_BASE_OF |
Marshall Clow | 2072352 | 2014-06-26 01:07:56 +0000 | [diff] [blame] | 444 | #endif |
| 445 | |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 446 | #if !__EXCEPTIONS |
| 447 | #define _LIBCPP_NO_EXCEPTIONS |
| 448 | #endif |
| 449 | |
| 450 | #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
Nico Weber | d04e475 | 2014-06-04 15:46:56 +0000 | [diff] [blame] | 451 | |
| 452 | // constexpr was added to GCC in 4.6. |
| 453 | #if _GNUC_VER < 406 |
Howard Hinnant | 62c8c0b | 2010-09-06 19:10:31 +0000 | [diff] [blame] | 454 | #define _LIBCPP_HAS_NO_CONSTEXPR |
Nico Weber | d04e475 | 2014-06-04 15:46:56 +0000 | [diff] [blame] | 455 | // Can only use constexpr in c++11 mode. |
| 456 | #elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L |
| 457 | #define _LIBCPP_HAS_NO_CONSTEXPR |
| 458 | #endif |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 459 | |
Marshall Clow | e2be633 | 2015-10-20 07:37:11 +0000 | [diff] [blame] | 460 | // Determine if GCC supports relaxed constexpr |
| 461 | #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L |
Eric Fiselier | b4c0c66 | 2014-07-17 05:16:18 +0000 | [diff] [blame] | 462 | #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR |
Marshall Clow | e2be633 | 2015-10-20 07:37:11 +0000 | [diff] [blame] | 463 | #endif |
| 464 | |
Marshall Clow | faae698 | 2015-03-17 15:30:22 +0000 | [diff] [blame] | 465 | // GCC 5 will support variable templates |
| 466 | #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES |
Eric Fiselier | b4c0c66 | 2014-07-17 05:16:18 +0000 | [diff] [blame] | 467 | |
Howard Hinnant | 68d1339 | 2011-05-11 20:19:40 +0000 | [diff] [blame] | 468 | #define _NOEXCEPT throw() |
| 469 | #define _NOEXCEPT_(x) |
Marshall Clow | 0869d9f | 2014-01-03 18:21:14 +0000 | [diff] [blame] | 470 | #define _NOEXCEPT_OR_FALSE(x) false |
Howard Hinnant | 68d1339 | 2011-05-11 20:19:40 +0000 | [diff] [blame] | 471 | |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 472 | #ifndef __GXX_EXPERIMENTAL_CXX0X__ |
| 473 | |
| 474 | #define _LIBCPP_HAS_NO_ADVANCED_SFINAE |
| 475 | #define _LIBCPP_HAS_NO_DECLTYPE |
| 476 | #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 477 | #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 478 | #define _LIBCPP_HAS_NO_NULLPTR |
| 479 | #define _LIBCPP_HAS_NO_STATIC_ASSERT |
| 480 | #define _LIBCPP_HAS_NO_UNICODE_CHARS |
| 481 | #define _LIBCPP_HAS_NO_VARIADICS |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 482 | #define _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 8b24e86 | 2011-04-21 14:29:59 +0000 | [diff] [blame] | 483 | #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS |
Logan Chien | 5eb2ac4 | 2013-12-14 06:44:09 +0000 | [diff] [blame] | 484 | #define _LIBCPP_HAS_NO_STRONG_ENUMS |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 485 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 486 | #else // __GXX_EXPERIMENTAL_CXX0X__ |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 487 | |
Howard Hinnant | 9e9eb95 | 2010-11-16 21:10:23 +0000 | [diff] [blame] | 488 | #define _LIBCPP_HAS_NO_TRAILING_RETURN |
Howard Hinnant | 8b24e86 | 2011-04-21 14:29:59 +0000 | [diff] [blame] | 489 | #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS |
Howard Hinnant | 9e9eb95 | 2010-11-16 21:10:23 +0000 | [diff] [blame] | 490 | |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 491 | #if _GNUC_VER < 403 |
Howard Hinnant | 74279a5 | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 492 | #define _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 493 | #endif |
| 494 | |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 495 | #if _GNUC_VER < 403 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 496 | #define _LIBCPP_HAS_NO_STATIC_ASSERT |
| 497 | #endif |
| 498 | |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 499 | #if _GNUC_VER < 404 |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 500 | #define _LIBCPP_HAS_NO_DECLTYPE |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 501 | #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
| 502 | #define _LIBCPP_HAS_NO_UNICODE_CHARS |
| 503 | #define _LIBCPP_HAS_NO_VARIADICS |
Howard Hinnant | 3371179 | 2011-08-12 21:56:02 +0000 | [diff] [blame] | 504 | #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 505 | #endif // _GNUC_VER < 404 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 506 | |
Howard Hinnant | cafe717 | 2012-10-03 20:48:05 +0000 | [diff] [blame] | 507 | #if _GNUC_VER < 406 |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 508 | #define _LIBCPP_HAS_NO_NULLPTR |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 509 | #endif |
| 510 | |
Yaron Keren | 45ada6c | 2013-11-22 09:22:12 +0000 | [diff] [blame] | 511 | #if _GNUC_VER < 407 |
| 512 | #define _LIBCPP_HAS_NO_ADVANCED_SFINAE |
| 513 | #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 514 | #endif |
| 515 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 516 | #endif // __GXX_EXPERIMENTAL_CXX0X__ |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 517 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 518 | #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { |
| 519 | #define _LIBCPP_END_NAMESPACE_STD } } |
Howard Hinnant | b1ad5a8 | 2011-06-30 21:18:19 +0000 | [diff] [blame] | 520 | #define _VSTD std::_LIBCPP_NAMESPACE |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 521 | |
| 522 | namespace std { |
| 523 | namespace _LIBCPP_NAMESPACE { |
| 524 | } |
| 525 | using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); |
| 526 | } |
| 527 | |
Marshall Clow | 90fc047 | 2014-04-14 15:44:57 +0000 | [diff] [blame] | 528 | #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) |
| 529 | #define _LIBCPP_HAS_NO_ASAN |
| 530 | #endif |
| 531 | |
Howard Hinnant | 13d8bc1 | 2013-08-01 18:17:34 +0000 | [diff] [blame] | 532 | #elif defined(_LIBCPP_MSVC) |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 533 | |
Howard Hinnant | bf07402 | 2011-10-22 20:59:45 +0000 | [diff] [blame] | 534 | #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 535 | #define _LIBCPP_HAS_NO_CONSTEXPR |
Eric Fiselier | b4c0c66 | 2014-07-17 05:16:18 +0000 | [diff] [blame] | 536 | #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR |
Marshall Clow | faae698 | 2015-03-17 15:30:22 +0000 | [diff] [blame] | 537 | #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 538 | #define _LIBCPP_HAS_NO_UNICODE_CHARS |
| 539 | #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS |
Howard Hinnant | 7908cde | 2013-08-24 21:31:37 +0000 | [diff] [blame] | 540 | #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 541 | #define __alignof__ __alignof |
Richard Smith | cabd392 | 2012-07-26 02:04:22 +0000 | [diff] [blame] | 542 | #define _LIBCPP_NORETURN __declspec(noreturn) |
Dimitry Andric | 5785d60 | 2015-02-05 07:40:48 +0000 | [diff] [blame] | 543 | #define _LIBCPP_UNUSED |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 544 | #define _ALIGNAS(x) __declspec(align(x)) |
| 545 | #define _LIBCPP_HAS_NO_VARIADICS |
| 546 | |
Yaron Keren | c40b537 | 2014-02-13 14:02:28 +0000 | [diff] [blame] | 547 | #define _NOEXCEPT throw () |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 548 | #define _NOEXCEPT_(x) |
Marshall Clow | 0869d9f | 2014-01-03 18:21:14 +0000 | [diff] [blame] | 549 | #define _NOEXCEPT_OR_FALSE(x) false |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 550 | |
| 551 | #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { |
| 552 | #define _LIBCPP_END_NAMESPACE_STD } |
| 553 | #define _VSTD std |
| 554 | |
Howard Hinnant | 33f0472 | 2013-10-04 23:56:37 +0000 | [diff] [blame] | 555 | # define _LIBCPP_WEAK |
Howard Hinnant | aaaa52b | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 556 | namespace std { |
| 557 | } |
| 558 | |
Marshall Clow | 90fc047 | 2014-04-14 15:44:57 +0000 | [diff] [blame] | 559 | #define _LIBCPP_HAS_NO_ASAN |
| 560 | |
Howard Hinnant | ea38295 | 2013-08-14 18:00:20 +0000 | [diff] [blame] | 561 | #elif defined(__IBMCPP__) |
| 562 | |
| 563 | #define _ALIGNAS(x) __attribute__((__aligned__(x))) |
| 564 | #define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x)))) |
| 565 | #define _ATTRIBUTE(x) __attribute__((x)) |
| 566 | #define _LIBCPP_NORETURN __attribute__((noreturn)) |
Dimitry Andric | 5785d60 | 2015-02-05 07:40:48 +0000 | [diff] [blame] | 567 | #define _LIBCPP_UNUSED |
Howard Hinnant | ea38295 | 2013-08-14 18:00:20 +0000 | [diff] [blame] | 568 | |
| 569 | #define _NOEXCEPT throw() |
| 570 | #define _NOEXCEPT_(x) |
Marshall Clow | 0869d9f | 2014-01-03 18:21:14 +0000 | [diff] [blame] | 571 | #define _NOEXCEPT_OR_FALSE(x) false |
Howard Hinnant | ea38295 | 2013-08-14 18:00:20 +0000 | [diff] [blame] | 572 | |
| 573 | #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
| 574 | #define _LIBCPP_HAS_NO_ADVANCED_SFINAE |
| 575 | #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS |
| 576 | #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS |
| 577 | #define _LIBCPP_HAS_NO_NULLPTR |
| 578 | #define _LIBCPP_HAS_NO_UNICODE_CHARS |
Howard Hinnant | ea38295 | 2013-08-14 18:00:20 +0000 | [diff] [blame] | 579 | #define _LIBCPP_HAS_IS_BASE_OF |
Eric Fiselier | f739430 | 2015-06-13 07:08:02 +0000 | [diff] [blame] | 580 | #define _LIBCPP_HAS_IS_FINAL |
Marshall Clow | faae698 | 2015-03-17 15:30:22 +0000 | [diff] [blame] | 581 | #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES |
Howard Hinnant | ea38295 | 2013-08-14 18:00:20 +0000 | [diff] [blame] | 582 | |
| 583 | #if defined(_AIX) |
| 584 | #define __MULTILOCALE_API |
| 585 | #endif |
| 586 | |
| 587 | #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { |
| 588 | #define _LIBCPP_END_NAMESPACE_STD } } |
| 589 | #define _VSTD std::_LIBCPP_NAMESPACE |
| 590 | |
| 591 | namespace std { |
| 592 | inline namespace _LIBCPP_NAMESPACE { |
| 593 | } |
| 594 | } |
| 595 | |
Marshall Clow | 90fc047 | 2014-04-14 15:44:57 +0000 | [diff] [blame] | 596 | #define _LIBCPP_HAS_NO_ASAN |
| 597 | |
Marshall Clow | 9083d64 | 2014-01-06 15:23:02 +0000 | [diff] [blame] | 598 | #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 599 | |
| 600 | #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS |
Howard Hinnant | aa87c0f | 2010-08-10 20:48:29 +0000 | [diff] [blame] | 601 | typedef unsigned short char16_t; |
| 602 | typedef unsigned int char32_t; |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 603 | #endif // _LIBCPP_HAS_NO_UNICODE_CHARS |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 604 | |
Stephan Tolksdorf | 0efeb6c | 2014-03-26 19:45:52 +0000 | [diff] [blame] | 605 | #ifndef __SIZEOF_INT128__ |
| 606 | #define _LIBCPP_HAS_NO_INT128 |
| 607 | #endif |
| 608 | |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 609 | #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT |
| 610 | |
Richard Smith | 7f0d648 | 2015-10-13 23:12:22 +0000 | [diff] [blame] | 611 | extern "C++" { |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 612 | template <bool> struct __static_assert_test; |
| 613 | template <> struct __static_assert_test<true> {}; |
| 614 | template <unsigned> struct __static_assert_check {}; |
Richard Smith | 7f0d648 | 2015-10-13 23:12:22 +0000 | [diff] [blame] | 615 | } |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 616 | #define static_assert(__b, __m) \ |
| 617 | typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ |
| 618 | _LIBCPP_CONCAT(__t, __LINE__) |
| 619 | |
Howard Hinnant | 3b6579a | 2010-08-22 00:02:43 +0000 | [diff] [blame] | 620 | #endif // _LIBCPP_HAS_NO_STATIC_ASSERT |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 621 | |
| 622 | #ifdef _LIBCPP_HAS_NO_DECLTYPE |
Eric Fiselier | 86fcc92 | 2015-07-10 20:26:38 +0000 | [diff] [blame] | 623 | // GCC 4.6 provides __decltype in all standard modes. |
| 624 | #if !__is_identifier(__decltype) || _GNUC_VER >= 406 |
Eric Fiselier | 1ac5484 | 2015-06-13 06:27:17 +0000 | [diff] [blame] | 625 | # define decltype(__x) __decltype(__x) |
| 626 | #else |
| 627 | # define decltype(__x) __typeof__(__x) |
| 628 | #endif |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 629 | #endif |
| 630 | |
Howard Hinnant | 62c8c0b | 2010-09-06 19:10:31 +0000 | [diff] [blame] | 631 | #ifdef _LIBCPP_HAS_NO_CONSTEXPR |
Howard Hinnant | 664183b | 2012-04-02 00:40:41 +0000 | [diff] [blame] | 632 | #define _LIBCPP_CONSTEXPR |
| 633 | #else |
| 634 | #define _LIBCPP_CONSTEXPR constexpr |
Howard Hinnant | 62c8c0b | 2010-09-06 19:10:31 +0000 | [diff] [blame] | 635 | #endif |
| 636 | |
Howard Hinnant | 3d28422 | 2013-05-02 20:18:43 +0000 | [diff] [blame] | 637 | #ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS |
| 638 | #define _LIBCPP_DEFAULT {} |
| 639 | #else |
| 640 | #define _LIBCPP_DEFAULT = default; |
| 641 | #endif |
| 642 | |
Nuno Lopes | 22df2dc | 2012-06-28 16:47:34 +0000 | [diff] [blame] | 643 | #ifdef __GNUC__ |
Joerg Sonnenberger | 4944e0b | 2013-04-29 19:52:08 +0000 | [diff] [blame] | 644 | #define _NOALIAS __attribute__((__malloc__)) |
Nuno Lopes | 22df2dc | 2012-06-28 16:47:34 +0000 | [diff] [blame] | 645 | #else |
| 646 | #define _NOALIAS |
| 647 | #endif |
| 648 | |
Marshall Clow | d03f2c8 | 2013-11-19 19:16:03 +0000 | [diff] [blame] | 649 | #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) |
Howard Hinnant | 86a291f | 2012-02-21 21:46:43 +0000 | [diff] [blame] | 650 | # define _LIBCPP_EXPLICIT explicit |
| 651 | #else |
| 652 | # define _LIBCPP_EXPLICIT |
| 653 | #endif |
| 654 | |
Richard Smith | 1f1c147 | 2014-06-04 19:54:15 +0000 | [diff] [blame] | 655 | #if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete) |
| 656 | # define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE |
| 657 | #endif |
| 658 | |
Howard Hinnant | 09bc0c9 | 2011-12-02 19:36:40 +0000 | [diff] [blame] | 659 | #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 660 | #define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx |
Howard Hinnant | 09bc0c9 | 2011-12-02 19:36:40 +0000 | [diff] [blame] | 661 | #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ |
Howard Hinnant | 49e145e | 2012-10-30 19:06:59 +0000 | [diff] [blame] | 662 | __lx __v_; \ |
| 663 | _LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \ |
| 664 | _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ |
Howard Hinnant | 09bc0c9 | 2011-12-02 19:36:40 +0000 | [diff] [blame] | 665 | _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \ |
| 666 | }; |
| 667 | #else // _LIBCPP_HAS_NO_STRONG_ENUMS |
Howard Hinnant | 8331b76 | 2013-03-06 23:30:19 +0000 | [diff] [blame] | 668 | #define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x |
Howard Hinnant | 09bc0c9 | 2011-12-02 19:36:40 +0000 | [diff] [blame] | 669 | #define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) |
| 670 | #endif // _LIBCPP_HAS_NO_STRONG_ENUMS |
| 671 | |
Howard Hinnant | 6148a9b | 2013-08-23 20:10:18 +0000 | [diff] [blame] | 672 | #ifdef _LIBCPP_DEBUG |
| 673 | # if _LIBCPP_DEBUG == 0 |
Howard Hinnant | 8ea9824 | 2013-08-23 17:37:05 +0000 | [diff] [blame] | 674 | # define _LIBCPP_DEBUG_LEVEL 1 |
Howard Hinnant | 6148a9b | 2013-08-23 20:10:18 +0000 | [diff] [blame] | 675 | # elif _LIBCPP_DEBUG == 1 |
Howard Hinnant | 8ea9824 | 2013-08-23 17:37:05 +0000 | [diff] [blame] | 676 | # define _LIBCPP_DEBUG_LEVEL 2 |
| 677 | # else |
Howard Hinnant | 6148a9b | 2013-08-23 20:10:18 +0000 | [diff] [blame] | 678 | # error Supported values for _LIBCPP_DEBUG are 0 and 1 |
Howard Hinnant | 8ea9824 | 2013-08-23 17:37:05 +0000 | [diff] [blame] | 679 | # endif |
| 680 | # define _LIBCPP_EXTERN_TEMPLATE(...) |
| 681 | #endif |
| 682 | |
Howard Hinnant | 862ca99 | 2012-11-06 21:08:48 +0000 | [diff] [blame] | 683 | #ifndef _LIBCPP_EXTERN_TEMPLATE |
Justin Bogner | 67105aa | 2014-08-15 17:58:56 +0000 | [diff] [blame] | 684 | #define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; |
Howard Hinnant | 862ca99 | 2012-11-06 21:08:48 +0000 | [diff] [blame] | 685 | #endif |
| 686 | |
Howard Hinnant | 8ea9824 | 2013-08-23 17:37:05 +0000 | [diff] [blame] | 687 | #ifndef _LIBCPP_EXTERN_TEMPLATE2 |
| 688 | #define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__; |
| 689 | #endif |
| 690 | |
Tim Northover | 0528f50 | 2014-03-30 14:59:12 +0000 | [diff] [blame] | 691 | #if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__) |
Tim Northover | a4fb462 | 2014-03-30 11:34:26 +0000 | [diff] [blame] | 692 | #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63) |
| 693 | #endif |
| 694 | |
Ed Schouten | 13eb7dc | 2015-03-10 09:26:38 +0000 | [diff] [blame] | 695 | #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || \ |
| 696 | defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) |
Alexis Hunt | 1adf2aa | 2011-07-15 05:40:33 +0000 | [diff] [blame] | 697 | #define _LIBCPP_LOCALE__L_EXTENSIONS 1 |
| 698 | #endif |
Yaron Keren | 804da95 | 2013-12-20 13:19:45 +0000 | [diff] [blame] | 699 | |
Ed Schouten | 118b603 | 2015-03-11 16:39:36 +0000 | [diff] [blame] | 700 | #if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION) && \ |
| 701 | !defined(__CloudABI__) |
| 702 | #define _LIBCPP_HAS_CATOPEN 1 |
| 703 | #endif |
| 704 | |
Marshall Clow | 82378c0 | 2013-03-18 19:34:07 +0000 | [diff] [blame] | 705 | #ifdef __FreeBSD__ |
David Chisnall | 6ae8f35 | 2011-11-13 17:15:33 +0000 | [diff] [blame] | 706 | #define _DECLARE_C99_LDBL_MATH 1 |
| 707 | #endif |
Alexis Hunt | 1adf2aa | 2011-07-15 05:40:33 +0000 | [diff] [blame] | 708 | |
Marshall Clow | 82378c0 | 2013-03-18 19:34:07 +0000 | [diff] [blame] | 709 | #if defined(__APPLE__) || defined(__FreeBSD__) |
Howard Hinnant | f312e3e | 2011-09-28 23:39:33 +0000 | [diff] [blame] | 710 | #define _LIBCPP_HAS_DEFAULTRUNELOCALE |
Alexis Hunt | 5a4dd56 | 2011-07-09 01:09:31 +0000 | [diff] [blame] | 711 | #endif |
| 712 | |
Marshall Clow | 82378c0 | 2013-03-18 19:34:07 +0000 | [diff] [blame] | 713 | #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) |
Alexis Hunt | c2017f1 | 2011-07-09 03:40:04 +0000 | [diff] [blame] | 714 | #define _LIBCPP_WCTYPE_IS_MASK |
| 715 | #endif |
| 716 | |
Howard Hinnant | a5a4cb6 | 2013-11-14 22:52:25 +0000 | [diff] [blame] | 717 | #ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR |
| 718 | # define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1 |
| 719 | #endif |
| 720 | |
Howard Hinnant | df7d11e | 2013-05-07 20:16:13 +0000 | [diff] [blame] | 721 | #ifndef _LIBCPP_STD_VER |
| 722 | # if __cplusplus <= 201103L |
| 723 | # define _LIBCPP_STD_VER 11 |
Marshall Clow | 348694e | 2014-06-06 22:31:09 +0000 | [diff] [blame] | 724 | # elif __cplusplus <= 201402L |
| 725 | # define _LIBCPP_STD_VER 14 |
Howard Hinnant | df7d11e | 2013-05-07 20:16:13 +0000 | [diff] [blame] | 726 | # else |
Marshall Clow | 348694e | 2014-06-06 22:31:09 +0000 | [diff] [blame] | 727 | # define _LIBCPP_STD_VER 15 // current year, or date of c++17 ratification |
Howard Hinnant | df7d11e | 2013-05-07 20:16:13 +0000 | [diff] [blame] | 728 | # endif |
| 729 | #endif // _LIBCPP_STD_VER |
| 730 | |
Marshall Clow | a2cbe0d | 2013-09-28 18:35:31 +0000 | [diff] [blame] | 731 | #if _LIBCPP_STD_VER > 11 |
| 732 | #define _LIBCPP_DEPRECATED [[deprecated]] |
| 733 | #else |
| 734 | #define _LIBCPP_DEPRECATED |
| 735 | #endif |
| 736 | |
Marshall Clow | 1045cee | 2013-07-15 14:57:19 +0000 | [diff] [blame] | 737 | #if _LIBCPP_STD_VER <= 11 |
Marshall Clow | ccaa0fb | 2013-08-27 20:18:59 +0000 | [diff] [blame] | 738 | #define _LIBCPP_EXPLICIT_AFTER_CXX11 |
Marshall Clow | a2cbe0d | 2013-09-28 18:35:31 +0000 | [diff] [blame] | 739 | #define _LIBCPP_DEPRECATED_AFTER_CXX11 |
Marshall Clow | 1045cee | 2013-07-15 14:57:19 +0000 | [diff] [blame] | 740 | #else |
Marshall Clow | ccaa0fb | 2013-08-27 20:18:59 +0000 | [diff] [blame] | 741 | #define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit |
Marshall Clow | a2cbe0d | 2013-09-28 18:35:31 +0000 | [diff] [blame] | 742 | #define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]] |
Marshall Clow | 1045cee | 2013-07-15 14:57:19 +0000 | [diff] [blame] | 743 | #endif |
| 744 | |
Eric Fiselier | b4c0c66 | 2014-07-17 05:16:18 +0000 | [diff] [blame] | 745 | #if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) |
| 746 | #define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr |
| 747 | #else |
| 748 | #define _LIBCPP_CONSTEXPR_AFTER_CXX11 |
| 749 | #endif |
| 750 | |
Dimitry Andric | 830fb60 | 2015-08-19 06:43:33 +0000 | [diff] [blame] | 751 | #ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
| 752 | # define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x) |
| 753 | #else |
| 754 | # define _LIBCPP_EXPLICIT_MOVE(x) (x) |
| 755 | #endif |
| 756 | |
Marshall Clow | 2cd9d37 | 2014-05-08 14:14:06 +0000 | [diff] [blame] | 757 | #ifndef _LIBCPP_HAS_NO_ASAN |
| 758 | extern "C" void __sanitizer_annotate_contiguous_container( |
| 759 | const void *, const void *, const void *, const void *); |
| 760 | #endif |
| 761 | |
Howard Hinnant | 1308788 | 2013-10-04 21:24:21 +0000 | [diff] [blame] | 762 | // Try to find out if RTTI is disabled. |
| 763 | // g++ and cl.exe have RTTI on by default and define a macro when it is. |
| 764 | // g++ only defines the macro in 4.3.2 and onwards. |
| 765 | #if !defined(_LIBCPP_NO_RTTI) |
Marshall Clow | b63146c | 2015-09-22 21:58:30 +0000 | [diff] [blame] | 766 | # if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \ |
Alexey Volkov | 51353fd | 2014-09-03 14:30:39 +0000 | [diff] [blame] | 767 | (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI) |
Howard Hinnant | 1308788 | 2013-10-04 21:24:21 +0000 | [diff] [blame] | 768 | # define _LIBCPP_NO_RTTI |
| 769 | # elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI) |
| 770 | # define _LIBCPP_NO_RTTI |
| 771 | # endif |
| 772 | #endif |
| 773 | |
Howard Hinnant | 33f0472 | 2013-10-04 23:56:37 +0000 | [diff] [blame] | 774 | #ifndef _LIBCPP_WEAK |
| 775 | # define _LIBCPP_WEAK __attribute__((__weak__)) |
| 776 | #endif |
| 777 | |
Eric Fiselier | 715b416 | 2014-12-06 20:09:11 +0000 | [diff] [blame] | 778 | #if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) |
| 779 | # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ |
| 780 | _LIBCPP_HAS_NO_THREADS is defined. |
| 781 | #endif |
| 782 | |
Ed Schouten | 7009f4e | 2015-03-12 15:44:39 +0000 | [diff] [blame] | 783 | // Systems that use capability-based security (FreeBSD with Capsicum, |
| 784 | // Nuxi CloudABI) may only provide local filesystem access (using *at()). |
| 785 | // Functions like open(), rename(), unlink() and stat() should not be |
| 786 | // used, as they attempt to access the global filesystem namespace. |
| 787 | #ifdef __CloudABI__ |
| 788 | #define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE |
| 789 | #endif |
| 790 | |
Ed Schouten | 3a75c0b | 2015-03-26 14:35:46 +0000 | [diff] [blame] | 791 | // CloudABI is intended for running networked services. Processes do not |
| 792 | // have standard input and output channels. |
| 793 | #ifdef __CloudABI__ |
| 794 | #define _LIBCPP_HAS_NO_STDIN |
| 795 | #define _LIBCPP_HAS_NO_STDOUT |
| 796 | #endif |
| 797 | |
Ed Schouten | 8451ac0 | 2015-03-12 15:48:06 +0000 | [diff] [blame] | 798 | #if defined(__ANDROID__) || defined(__CloudABI__) |
Dan Albert | ebdf28b | 2015-03-11 00:51:06 +0000 | [diff] [blame] | 799 | #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE |
| 800 | #endif |
| 801 | |
Ed Schouten | 137c863 | 2015-06-24 08:44:38 +0000 | [diff] [blame] | 802 | // Thread-unsafe functions such as strtok(), mbtowc() and localtime() |
| 803 | // are not available. |
| 804 | #ifdef __CloudABI__ |
| 805 | #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS |
| 806 | #endif |
| 807 | |
Eric Fiselier | 8174ac1 | 2015-09-22 03:15:35 +0000 | [diff] [blame] | 808 | #if __has_feature(cxx_atomic) || __has_extension(c_atomic) |
Eric Fiselier | 8020b6c | 2015-08-19 17:21:46 +0000 | [diff] [blame] | 809 | #define _LIBCPP_HAS_C_ATOMIC_IMP |
| 810 | #elif _GNUC_VER > 407 |
| 811 | #define _LIBCPP_HAS_GCC_ATOMIC_IMP |
| 812 | #endif |
| 813 | |
| 814 | #if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \ |
| 815 | || defined(_LIBCPP_HAS_NO_THREADS) |
| 816 | #define _LIBCPP_HAS_NO_ATOMIC_HEADER |
| 817 | #endif |
| 818 | |
Eric Fiselier | a80af82 | 2015-11-06 06:30:12 +0000 | [diff] [blame^] | 819 | #endif // __cplusplus |
| 820 | |
Eric Fiselier | 8020b6c | 2015-08-19 17:21:46 +0000 | [diff] [blame] | 821 | #endif // _LIBCPP_CONFIG |