config.hpp 6.7 KB

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