config.hpp 3.1 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 BHO_BEAST_CORE_DETAIL_CONFIG_HPP
  10. #define BHO_BEAST_CORE_DETAIL_CONFIG_HPP
  11. // Available to every header
  12. #include <asio2/bho/config.hpp>
  13. #include <asio2/bho/version.hpp>
  14. #include <asio2/bho/core/ignore_unused.hpp>
  15. #include <asio2/bho/static_assert.hpp>
  16. #ifndef BHO_BEAST_NO_SOURCE_LOCATION
  17. #define BHO_BEAST_NO_SOURCE_LOCATION
  18. #endif
  19. namespace bho {
  20. namespace beast {
  21. namespace net = ::asio;
  22. } // beast
  23. } // bho
  24. /*
  25. _MSC_VER and _MSC_FULL_VER by version:
  26. 14.0 (2015) 1900 190023026
  27. 14.0 (2015 Update 1) 1900 190023506
  28. 14.0 (2015 Update 2) 1900 190023918
  29. 14.0 (2015 Update 3) 1900 190024210
  30. */
  31. #if defined(BHO_MSVC)
  32. # if BHO_MSVC_FULL_VER < 190024210
  33. # error Beast requires C++11: Visual Studio 2015 Update 3 or later needed
  34. # endif
  35. #elif defined(BHO_GCC)
  36. # if(BHO_GCC < 50000)
  37. # error Beast requires C++11: gcc version 5 or later needed
  38. # endif
  39. #else
  40. # if \
  41. defined(BHO_NO_CXX11_DECLTYPE) || \
  42. defined(BHO_NO_CXX11_HDR_TUPLE) || \
  43. defined(BHO_NO_CXX11_TEMPLATE_ALIASES) || \
  44. defined(BHO_NO_CXX11_VARIADIC_TEMPLATES)
  45. # error Beast requires C++11: a conforming compiler is needed
  46. # endif
  47. #endif
  48. #define BHO_BEAST_DEPRECATION_STRING \
  49. "This is a deprecated interface, #define BHO_BEAST_ALLOW_DEPRECATED to allow it"
  50. #ifndef BHO_BEAST_ASSUME
  51. # ifdef BHO_GCC
  52. # define BHO_BEAST_ASSUME(cond) \
  53. do { if (!(cond)) __builtin_unreachable(); } while (0)
  54. # else
  55. # define BHO_BEAST_ASSUME(cond) do { } while(0)
  56. # endif
  57. #endif
  58. // Default to a header-only implementation. The user must specifically
  59. // request separate compilation by defining BHO_BEAST_SEPARATE_COMPILATION
  60. #ifndef BEAST_HEADER_ONLY
  61. # ifndef BHO_BEAST_SEPARATE_COMPILATION
  62. # define BEAST_HEADER_ONLY 1
  63. # endif
  64. #endif
  65. #if BHO_BEAST_DOXYGEN
  66. # define BHO_BEAST_DECL
  67. #elif defined(BEAST_HEADER_ONLY)
  68. # define BHO_BEAST_DECL inline
  69. #else
  70. # define BHO_BEAST_DECL
  71. #endif
  72. #ifndef BHO_BEAST_ASYNC_RESULT1
  73. #define BHO_BEAST_ASYNC_RESULT1(type) \
  74. ASIO_INITFN_AUTO_RESULT_TYPE(type, void(::bho::beast::error_code))
  75. #endif
  76. #ifndef BHO_BEAST_ASYNC_RESULT2
  77. #define BHO_BEAST_ASYNC_RESULT2(type) \
  78. ASIO_INITFN_AUTO_RESULT_TYPE(type, void(::bho::beast::error_code, ::std::size_t))
  79. #endif
  80. #ifndef BHO_BEAST_ASYNC_TPARAM1
  81. #define BHO_BEAST_ASYNC_TPARAM1 ASIO_COMPLETION_TOKEN_FOR(void(::bho::beast::error_code))
  82. #endif
  83. #ifndef BHO_BEAST_ASYNC_TPARAM2
  84. #define BHO_BEAST_ASYNC_TPARAM2 ASIO_COMPLETION_TOKEN_FOR(void(::bho::beast::error_code, ::std::size_t))
  85. #endif
  86. #ifdef BHO_BEAST_NO_SOURCE_LOCATION
  87. #define BHO_BEAST_ASSIGN_EC(ec, error) ec = error
  88. #else
  89. #define BHO_BEAST_ASSIGN_EC(ec, error) \
  90. static constexpr auto BHO_PP_CAT(loc_, __LINE__) ((BHO_CURRENT_LOCATION)); \
  91. ec.assign(error, & BHO_PP_CAT(loc_, __LINE__) )
  92. #endif
  93. #ifndef BHO_BEAST_FILE_BUFFER_SIZE
  94. #define BHO_BEAST_FILE_BUFFER_SIZE 4096
  95. #endif
  96. #endif