libcpp.hpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // (C) Copyright Christopher Jefferson 2011.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org for most recent version.
  6. // config for libc++
  7. // Might need more in here later.
  8. #if !defined(_LIBCPP_VERSION)
  9. # include <ciso646>
  10. # if !defined(_LIBCPP_VERSION)
  11. # error "This is not libc++!"
  12. # endif
  13. #endif
  14. #define BOOST_STDLIB "libc++ version " BOOST_STRINGIZE(_LIBCPP_VERSION)
  15. #define BOOST_HAS_THREADS
  16. #ifdef _LIBCPP_HAS_NO_VARIADICS
  17. # define BOOST_NO_CXX11_HDR_TUPLE
  18. #endif
  19. // BOOST_NO_CXX11_ALLOCATOR should imply no support for the C++11
  20. // allocator model. The C++11 allocator model requires a conforming
  21. // std::allocator_traits which is only possible with C++11 template
  22. // aliases since members rebind_alloc and rebind_traits require it.
  23. #if defined(_LIBCPP_HAS_NO_TEMPLATE_ALIASES)
  24. # define BOOST_NO_CXX11_ALLOCATOR
  25. # define BOOST_NO_CXX11_POINTER_TRAITS
  26. #endif
  27. #if __cplusplus < 201103
  28. //
  29. // These two appear to be somewhat useable in C++03 mode, there may be others...
  30. //
  31. //# define BOOST_NO_CXX11_HDR_ARRAY
  32. //# define BOOST_NO_CXX11_HDR_FORWARD_LIST
  33. # define BOOST_NO_CXX11_HDR_CODECVT
  34. # define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
  35. # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  36. # define BOOST_NO_CXX11_HDR_MUTEX
  37. # define BOOST_NO_CXX11_HDR_RANDOM
  38. # define BOOST_NO_CXX11_HDR_RATIO
  39. # define BOOST_NO_CXX11_HDR_REGEX
  40. # define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
  41. # define BOOST_NO_CXX11_HDR_THREAD
  42. # define BOOST_NO_CXX11_HDR_TUPLE
  43. # define BOOST_NO_CXX11_HDR_TYPEINDEX
  44. # define BOOST_NO_CXX11_HDR_UNORDERED_MAP
  45. # define BOOST_NO_CXX11_HDR_UNORDERED_SET
  46. # define BOOST_NO_CXX11_NUMERIC_LIMITS
  47. # define BOOST_NO_CXX11_ALLOCATOR
  48. # define BOOST_NO_CXX11_POINTER_TRAITS
  49. # define BOOST_NO_CXX11_SMART_PTR
  50. # define BOOST_NO_CXX11_HDR_FUNCTIONAL
  51. # define BOOST_NO_CXX11_STD_ALIGN
  52. # define BOOST_NO_CXX11_ADDRESSOF
  53. # define BOOST_NO_CXX11_HDR_ATOMIC
  54. # define BOOST_NO_CXX11_ATOMIC_SMART_PTR
  55. # define BOOST_NO_CXX11_HDR_CHRONO
  56. # define BOOST_NO_CXX11_HDR_TYPE_TRAITS
  57. # define BOOST_NO_CXX11_HDR_FUTURE
  58. #elif _LIBCPP_VERSION < 3700
  59. //
  60. // These appear to be unusable/incomplete so far:
  61. //
  62. # define BOOST_NO_CXX11_HDR_ATOMIC
  63. # define BOOST_NO_CXX11_ATOMIC_SMART_PTR
  64. # define BOOST_NO_CXX11_HDR_CHRONO
  65. # define BOOST_NO_CXX11_HDR_TYPE_TRAITS
  66. # define BOOST_NO_CXX11_HDR_FUTURE
  67. #endif
  68. #if _LIBCPP_VERSION < 3700
  69. // libc++ uses a non-standard messages_base
  70. #define BOOST_NO_STD_MESSAGES
  71. #endif
  72. // C++14 features
  73. #if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L)
  74. # define BOOST_NO_CXX14_STD_EXCHANGE
  75. #endif
  76. // C++17 features
  77. #if (_LIBCPP_VERSION < 4000) || (__cplusplus <= 201402L)
  78. # define BOOST_NO_CXX17_STD_APPLY
  79. # define BOOST_NO_CXX17_HDR_OPTIONAL
  80. # define BOOST_NO_CXX17_HDR_STRING_VIEW
  81. # define BOOST_NO_CXX17_HDR_VARIANT
  82. #endif
  83. #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
  84. # define BOOST_NO_AUTO_PTR
  85. #endif
  86. #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE)
  87. # define BOOST_NO_CXX98_RANDOM_SHUFFLE
  88. #endif
  89. #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
  90. # define BOOST_NO_CXX98_BINDERS
  91. #endif
  92. #define BOOST_NO_CXX17_ITERATOR_TRAITS
  93. #define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result)
  94. #if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  95. // This is a bit of a sledgehammer, because really it's just libc++abi that has no
  96. // support for thread_local, leading to linker errors such as
  97. // "undefined reference to `__cxa_thread_atexit'". It is fixed in the
  98. // most recent releases of libc++abi though...
  99. # define BOOST_NO_CXX11_THREAD_LOCAL
  100. #endif
  101. #if defined(__linux__) && (_LIBCPP_VERSION < 6000) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  102. // After libc++-dev is installed on Trusty, clang++-libc++ almost works,
  103. // except uses of `thread_local` fail with undefined reference to
  104. // `__cxa_thread_atexit`.
  105. //
  106. // clang's libc++abi provides an implementation by deferring to the glibc
  107. // implementation, which may or may not be available (it is not on Trusty).
  108. // clang 4's libc++abi will provide an implementation if one is not in glibc
  109. // though, so thread local support should work with clang 4 and above as long
  110. // as libc++abi is linked in.
  111. # define BOOST_NO_CXX11_THREAD_LOCAL
  112. #endif
  113. #if defined(__has_include)
  114. #if !__has_include(<shared_mutex>)
  115. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  116. #elif __cplusplus <= 201103
  117. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  118. #endif
  119. #elif __cplusplus < 201402
  120. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  121. #endif
  122. #if !defined(BOOST_NO_CXX14_HDR_SHARED_MUTEX) && (_LIBCPP_VERSION < 5000)
  123. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  124. #endif
  125. // --- end ---