libcpp.hpp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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_EXCEPTION
  36. # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  37. # define BOOST_NO_CXX11_HDR_MUTEX
  38. # define BOOST_NO_CXX11_HDR_RANDOM
  39. # define BOOST_NO_CXX11_HDR_RATIO
  40. # define BOOST_NO_CXX11_HDR_REGEX
  41. # define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
  42. # define BOOST_NO_CXX11_HDR_THREAD
  43. # define BOOST_NO_CXX11_HDR_TUPLE
  44. # define BOOST_NO_CXX11_HDR_TYPEINDEX
  45. # define BOOST_NO_CXX11_HDR_UNORDERED_MAP
  46. # define BOOST_NO_CXX11_HDR_UNORDERED_SET
  47. # define BOOST_NO_CXX11_NUMERIC_LIMITS
  48. # define BOOST_NO_CXX11_ALLOCATOR
  49. # define BOOST_NO_CXX11_POINTER_TRAITS
  50. # define BOOST_NO_CXX11_SMART_PTR
  51. # define BOOST_NO_CXX11_HDR_FUNCTIONAL
  52. # define BOOST_NO_CXX11_STD_ALIGN
  53. # define BOOST_NO_CXX11_ADDRESSOF
  54. # define BOOST_NO_CXX11_HDR_ATOMIC
  55. # define BOOST_NO_CXX11_ATOMIC_SMART_PTR
  56. # define BOOST_NO_CXX11_HDR_CHRONO
  57. # define BOOST_NO_CXX11_HDR_TYPE_TRAITS
  58. # define BOOST_NO_CXX11_HDR_FUTURE
  59. #elif _LIBCPP_VERSION < 3700
  60. //
  61. // These appear to be unusable/incomplete so far:
  62. //
  63. # define BOOST_NO_CXX11_HDR_ATOMIC
  64. # define BOOST_NO_CXX11_ATOMIC_SMART_PTR
  65. # define BOOST_NO_CXX11_HDR_CHRONO
  66. # define BOOST_NO_CXX11_HDR_TYPE_TRAITS
  67. # define BOOST_NO_CXX11_HDR_FUTURE
  68. #endif
  69. #if _LIBCPP_VERSION < 3700
  70. // libc++ uses a non-standard messages_base
  71. #define BOOST_NO_STD_MESSAGES
  72. #endif
  73. // C++14 features
  74. #if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L)
  75. # define BOOST_NO_CXX14_STD_EXCHANGE
  76. #endif
  77. // C++17 features
  78. #if (_LIBCPP_VERSION < 4000) || (__cplusplus <= 201402L)
  79. # define BOOST_NO_CXX17_STD_APPLY
  80. # define BOOST_NO_CXX17_HDR_OPTIONAL
  81. # define BOOST_NO_CXX17_HDR_STRING_VIEW
  82. # define BOOST_NO_CXX17_HDR_VARIANT
  83. #endif
  84. #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
  85. # define BOOST_NO_AUTO_PTR
  86. #endif
  87. #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE)
  88. # define BOOST_NO_CXX98_RANDOM_SHUFFLE
  89. #endif
  90. #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
  91. # define BOOST_NO_CXX98_BINDERS
  92. #endif
  93. #if defined(__cplusplus) && defined(__has_include)
  94. #if __has_include(<version>)
  95. #include <version>
  96. #if !defined(__cpp_lib_execution) || (__cpp_lib_execution < 201603L)
  97. # define BOOST_NO_CXX17_HDR_EXECUTION
  98. #endif
  99. #if !defined(__cpp_lib_invoke) || (__cpp_lib_invoke < 201411L)
  100. #define BOOST_NO_CXX17_STD_INVOKE
  101. #endif
  102. #if(_LIBCPP_VERSION < 9000)
  103. // as_writable_bytes is missing.
  104. # define BOOST_NO_CXX20_HDR_SPAN
  105. #endif
  106. #else
  107. #define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result)
  108. #define BOOST_NO_CXX17_HDR_EXECUTION
  109. #endif
  110. #else
  111. #define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result)
  112. #define BOOST_NO_CXX17_HDR_EXECUTION
  113. #endif
  114. #if _LIBCPP_VERSION < 10000 // What's the correct version check here?
  115. #define BOOST_NO_CXX17_ITERATOR_TRAITS
  116. #endif
  117. #if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  118. // This is a bit of a sledgehammer, because really it's just libc++abi that has no
  119. // support for thread_local, leading to linker errors such as
  120. // "undefined reference to `__cxa_thread_atexit'". It is fixed in the
  121. // most recent releases of libc++abi though...
  122. # define BOOST_NO_CXX11_THREAD_LOCAL
  123. #endif
  124. #if defined(__linux__) && (_LIBCPP_VERSION < 6000) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  125. // After libc++-dev is installed on Trusty, clang++-libc++ almost works,
  126. // except uses of `thread_local` fail with undefined reference to
  127. // `__cxa_thread_atexit`.
  128. //
  129. // clang's libc++abi provides an implementation by deferring to the glibc
  130. // implementation, which may or may not be available (it is not on Trusty).
  131. // clang 4's libc++abi will provide an implementation if one is not in glibc
  132. // though, so thread local support should work with clang 4 and above as long
  133. // as libc++abi is linked in.
  134. # define BOOST_NO_CXX11_THREAD_LOCAL
  135. #endif
  136. #if defined(__has_include)
  137. #if !__has_include(<shared_mutex>)
  138. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  139. #elif __cplusplus <= 201103
  140. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  141. #endif
  142. #elif __cplusplus < 201402
  143. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  144. #endif
  145. #if !defined(BOOST_NO_CXX14_HDR_SHARED_MUTEX) && (_LIBCPP_VERSION < 5000)
  146. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  147. #endif
  148. #if _LIBCPP_VERSION >= 15000
  149. //
  150. // Unary function is now deprecated in C++11 and later:
  151. //
  152. #if __cplusplus >= 201103L
  153. #define BOOST_NO_CXX98_FUNCTION_BASE
  154. #endif
  155. #endif
  156. // --- end ---