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