mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 13:27:33 +02:00
Use Boost.Config
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
Version 76:
|
Version 76:
|
||||||
|
|
||||||
* Always go through write_some
|
* Always go through write_some
|
||||||
|
* Use Boost.Config
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -8,28 +8,22 @@
|
|||||||
#ifndef BEAST_UNIT_TEST_DSTREAM_HPP
|
#ifndef BEAST_UNIT_TEST_DSTREAM_HPP
|
||||||
#define BEAST_UNIT_TEST_DSTREAM_HPP
|
#define BEAST_UNIT_TEST_DSTREAM_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_WINDOWS
|
||||||
# ifndef NOMINMAX
|
#include <boost/detail/winapi/basic_types.hpp>
|
||||||
# define NOMINMAX 1
|
#include <boost/detail/winapi/debugapi.hpp>
|
||||||
# endif
|
|
||||||
# ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# endif
|
|
||||||
# include <windows.h>
|
|
||||||
# undef WIN32_LEAN_AND_MEAN
|
|
||||||
# undef NOMINMAX
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace unit_test {
|
namespace unit_test {
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_WINDOWS
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
@ -48,14 +42,14 @@ class dstream_buf
|
|||||||
void write(char const* s)
|
void write(char const* s)
|
||||||
{
|
{
|
||||||
if(dbg_)
|
if(dbg_)
|
||||||
OutputDebugStringA(s);
|
boost::detail::winapi::OutputDebugStringA(s);
|
||||||
os_ << s;
|
os_ << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(wchar_t const* s)
|
void write(wchar_t const* s)
|
||||||
{
|
{
|
||||||
if(dbg_)
|
if(dbg_)
|
||||||
OutputDebugStringW(s);
|
boost::detail::winapi::OutputDebugStringW(s);
|
||||||
os_ << s;
|
os_ << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +57,7 @@ public:
|
|||||||
explicit
|
explicit
|
||||||
dstream_buf(ostream& os)
|
dstream_buf(ostream& os)
|
||||||
: os_(os)
|
: os_(os)
|
||||||
, dbg_(IsDebuggerPresent() != FALSE)
|
, dbg_(boost::detail::winapi::IsDebuggerPresent() != 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,12 +11,13 @@
|
|||||||
#include <beast/unit_test/match.hpp>
|
#include <beast/unit_test/match.hpp>
|
||||||
#include <beast/unit_test/reporter.hpp>
|
#include <beast/unit_test/reporter.hpp>
|
||||||
#include <beast/unit_test/suite.hpp>
|
#include <beast/unit_test/suite.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_MSVC
|
||||||
# ifndef WIN32_LEAN_AND_MEAN // VC_EXTRALEAN
|
# ifndef WIN32_LEAN_AND_MEAN // VC_EXTRALEAN
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
@ -78,7 +79,7 @@ int main(int ac, char const* av[])
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace beast::unit_test;
|
using namespace beast::unit_test;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if BOOST_MSVC
|
||||||
{
|
{
|
||||||
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||||
flags |= _CRTDBG_LEAK_CHECK_DF;
|
flags |= _CRTDBG_LEAK_CHECK_DF;
|
||||||
|
@ -8,20 +8,23 @@
|
|||||||
#ifndef BEAST_CONFIG_HPP
|
#ifndef BEAST_CONFIG_HPP
|
||||||
#define BEAST_CONFIG_HPP
|
#define BEAST_CONFIG_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
// Available to every header
|
||||||
#include <boost/core/ignore_unused.hpp>
|
#include <boost/core/ignore_unused.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
_MSC_VER and _MSC_FULL_VER by version:
|
_MSC_VER and _MSC_FULL_VER by version:
|
||||||
|
|
||||||
14.0 (2015) 1900 190023026
|
14.0 (2015) 1900 190023026
|
||||||
14.0 (2015 Update 1) 1900 190023506
|
14.0 (2015 Update 1) 1900 190023506
|
||||||
14.0 (2015 Update 2) 1900 190023918
|
14.0 (2015 Update 2) 1900 190023918
|
||||||
14.0 (2015 Update 3) 1900 190024210
|
14.0 (2015 Update 3) 1900 190024210
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_MSC_FULL_VER)
|
#ifdef BOOST_MSVC
|
||||||
#if _MSC_FULL_VER < 190024210
|
#if BOOST_MSVC_FULL_VER < 190024210
|
||||||
static_assert(false,
|
static_assert(false,
|
||||||
"This library requires Visual Studio 2015 Update 3 or later");
|
"This library requires Visual Studio 2015 Update 3 or later");
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#if ! BEAST_NO_INTRINSICS
|
#if ! BEAST_NO_INTRINSICS
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#ifdef BOOST_MSVC
|
||||||
#include <intrin.h> // __cpuid
|
#include <intrin.h> // __cpuid
|
||||||
#else
|
#else
|
||||||
#include <cpuid.h> // __get_cpuid
|
#include <cpuid.h> // __get_cpuid
|
||||||
@ -41,7 +41,7 @@ cpuid(
|
|||||||
std::uint32_t& ecx,
|
std::uint32_t& ecx,
|
||||||
std::uint32_t& edx)
|
std::uint32_t& edx)
|
||||||
{
|
{
|
||||||
#if defined(BOOST_MSVC)
|
#ifdef BOOST_MSVC
|
||||||
int regs[4];
|
int regs[4];
|
||||||
__cpuid(regs, id);
|
__cpuid(regs, id);
|
||||||
eax = regs[0];
|
eax = regs[0];
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_HPP
|
#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_HPP
|
||||||
#define BEAST_DETAIL_INTEGER_SEQUENCE_HPP
|
#define BEAST_DETAIL_INTEGER_SEQUENCE_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -39,9 +40,9 @@ struct sizeof_workaround
|
|||||||
static std::size_t constexpr size = sizeof... (Args);
|
static std::size_t constexpr size = sizeof... (Args);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_MSVC
|
||||||
|
|
||||||
// This implementation compiles on MSVC and clang but not gcc
|
// This implementation compiles on real MSVC and clang but not gcc
|
||||||
|
|
||||||
template<class T, unsigned long long N, class Seq>
|
template<class T, unsigned long long N, class Seq>
|
||||||
struct make_integer_sequence_unchecked;
|
struct make_integer_sequence_unchecked;
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
# pragma warning (push)
|
# pragma warning (push)
|
||||||
# pragma warning (disable: 4127) // conditional expression is constant
|
# pragma warning (disable: 4127) // conditional expression is constant
|
||||||
# pragma warning (disable: 4244) // integer conversion, possible loss of data
|
# pragma warning (disable: 4244) // integer conversion, possible loss of data
|
||||||
@ -18,7 +20,7 @@
|
|||||||
|
|
||||||
#include "nodejs-parser/http_parser.c"
|
#include "nodejs-parser/http_parser.c"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_MSVC
|
||||||
# pragma warning (pop)
|
# pragma warning (pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <beast/core.hpp>
|
#include <beast/core.hpp>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@ -191,7 +192,7 @@ print_response(SyncReadStream& stream)
|
|||||||
|
|
||||||
//]
|
//]
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_MSVC
|
||||||
//[http_snippet_14
|
//[http_snippet_14
|
||||||
|
|
||||||
template<bool isRequest, class Body, class Fields>
|
template<bool isRequest, class Body, class Fields>
|
||||||
@ -257,7 +258,7 @@ print(message<isRequest, Body, Fields> const& m)
|
|||||||
|
|
||||||
//]
|
//]
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if BOOST_MSVC
|
||||||
//[http_snippet_16
|
//[http_snippet_16
|
||||||
|
|
||||||
template<bool isRequest, class Body, class Fields>
|
template<bool isRequest, class Body, class Fields>
|
||||||
|
@ -217,7 +217,7 @@ boost::asio::ip::tcp::socket sock{ios};
|
|||||||
} // fxx()
|
} // fxx()
|
||||||
|
|
||||||
// workaround for https://github.com/chriskohlhoff/asio/issues/112
|
// workaround for https://github.com/chriskohlhoff/asio/issues/112
|
||||||
#ifdef _MSC_VER
|
#ifdef BOOST_MSVC
|
||||||
//[ws_snippet_21
|
//[ws_snippet_21
|
||||||
void echo(stream<boost::asio::ip::tcp::socket>& ws,
|
void echo(stream<boost::asio::ip::tcp::socket>& ws,
|
||||||
multi_buffer& buffer, boost::asio::yield_context yield)
|
multi_buffer& buffer, boost::asio::yield_context yield)
|
||||||
|
Reference in New Issue
Block a user