config.hpp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. #ifndef BOOST_LEAF_CONFIG_HPP_INCLUDED
  2. #define BOOST_LEAF_CONFIG_HPP_INCLUDED
  3. /// Copyright (c) 2018-2021 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 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_ENABLE_WARNINGS ///
  11. # if defined(_MSC_VER) ///
  12. # pragma warning(push,1) ///
  13. # elif defined(__clang__) ///
  14. # pragma clang system_header ///
  15. # elif (__GNUC__*100+__GNUC_MINOR__>301) ///
  16. # pragma GCC system_header ///
  17. # endif ///
  18. #endif ///
  19. ////////////////////////////////////////
  20. // Configure BOOST_LEAF_NO_EXCEPTIONS, unless already #defined
  21. #ifndef BOOST_LEAF_NO_EXCEPTIONS
  22. # if defined(__clang__) && !defined(__ibmxl__)
  23. // Clang C++ emulates GCC, so it has to appear early.
  24. # if !__has_feature(cxx_exceptions)
  25. # define BOOST_LEAF_NO_EXCEPTIONS
  26. # endif
  27. # elif defined(__DMC__)
  28. // Digital Mars C++
  29. # if !defined(_CPPUNWIND)
  30. # define BOOST_LEAF_NO_EXCEPTIONS
  31. # endif
  32. # elif defined(__GNUC__) && !defined(__ibmxl__)
  33. // GNU C++:
  34. # if !defined(__EXCEPTIONS)
  35. # define BOOST_LEAF_NO_EXCEPTIONS
  36. # endif
  37. # elif defined(__KCC)
  38. // Kai C++
  39. # if !defined(_EXCEPTIONS)
  40. # define BOOST_LEAF_NO_EXCEPTIONS
  41. # endif
  42. # elif defined(__CODEGEARC__)
  43. // CodeGear - must be checked for before Borland
  44. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  45. # define BOOST_LEAF_NO_EXCEPTIONS
  46. # endif
  47. # elif defined(__BORLANDC__)
  48. // Borland
  49. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  50. # define BOOST_LEAF_NO_EXCEPTIONS
  51. # endif
  52. # elif defined(__MWERKS__)
  53. // Metrowerks CodeWarrior
  54. # if !__option(exceptions)
  55. # define BOOST_LEAF_NO_EXCEPTIONS
  56. # endif
  57. # elif defined(__IBMCPP__) && defined(__COMPILER_VER__) && defined(__MVS__)
  58. // IBM z/OS XL C/C++
  59. # if !defined(_CPPUNWIND) && !defined(__EXCEPTIONS)
  60. # define BOOST_LEAF_NO_EXCEPTIONS
  61. # endif
  62. # elif defined(__ibmxl__)
  63. // IBM XL C/C++ for Linux (Little Endian)
  64. # if !__has_feature(cxx_exceptions)
  65. # define BOOST_LEAF_NO_EXCEPTIONS
  66. # endif
  67. # elif defined(_MSC_VER)
  68. // Microsoft Visual C++
  69. //
  70. // Must remain the last #elif since some other vendors (Metrowerks, for
  71. // example) also #define _MSC_VER
  72. # if !defined(_CPPUNWIND)
  73. # define BOOST_LEAF_NO_EXCEPTIONS
  74. # endif
  75. # endif
  76. #endif
  77. #ifdef BOOST_NORETURN
  78. # define BOOST_LEAF_NORETURN BOOST_NORETURN
  79. #else
  80. # if defined(_MSC_VER)
  81. # define BOOST_LEAF_NORETURN __declspec(noreturn)
  82. # elif defined(__GNUC__)
  83. # define BOOST_LEAF_NORETURN __attribute__ ((__noreturn__))
  84. # elif defined(__has_attribute) && defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x5130)
  85. # if __has_attribute(noreturn)
  86. # define BOOST_LEAF_NORETURN [[noreturn]]
  87. # endif
  88. # elif defined(__has_cpp_attribute)
  89. # if __has_cpp_attribute(noreturn)
  90. # define BOOST_LEAF_NORETURN [[noreturn]]
  91. # endif
  92. # endif
  93. #endif
  94. #if !defined(BOOST_LEAF_NORETURN)
  95. # define BOOST_LEAF_NORETURN
  96. #endif
  97. ////////////////////////////////////////
  98. #ifndef BOOST_LEAF_DIAGNOSTICS
  99. # define BOOST_LEAF_DIAGNOSTICS 1
  100. #endif
  101. #if BOOST_LEAF_DIAGNOSTICS!=0 && BOOST_LEAF_DIAGNOSTICS!=1
  102. # error BOOST_LEAF_DIAGNOSTICS must be 0 or 1.
  103. #endif
  104. ////////////////////////////////////////
  105. #ifdef _MSC_VER
  106. # define BOOST_LEAF_ALWAYS_INLINE __forceinline
  107. #else
  108. # define BOOST_LEAF_ALWAYS_INLINE __attribute__((always_inline)) inline
  109. #endif
  110. ////////////////////////////////////////
  111. #ifndef BOOST_LEAF_NODISCARD
  112. # if __cplusplus >= 201703L
  113. # define BOOST_LEAF_NODISCARD [[nodiscard]]
  114. # else
  115. # define BOOST_LEAF_NODISCARD
  116. # endif
  117. #endif
  118. ////////////////////////////////////////
  119. #ifndef BOOST_LEAF_CONSTEXPR
  120. # if __cplusplus > 201402L
  121. # define BOOST_LEAF_CONSTEXPR constexpr
  122. # else
  123. # define BOOST_LEAF_CONSTEXPR
  124. # endif
  125. #endif
  126. ////////////////////////////////////////
  127. #ifndef BOOST_LEAF_ASSERT
  128. # ifdef BOOST_ASSERT
  129. # define BOOST_LEAF_ASSERT BOOST_ASSERT
  130. # else
  131. # include <cassert>
  132. # define BOOST_LEAF_ASSERT assert
  133. # endif
  134. #endif
  135. ////////////////////////////////////////
  136. #ifndef BOOST_LEAF_NO_EXCEPTIONS
  137. # include <exception>
  138. # if (defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
  139. # define BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS 1
  140. # else
  141. # define BOOST_LEAF_STD_UNCAUGHT_EXCEPTIONS 0
  142. # endif
  143. #endif
  144. #if defined(_MSC_VER) && !defined(BOOST_LEAF_ENABLE_WARNINGS) ///
  145. #pragma warning(pop) ///
  146. #endif ///
  147. #ifdef __GNUC__
  148. # define BOOST_LEAF_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
  149. #else
  150. # define BOOST_LEAF_SYMBOL_VISIBLE
  151. #endif
  152. #endif