config.hpp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. #ifndef BOOST_LEAF_CONFIG_HPP_INCLUDED
  2. #define BOOST_LEAF_CONFIG_HPP_INCLUDED
  3. // Copyright 2018-2022 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_DIAGNOSTICS && !BOOST_LEAF_CFG_STD_STRING
  76. # error BOOST_LEAF_CFG_DIAGNOSTICS requires the use of std::string
  77. #endif
  78. #if BOOST_LEAF_CFG_WIN32!=0 && BOOST_LEAF_CFG_WIN32!=1
  79. # error BOOST_LEAF_CFG_WIN32 must be 0 or 1.
  80. #endif
  81. #if BOOST_LEAF_CFG_GNUC_STMTEXPR!=0 && BOOST_LEAF_CFG_GNUC_STMTEXPR!=1
  82. # error BOOST_LEAF_CFG_GNUC_STMTEXPR must be 0 or 1.
  83. #endif
  84. ////////////////////////////////////////
  85. // Configure BOOST_LEAF_NO_EXCEPTIONS, unless already #defined
  86. #ifndef BOOST_LEAF_NO_EXCEPTIONS
  87. # if defined(__clang__) && !defined(__ibmxl__)
  88. // Clang C++ emulates GCC, so it has to appear early.
  89. # if !__has_feature(cxx_exceptions)
  90. # define BOOST_LEAF_NO_EXCEPTIONS
  91. # endif
  92. # elif defined(__DMC__)
  93. // Digital Mars C++
  94. # if !defined(_CPPUNWIND)
  95. # define BOOST_LEAF_NO_EXCEPTIONS
  96. # endif
  97. # elif defined(__GNUC__) && !defined(__ibmxl__)
  98. // GNU C++:
  99. # if !defined(__EXCEPTIONS)
  100. # define BOOST_LEAF_NO_EXCEPTIONS
  101. # endif
  102. # elif defined(__KCC)
  103. // Kai 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(__BORLANDC__)
  113. // Borland
  114. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  115. # define BOOST_LEAF_NO_EXCEPTIONS
  116. # endif
  117. # elif defined(__MWERKS__)
  118. // Metrowerks CodeWarrior
  119. # if !__option(exceptions)
  120. # define BOOST_LEAF_NO_EXCEPTIONS
  121. # endif
  122. # elif defined(__IBMCPP__) && defined(__COMPILER_VER__) && defined(__MVS__)
  123. // IBM z/OS XL C/C++
  124. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  125. # define BOOST_LEAF_NO_EXCEPTIONS
  126. # endif
  127. # elif defined(__ibmxl__)
  128. // IBM XL C/C++ for Linux (Little Endian)
  129. # if !__has_feature(cxx_exceptions)
  130. # define BOOST_LEAF_NO_EXCEPTIONS
  131. # endif
  132. # elif defined(_MSC_VER)
  133. // Microsoft Visual C++
  134. //
  135. // Must remain the last #elif since some other vendors (Metrowerks, for
  136. // example) also #define _MSC_VER
  137. # if !_CPPUNWIND
  138. # define BOOST_LEAF_NO_EXCEPTIONS
  139. # endif
  140. # endif
  141. #endif
  142. ////////////////////////////////////////
  143. #ifdef _MSC_VER
  144. # define BOOST_LEAF_ALWAYS_INLINE __forceinline
  145. #else
  146. # define BOOST_LEAF_ALWAYS_INLINE __attribute__((always_inline)) inline
  147. #endif
  148. ////////////////////////////////////////
  149. #ifndef BOOST_LEAF_NODISCARD
  150. # if __cplusplus >= 201703L
  151. # define BOOST_LEAF_NODISCARD [[nodiscard]]
  152. # else
  153. # define BOOST_LEAF_NODISCARD
  154. # endif
  155. #endif
  156. ////////////////////////////////////////
  157. #ifndef BOOST_LEAF_CONSTEXPR
  158. # if __cplusplus > 201402L
  159. # define BOOST_LEAF_CONSTEXPR constexpr
  160. # else
  161. # define BOOST_LEAF_CONSTEXPR
  162. # endif
  163. #endif
  164. ////////////////////////////////////////
  165. #ifndef BOOST_LEAF_NO_EXCEPTIONS
  166. # include <exception>
  167. # if (defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
  168. # define BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS 1
  169. # else
  170. # define BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS 0
  171. # endif
  172. #endif
  173. ////////////////////////////////////////
  174. #ifdef __GNUC__
  175. # define BOOST_LEAF_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
  176. #else
  177. # define BOOST_LEAF_SYMBOL_VISIBLE
  178. #endif
  179. ////////////////////////////////////////
  180. #if defined(__GNUC__) && !(defined(__clang__) || defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) < 409
  181. # ifndef BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
  182. # define BOOST_LEAF_NO_CXX11_REF_QUALIFIERS
  183. # endif
  184. #endif
  185. ////////////////////////////////////////
  186. // Configure TLS access
  187. #include <boost/leaf/config/tls.hpp>
  188. ////////////////////////////////////////
  189. #endif