libcpp.hpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. #ifdef __has_include
  94. #if __has_include(<version>)
  95. #if !defined(__cpp_lib_execution) || (__cpp_lib_execution < 201603L)
  96. # define BOOST_NO_CXX17_HDR_EXECUTION
  97. #endif
  98. #if !defined(__cpp_lib_invoke) || (__cpp_lib_invoke < 201411L)
  99. #define BOOST_NO_CXX17_STD_INVOKE
  100. #endif
  101. #else
  102. #define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result)
  103. #define BOOST_NO_CXX17_HDR_EXECUTION
  104. #endif
  105. #else
  106. #define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result)
  107. #define BOOST_NO_CXX17_HDR_EXECUTION
  108. #endif
  109. #if _LIBCPP_VERSION < 10000 // What's the correct version check here?
  110. #define BOOST_NO_CXX17_ITERATOR_TRAITS
  111. #endif
  112. #if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  113. // This is a bit of a sledgehammer, because really it's just libc++abi that has no
  114. // support for thread_local, leading to linker errors such as
  115. // "undefined reference to `__cxa_thread_atexit'". It is fixed in the
  116. // most recent releases of libc++abi though...
  117. # define BOOST_NO_CXX11_THREAD_LOCAL
  118. #endif
  119. #if defined(__linux__) && (_LIBCPP_VERSION < 6000) && !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  120. // After libc++-dev is installed on Trusty, clang++-libc++ almost works,
  121. // except uses of `thread_local` fail with undefined reference to
  122. // `__cxa_thread_atexit`.
  123. //
  124. // clang's libc++abi provides an implementation by deferring to the glibc
  125. // implementation, which may or may not be available (it is not on Trusty).
  126. // clang 4's libc++abi will provide an implementation if one is not in glibc
  127. // though, so thread local support should work with clang 4 and above as long
  128. // as libc++abi is linked in.
  129. # define BOOST_NO_CXX11_THREAD_LOCAL
  130. #endif
  131. #if defined(__has_include)
  132. #if !__has_include(<shared_mutex>)
  133. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  134. #elif __cplusplus <= 201103
  135. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  136. #endif
  137. #elif __cplusplus < 201402
  138. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  139. #endif
  140. #if !defined(BOOST_NO_CXX14_HDR_SHARED_MUTEX) && (_LIBCPP_VERSION < 5000)
  141. # define BOOST_NO_CXX14_HDR_SHARED_MUTEX
  142. #endif
  143. // --- end ---