Use Boost.Config

This commit is contained in:
Vinnie Falco
2017-07-07 17:47:24 -07:00
parent f65a611b85
commit 0324dc371f
9 changed files with 34 additions and 31 deletions

View File

@ -1,6 +1,7 @@
Version 76:
* Always go through write_some
* Use Boost.Config
--------------------------------------------------------------------------------

View File

@ -8,28 +8,22 @@
#ifndef BEAST_UNIT_TEST_DSTREAM_HPP
#define BEAST_UNIT_TEST_DSTREAM_HPP
#include <boost/config.hpp>
#include <ios>
#include <memory>
#include <ostream>
#include <streambuf>
#include <string>
#ifdef _MSC_VER
# ifndef NOMINMAX
# define NOMINMAX 1
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
# undef NOMINMAX
#ifdef BOOST_WINDOWS
#include <boost/detail/winapi/basic_types.hpp>
#include <boost/detail/winapi/debugapi.hpp>
#endif
namespace beast {
namespace unit_test {
#ifdef _MSC_VER
#ifdef BOOST_WINDOWS
namespace detail {
@ -48,14 +42,14 @@ class dstream_buf
void write(char const* s)
{
if(dbg_)
OutputDebugStringA(s);
boost::detail::winapi::OutputDebugStringA(s);
os_ << s;
}
void write(wchar_t const* s)
{
if(dbg_)
OutputDebugStringW(s);
boost::detail::winapi::OutputDebugStringW(s);
os_ << s;
}
@ -63,7 +57,7 @@ public:
explicit
dstream_buf(ostream& os)
: os_(os)
, dbg_(IsDebuggerPresent() != FALSE)
, dbg_(boost::detail::winapi::IsDebuggerPresent() != 0)
{
}

View File

@ -11,12 +11,13 @@
#include <beast/unit_test/match.hpp>
#include <beast/unit_test/reporter.hpp>
#include <beast/unit_test/suite.hpp>
#include <boost/config.hpp>
#include <boost/program_options.hpp>
#include <cstdlib>
#include <iostream>
#include <vector>
#ifdef _MSC_VER
#ifdef BOOST_MSVC
# ifndef WIN32_LEAN_AND_MEAN // VC_EXTRALEAN
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
@ -78,7 +79,7 @@ int main(int ac, char const* av[])
using namespace std;
using namespace beast::unit_test;
#ifdef _MSC_VER
#if BOOST_MSVC
{
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
flags |= _CRTDBG_LEAK_CHECK_DF;

View File

@ -8,6 +8,9 @@
#ifndef BEAST_CONFIG_HPP
#define BEAST_CONFIG_HPP
#include <boost/config.hpp>
// Available to every header
#include <boost/core/ignore_unused.hpp>
#include <boost/static_assert.hpp>
@ -20,8 +23,8 @@
14.0 (2015 Update 3) 1900 190024210
*/
#if defined(_MSC_FULL_VER)
#if _MSC_FULL_VER < 190024210
#ifdef BOOST_MSVC
#if BOOST_MSVC_FULL_VER < 190024210
static_assert(false,
"This library requires Visual Studio 2015 Update 3 or later");
#endif

View File

@ -20,7 +20,7 @@
#if ! BEAST_NO_INTRINSICS
#if defined(BOOST_MSVC)
#ifdef BOOST_MSVC
#include <intrin.h> // __cpuid
#else
#include <cpuid.h> // __get_cpuid
@ -41,7 +41,7 @@ cpuid(
std::uint32_t& ecx,
std::uint32_t& edx)
{
#if defined(BOOST_MSVC)
#ifdef BOOST_MSVC
int regs[4];
__cpuid(regs, id);
eax = regs[0];

View File

@ -8,6 +8,7 @@
#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_HPP
#define BEAST_DETAIL_INTEGER_SEQUENCE_HPP
#include <boost/config.hpp>
#include <cstddef>
#include <type_traits>
#include <utility>
@ -39,9 +40,9 @@ struct sizeof_workaround
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>
struct make_integer_sequence_unchecked;

View File

@ -10,7 +10,9 @@
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#ifdef _MSC_VER
#include <boost/config.hpp>
#ifdef BOOST_MSVC
# pragma warning (push)
# pragma warning (disable: 4127) // conditional expression is constant
# pragma warning (disable: 4244) // integer conversion, possible loss of data
@ -18,7 +20,7 @@
#include "nodejs-parser/http_parser.c"
#ifdef _MSC_VER
#ifdef BOOST_MSVC
# pragma warning (pop)
#endif

View File

@ -7,6 +7,7 @@
#include <beast/core.hpp>
#include <boost/asio.hpp>
#include <boost/config.hpp>
#include <iostream>
#include <thread>
@ -191,7 +192,7 @@ print_response(SyncReadStream& stream)
//]
#ifdef _MSC_VER
#ifdef BOOST_MSVC
//[http_snippet_14
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
template<bool isRequest, class Body, class Fields>

View File

@ -217,7 +217,7 @@ boost::asio::ip::tcp::socket sock{ios};
} // fxx()
// workaround for https://github.com/chriskohlhoff/asio/issues/112
#ifdef _MSC_VER
#ifdef BOOST_MSVC
//[ws_snippet_21
void echo(stream<boost::asio::ip::tcp::socket>& ws,
multi_buffer& buffer, boost::asio::yield_context yield)