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