Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- __config ---------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_CONFIG |
| 12 | #define _LIBCPP_CONFIG |
| 13 | |
| 14 | #pragma GCC system_header |
| 15 | |
| 16 | #define _LIBCPP_VERSION 1000 |
| 17 | |
| 18 | #define _LIBCPP_ABI_VERSION 1 |
| 19 | |
| 20 | #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y |
| 21 | #define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) |
| 22 | |
| 23 | #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) |
| 24 | |
| 25 | #ifdef __LITTLE_ENDIAN__ |
| 26 | #if __LITTLE_ENDIAN__ |
| 27 | #define _LIBCPP_LITTLE_ENDIAN 1 |
| 28 | #define _LIBCPP_BIG_ENDIAN 0 |
| 29 | #endif |
| 30 | #endif |
| 31 | |
| 32 | #ifdef __BIG_ENDIAN__ |
| 33 | #if __BIG_ENDIAN__ |
| 34 | #define _LIBCPP_LITTLE_ENDIAN 0 |
| 35 | #define _LIBCPP_BIG_ENDIAN 1 |
| 36 | #endif |
| 37 | #endif |
| 38 | |
| 39 | #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) |
Howard Hinnant | adff489 | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 40 | # include <endian.h> |
| 41 | # if __BYTE_ORDER == __LITTLE_ENDIAN |
| 42 | # define _LIBCPP_LITTLE_ENDIAN 1 |
| 43 | # define _LIBCPP_BIG_ENDIAN 0 |
| 44 | # elif __BYTE_ORDER == __BIG_ENDIAN |
| 45 | # define _LIBCPP_LITTLE_ENDIAN 0 |
| 46 | # define _LIBCPP_BIG_ENDIAN 1 |
| 47 | # else |
| 48 | # error unable to determine endian |
| 49 | # endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 50 | #endif |
| 51 | |
| 52 | #ifndef _LIBCPP_VISIBILITY_TAG |
| 53 | #define _LIBCPP_VISIBILITY_TAG 1 |
| 54 | #endif |
| 55 | |
| 56 | #if _LIBCPP_VISIBILITY_TAG |
| 57 | #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) |
| 58 | #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) |
| 59 | #else |
| 60 | #define _LIBCPP_HIDDEN |
| 61 | #define _LIBCPP_VISIBLE |
| 62 | #endif |
| 63 | |
| 64 | #ifndef _LIBCPP_INLINE_VISIBILITY |
| 65 | #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) |
| 66 | #endif |
| 67 | |
| 68 | #ifndef _LIBCPP_EXCEPTION_ABI |
| 69 | #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) |
| 70 | #endif |
| 71 | |
| 72 | #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) |
| 73 | |
| 74 | #define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) |
| 75 | |
| 76 | #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 |
| 77 | #define _LIBCPP_MOVE |
| 78 | #endif |
| 79 | |
| 80 | #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) |
| 81 | #define _LIBCPP_HAS_NO_STATIC_ASSERT |
| 82 | #endif |
| 83 | |
| 84 | #define _LIBCPP_HAS_NO_NULLPTR |
| 85 | |
| 86 | #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) |
| 87 | #define _LIBCPP_HAS_NO_VARIADICS |
| 88 | #define _LIBCPP_HAS_NO_DECLTYPE |
| 89 | #endif |
| 90 | |
| 91 | #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) |
| 92 | #define _LIBCPP_HAS_NO_UNICODE_CHARS |
| 93 | #define _LIBCPP_HAS_NO_ADVANCED_SFINAE |
| 94 | #endif |
| 95 | |
| 96 | #if defined(__clang__) |
| 97 | #define _LIBCPP_HAS_NO_STRONG_USING |
| 98 | #endif |
| 99 | |
| 100 | #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES |
| 101 | |
| 102 | #ifdef _LIBCPP_HAS_NO_STRONG_USING |
| 103 | #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { |
| 104 | #define _LIBCPP_END_NAMESPACE_STD } |
| 105 | #define _STD std |
| 106 | #else |
| 107 | #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { |
| 108 | #define _LIBCPP_END_NAMESPACE_STD } } |
| 109 | |
| 110 | namespace std { |
| 111 | namespace _LIBCPP_NAMESPACE { |
| 112 | } |
| 113 | using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); |
| 114 | } |
| 115 | |
| 116 | #define _STD std::_LIBCPP_NAMESPACE |
| 117 | #endif |
| 118 | |
| 119 | #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS |
| 120 | typedef unsigned short char16_t; |
| 121 | typedef unsigned int char32_t; |
| 122 | #endif |
| 123 | |
| 124 | #ifdef _LIBCPP_HAS_NO_STATIC_ASSERT |
| 125 | |
| 126 | template <bool> struct __static_assert_test; |
| 127 | template <> struct __static_assert_test<true> {}; |
| 128 | template <unsigned> struct __static_assert_check {}; |
| 129 | #define static_assert(__b, __m) \ |
| 130 | typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ |
| 131 | _LIBCPP_CONCAT(__t, __LINE__) |
| 132 | |
| 133 | #endif |
| 134 | |
| 135 | #ifdef _LIBCPP_HAS_NO_DECLTYPE |
| 136 | |
| 137 | #define decltype(x) __typeof__(x) |
| 138 | |
| 139 | #endif |
| 140 | |
| 141 | #if !__EXCEPTIONS |
| 142 | #define _LIBCPP_NO_EXCEPTIONS |
| 143 | #endif |
| 144 | |
| 145 | #endif // _LIBCPP_CONFIG |