config.hpp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. #ifndef BOOST_LEAF_CONFIG_HPP_INCLUDED
  2. #define BOOST_LEAF_CONFIG_HPP_INCLUDED
  3. // Copyright 2018-2023 Emil Dotchevski and Reverge Studios, Inc.
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. // The following is based in part on Boost Config.
  7. // (C) Copyright John Maddock 2001 - 2003.
  8. // (C) Copyright Martin Wille 2003.
  9. // (C) Copyright Guillaume Melquiond 2003.
  10. #ifndef BOOST_LEAF_ASSERT
  11. # include <cassert>
  12. # define BOOST_LEAF_ASSERT assert
  13. #endif
  14. ////////////////////////////////////////
  15. #ifdef BOOST_LEAF_DIAGNOSTICS
  16. # warning BOOST_LEAF_DIAGNOSTICS has been renamed to BOOST_LEAF_CFG_DIAGNOSTICS.
  17. # define BOOST_LEAF_CFG_DIAGNOSTICS BOOST_LEAF_DIAGNOSTICS
  18. #endif
  19. ////////////////////////////////////////
  20. #ifdef BOOST_LEAF_TLS_FREERTOS
  21. # ifndef BOOST_LEAF_EMBEDDED
  22. # define BOOST_LEAF_EMBEDDED
  23. # endif
  24. #endif
  25. ////////////////////////////////////////
  26. #ifdef BOOST_LEAF_EMBEDDED
  27. # ifndef BOOST_LEAF_CFG_DIAGNOSTICS
  28. # define BOOST_LEAF_CFG_DIAGNOSTICS 0
  29. # endif
  30. # ifndef BOOST_LEAF_CFG_STD_SYSTEM_ERROR
  31. # define BOOST_LEAF_CFG_STD_SYSTEM_ERROR 0
  32. # endif
  33. # ifndef BOOST_LEAF_CFG_STD_STRING
  34. # define BOOST_LEAF_CFG_STD_STRING 0
  35. # endif
  36. # ifndef BOOST_LEAF_CFG_CAPTURE
  37. # define BOOST_LEAF_CFG_CAPTURE 0
  38. # endif
  39. #endif
  40. ////////////////////////////////////////
  41. #ifndef BOOST_LEAF_CFG_DIAGNOSTICS
  42. # define BOOST_LEAF_CFG_DIAGNOSTICS 1
  43. #endif
  44. #ifndef BOOST_LEAF_CFG_STD_SYSTEM_ERROR
  45. # define BOOST_LEAF_CFG_STD_SYSTEM_ERROR 1
  46. #endif
  47. #ifndef BOOST_LEAF_CFG_STD_STRING
  48. # define BOOST_LEAF_CFG_STD_STRING 1
  49. #endif
  50. #ifndef BOOST_LEAF_CFG_CAPTURE
  51. # define BOOST_LEAF_CFG_CAPTURE 1
  52. #endif
  53. #ifndef BOOST_LEAF_CFG_WIN32
  54. # define BOOST_LEAF_CFG_WIN32 0
  55. #endif
  56. #ifndef BOOST_LEAF_CFG_GNUC_STMTEXPR
  57. # ifdef __GNUC__
  58. # define BOOST_LEAF_CFG_GNUC_STMTEXPR 1
  59. # else
  60. # define BOOST_LEAF_CFG_GNUC_STMTEXPR 0
  61. # endif
  62. #endif
  63. #if BOOST_LEAF_CFG_DIAGNOSTICS!=0 && BOOST_LEAF_CFG_DIAGNOSTICS!=1
  64. # error BOOST_LEAF_CFG_DIAGNOSTICS must be 0 or 1.
  65. #endif
  66. #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR!=0 && BOOST_LEAF_CFG_STD_SYSTEM_ERROR!=1
  67. # error BOOST_LEAF_CFG_STD_SYSTEM_ERROR must be 0 or 1.
  68. #endif
  69. #if BOOST_LEAF_CFG_STD_STRING!=0 && BOOST_LEAF_CFG_STD_STRING!=1
  70. # error BOOST_LEAF_CFG_STD_STRING must be 0 or 1.
  71. #endif
  72. #if BOOST_LEAF_CFG_CAPTURE!=0 && BOOST_LEAF_CFG_CAPTURE!=1
  73. # error BOOST_LEAF_CFG_CAPTURE must be 0 or 1.
  74. #endif
  75. #if BOOST_LEAF_CFG_WIN32!=0 && BOOST_LEAF_CFG_WIN32!=1
  76. # error BOOST_LEAF_CFG_WIN32 must be 0 or 1.
  77. #endif
  78. #if BOOST_LEAF_CFG_GNUC_STMTEXPR!=0 && BOOST_LEAF_CFG_GNUC_STMTEXPR!=1
  79. # error BOOST_LEAF_CFG_GNUC_STMTEXPR must be 0 or 1.
  80. #endif
  81. #if BOOST_LEAF_CFG_DIAGNOSTICS && !BOOST_LEAF_CFG_STD_STRING
  82. # error BOOST_LEAF_CFG_DIAGNOSTICS requires BOOST_LEAF_CFG_STD_STRING, which has been disabled.
  83. #endif
  84. #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR && !BOOST_LEAF_CFG_STD_STRING
  85. # error BOOST_LEAF_CFG_STD_SYSTEM_ERROR requires BOOST_LEAF_CFG_STD_STRING, which has been disabled.
  86. #endif
  87. ////////////////////////////////////////
  88. // Configure BOOST_LEAF_NO_EXCEPTIONS, unless already #defined
  89. #ifndef BOOST_LEAF_NO_EXCEPTIONS
  90. # if defined(__clang__) && !defined(__ibmxl__)
  91. // Clang C++ emulates GCC, so it has to appear early.
  92. # if !__has_feature(cxx_exceptions)
  93. # define BOOST_LEAF_NO_EXCEPTIONS
  94. # endif
  95. # elif defined(__DMC__)
  96. // Digital Mars C++
  97. # if !defined(_CPPUNWIND)
  98. # define BOOST_LEAF_NO_EXCEPTIONS
  99. # endif
  100. # elif defined(__GNUC__) && !defined(__ibmxl__)
  101. // GNU C++:
  102. # if !defined(__EXCEPTIONS)
  103. # define BOOST_LEAF_NO_EXCEPTIONS
  104. # endif
  105. # elif defined(__KCC)
  106. // Kai C++
  107. # if !defined(_EXCEPTIONS)
  108. # define BOOST_LEAF_NO_EXCEPTIONS
  109. # endif
  110. # elif defined(__CODEGEARC__)
  111. // CodeGear - must be checked for before Borland
  112. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  113. # define BOOST_LEAF_NO_EXCEPTIONS
  114. # endif
  115. # elif defined(__BORLANDC__)
  116. // Borland
  117. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  118. # define BOOST_LEAF_NO_EXCEPTIONS
  119. # endif
  120. # elif defined(__MWERKS__)
  121. // Metrowerks CodeWarrior
  122. # if !__option(exceptions)
  123. # define BOOST_LEAF_NO_EXCEPTIONS
  124. # endif
  125. # elif defined(__IBMCPP__) && defined(__COMPILER_VER__) && defined(__MVS__)
  126. // IBM z/OS XL C/C++
  127. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  128. # define BOOST_LEAF_NO_EXCEPTIONS
  129. # endif
  130. # elif defined(__ibmxl__)
  131. // IBM XL C/C++ for Linux (Little Endian)
  132. # if !__has_feature(cxx_exceptions)
  133. # define BOOST_LEAF_NO_EXCEPTIONS
  134. # endif
  135. # elif defined(_MSC_VER)
  136. // Microsoft Visual C++
  137. //
  138. // Must remain the last #elif since some other vendors (Metrowerks, for
  139. // example) also #define _MSC_VER
  140. # if !_CPPUNWIND
  141. # define BOOST_LEAF_NO_EXCEPTIONS
  142. # endif
  143. # endif
  144. #endif
  145. ////////////////////////////////////////
  146. #ifdef _MSC_VER
  147. # define BOOST_LEAF_ALWAYS_INLINE __forceinline
  148. #else
  149. # define BOOST_LEAF_ALWAYS_INLINE __attribute__((always_inline)) inline
  150. #endif
  151. ////////////////////////////////////////
  152. #if defined(__has_attribute) && defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x5130)
  153. # if __has_attribute(nodiscard)
  154. # define BOOST_LEAF_ATTRIBUTE_NODISCARD [[nodiscard]]
  155. # endif
  156. #elif defined(__has_cpp_attribute)
  157. // require c++17 regardless of compiler
  158. # if __has_cpp_attribute(nodiscard) && __cplusplus >= 201703L
  159. # define BOOST_LEAF_ATTRIBUTE_NODISCARD [[nodiscard]]
  160. # endif
  161. #endif
  162. #ifndef BOOST_LEAF_ATTRIBUTE_NODISCARD
  163. # define BOOST_LEAF_ATTRIBUTE_NODISCARD
  164. #endif
  165. ////////////////////////////////////////
  166. #ifndef BOOST_LEAF_CONSTEXPR
  167. # if __cplusplus > 201402L
  168. # define BOOST_LEAF_CONSTEXPR constexpr
  169. # else
  170. # define BOOST_LEAF_CONSTEXPR
  171. # endif
  172. #endif
  173. ////////////////////////////////////////
  174. #ifndef BOOST_LEAF_DEPRECATED
  175. # if __cplusplus > 201402L
  176. # define BOOST_LEAF_DEPRECATED(msg) [[deprecated(msg)]]
  177. # else
  178. # define BOOST_LEAF_DEPRECATED(msg)
  179. # endif
  180. #endif
  181. ////////////////////////////////////////
  182. #ifndef BOOST_LEAF_NO_EXCEPTIONS
  183. # include <exception>
  184. # if (defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
  185. # define BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS 1
  186. # else
  187. # define BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS 0
  188. # endif
  189. #endif
  190. ////////////////////////////////////////
  191. #ifdef __GNUC__
  192. # define BOOST_LEAF_SYMBOL_VISIBLE [[gnu::visibility("default")]]
  193. #else
  194. # define BOOST_LEAF_SYMBOL_VISIBLE
  195. #endif
  196. ////////////////////////////////////////
  197. #if defined(__GNUC__) && !(defined(__clang__) || defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) < 409
  198. # ifndef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
  199. # define BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
  200. # endif
  201. #endif
  202. ////////////////////////////////////////
  203. // Configure TLS access
  204. #include <boost/leaf/config/tls.hpp>
  205. ////////////////////////////////////////
  206. #endif