config.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
  3. //
  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. //
  7. // Official repository: https://github.com/boostorg/beast
  8. //
  9. #ifndef BOOST_BEAST_CORE_DETAIL_CONFIG_HPP
  10. #define BOOST_BEAST_CORE_DETAIL_CONFIG_HPP
  11. // Available to every header
  12. #include <boost/config.hpp>
  13. #include <boost/version.hpp>
  14. #include <boost/core/ignore_unused.hpp>
  15. #include <boost/static_assert.hpp>
  16. #include <boost/preprocessor/cat.hpp>
  17. namespace boost {
  18. namespace asio
  19. {
  20. } // asio
  21. namespace beast {
  22. namespace net = boost::asio;
  23. } // beast
  24. } // boost
  25. /*
  26. _MSC_VER and _MSC_FULL_VER by version:
  27. 14.0 (2015) 1900 190023026
  28. 14.0 (2015 Update 1) 1900 190023506
  29. 14.0 (2015 Update 2) 1900 190023918
  30. 14.0 (2015 Update 3) 1900 190024210
  31. */
  32. #if defined(BOOST_MSVC)
  33. # if BOOST_MSVC_FULL_VER < 190024210
  34. # error Beast requires C++11: Visual Studio 2015 Update 3 or later needed
  35. # endif
  36. #elif defined(BOOST_GCC)
  37. # if(BOOST_GCC < 50000)
  38. # error Beast requires C++11: gcc version 5 or later needed
  39. # endif
  40. #else
  41. # if \
  42. defined(BOOST_NO_CXX11_DECLTYPE) || \
  43. defined(BOOST_NO_CXX11_HDR_TUPLE) || \
  44. defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || \
  45. defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  46. # error Beast requires C++11: a conforming compiler is needed
  47. # endif
  48. #endif
  49. #define BOOST_BEAST_DEPRECATION_STRING \
  50. "This is a deprecated interface, #define BOOST_BEAST_ALLOW_DEPRECATED to allow it"
  51. #ifndef BOOST_BEAST_ASSUME
  52. # ifdef BOOST_GCC
  53. # define BOOST_BEAST_ASSUME(cond) \
  54. do { if (!(cond)) __builtin_unreachable(); } while (0)
  55. # else
  56. # define BOOST_BEAST_ASSUME(cond) do { } while(0)
  57. # endif
  58. #endif
  59. // Default to a header-only implementation. The user must specifically
  60. // request separate compilation by defining BOOST_BEAST_SEPARATE_COMPILATION
  61. #ifndef BOOST_BEAST_HEADER_ONLY
  62. # ifndef BOOST_BEAST_SEPARATE_COMPILATION
  63. # define BOOST_BEAST_HEADER_ONLY 1
  64. # endif
  65. #endif
  66. #if BOOST_BEAST_DOXYGEN
  67. # define BOOST_BEAST_DECL
  68. #elif defined(BOOST_BEAST_HEADER_ONLY)
  69. # define BOOST_BEAST_DECL inline
  70. #else
  71. # define BOOST_BEAST_DECL
  72. #endif
  73. #ifndef BOOST_BEAST_ASYNC_RESULT1
  74. #define BOOST_BEAST_ASYNC_RESULT1(type) \
  75. BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(type, void(::boost::beast::error_code))
  76. #endif
  77. #ifndef BOOST_BEAST_ASYNC_RESULT2
  78. #define BOOST_BEAST_ASYNC_RESULT2(type) \
  79. BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(type, void(::boost::beast::error_code, ::std::size_t))
  80. #endif
  81. #ifndef BOOST_BEAST_ASYNC_TPARAM1
  82. #define BOOST_BEAST_ASYNC_TPARAM1 BOOST_ASIO_COMPLETION_TOKEN_FOR(void(::boost::beast::error_code))
  83. #endif
  84. #ifndef BOOST_BEAST_ASYNC_TPARAM2
  85. #define BOOST_BEAST_ASYNC_TPARAM2 BOOST_ASIO_COMPLETION_TOKEN_FOR(void(::boost::beast::error_code, ::std::size_t))
  86. #endif
  87. #ifdef BOOST_BEAST_NO_SOURCE_LOCATION
  88. #define BOOST_BEAST_ASSIGN_EC(ec, error) ec = error
  89. #else
  90. #define BOOST_BEAST_ASSIGN_EC(ec, error) \
  91. static constexpr auto BOOST_PP_CAT(loc_, __LINE__) ((BOOST_CURRENT_LOCATION)); \
  92. ec.assign(error, & BOOST_PP_CAT(loc_, __LINE__) )
  93. #endif
  94. #ifndef BOOST_BEAST_FILE_BUFFER_SIZE
  95. #define BOOST_BEAST_FILE_BUFFER_SIZE 4096
  96. #endif
  97. #endif