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