Remove BOOST_VERSION checks

fix #722
This commit is contained in:
Vinnie Falco
2018-01-05 17:46:34 -08:00
parent be14786550
commit 3546eff033
14 changed files with 53 additions and 97 deletions

View File

@ -1,3 +1,9 @@
Version 153:
* Remove BOOST_VERSION checks
--------------------------------------------------------------------------------
Version 152:
* Refactor detect_ssl_op

View File

@ -12,8 +12,8 @@
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/type_traits.hpp>
#include <boost/beast/core/detail/in_place_init.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/optional/optional.hpp>
#include <cstdint>
#include <type_traits>

View File

@ -11,7 +11,6 @@
#define BOOST_BEAST_BUFFERS_SUFFIX_HPP
#include <boost/beast/core/detail/config.hpp>
#include <boost/beast/core/detail/in_place_init.hpp>
#include <boost/beast/core/detail/type_traits.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/optional.hpp>

View File

@ -48,12 +48,6 @@
#endif
#if BOOST_VERSION >= 106500 || ! defined(BOOST_GCC) || BOOST_GCC < 70000
# define BOOST_BEAST_FALLTHROUGH BOOST_FALLTHROUGH
#else
# define BOOST_BEAST_FALLTHROUGH __attribute__((fallthrough))
#endif
#define BOOST_BEAST_DEPRECATION_STRING \
"This is a deprecated interface, #define BOOST_BEAST_ALLOW_DEPRECATED to allow it"

View File

@ -1,43 +0,0 @@
//
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_DETAIL_IN_PLACE_INIT_HPP
#define BOOST_BEAST_DETAIL_IN_PLACE_INIT_HPP
#include <boost/version.hpp>
#include <boost/optional/optional.hpp>
// Provide boost::in_place_init_t and boost::in_place_init
// for Boost versions earlier than 1.63.0.
#if BOOST_VERSION < 106300
namespace boost {
namespace optional_ns {
// a tag for in-place initialization of contained value
struct in_place_init_t
{
struct init_tag{};
explicit in_place_init_t(init_tag){}
};
const in_place_init_t in_place_init ((in_place_init_t::init_tag()));
} // namespace optional_ns
using optional_ns::in_place_init_t;
using optional_ns::in_place_init;
}
#endif
#endif

View File

@ -121,7 +121,7 @@ read_some_op<MutableBufferSequence, Handler>::operator()(
case 2:
s_.buffer_.commit(bytes_transferred);
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case 3:
bytes_transferred =

View File

@ -148,7 +148,7 @@ loop:
return 0;
}
state_ = state::start_line;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case state::start_line:
{
@ -179,7 +179,7 @@ loop:
ec = error::need_more;
goto done;
}
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case state::fields:
@ -212,7 +212,7 @@ loop:
if(ec)
goto done;
state_ = state::body;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case state::body:
BOOST_ASSERT(! skip_);
@ -227,7 +227,7 @@ loop:
if(ec)
goto done;
state_ = state::body_to_eof;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case state::body_to_eof:
BOOST_ASSERT(! skip_);
@ -241,7 +241,7 @@ loop:
if(ec)
goto done;
state_ = state::chunk_header;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case state::chunk_header:
parse_chunk_header(p, n, ec);

View File

@ -102,7 +102,7 @@ next(error_code& ec, Visit&& visit)
if(m_.chunked())
goto go_init_c;
s_ = do_init;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case do_init:
@ -125,7 +125,7 @@ next(error_code& ec, Visit&& visit)
fwr_->get(),
result->first);
s_ = do_header;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case do_header:
@ -135,14 +135,14 @@ next(error_code& ec, Visit&& visit)
go_header_only:
v_.template emplace<1>(fwr_->get());
s_ = do_header_only;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_header_only:
do_visit<1>(ec, visit);
break;
case do_body:
s_ = do_body + 1;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_body + 1:
{
@ -154,7 +154,7 @@ next(error_code& ec, Visit&& visit)
more_ = result->second;
v_.template emplace<3>(result->first);
s_ = do_body + 2;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case do_body + 2:
@ -165,7 +165,7 @@ next(error_code& ec, Visit&& visit)
go_init_c:
s_ = do_init_c;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_init_c:
{
wr_.init(ec);
@ -206,7 +206,7 @@ next(error_code& ec, Visit&& visit)
result->first,
chunk_crlf{});
s_ = do_header_c;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case do_header_c:
@ -222,7 +222,7 @@ next(error_code& ec, Visit&& visit)
case do_body_c:
s_ = do_body_c + 1;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_body_c + 1:
{
@ -255,7 +255,7 @@ next(error_code& ec, Visit&& visit)
result->first,
chunk_crlf{});
s_ = do_body_c + 2;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case do_body_c + 2:
@ -264,14 +264,14 @@ next(error_code& ec, Visit&& visit)
go_body_final_c:
s_ = do_body_final_c;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_body_final_c:
do_visit<6>(ec, visit);
break;
go_all_c:
s_ = do_all_c;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_all_c:
do_visit<7>(ec, visit);
break;
@ -284,7 +284,7 @@ next(error_code& ec, Visit&& visit)
boost::asio::const_buffer{nullptr, 0},
chunk_crlf{});
s_ = do_final_c + 1;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case do_final_c + 1:
do_visit<8>(ec, visit);

View File

@ -28,7 +28,7 @@ int_to_status(unsigned v)
case status::continue_:
case status::switching_protocols:
case status::processing:
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
// 2xx
case status::ok:
@ -41,7 +41,7 @@ int_to_status(unsigned v)
case status::multi_status:
case status::already_reported:
case status::im_used:
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
// 3xx
case status::multiple_choices:
@ -52,7 +52,7 @@ int_to_status(unsigned v)
case status::use_proxy:
case status::temporary_redirect:
case status::permanent_redirect:
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
// 4xx
case status::bad_request:
@ -84,7 +84,7 @@ int_to_status(unsigned v)
case status::connection_closed_without_response:
case status::unavailable_for_legal_reasons:
case status::client_closed_request:
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
// 5xx
case status::internal_server_error:

View File

@ -159,7 +159,7 @@ string_to_verb(string_view v)
return verb::connect;
if(eq(v, "PY"))
return verb::copy;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
default:
break;
@ -220,7 +220,7 @@ string_to_verb(string_view v)
case 'O':
if(eq(v, "VE"))
return verb::move;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
default:
break;
@ -264,7 +264,7 @@ string_to_verb(string_view v)
return verb::purge;
if(eq(v, "T"))
return verb::put;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
default:
break;

View File

@ -280,7 +280,7 @@ operator()(
case 2:
state_ = 3;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case 3:
{

View File

@ -132,15 +132,15 @@ mask_inplace_fast(
std::uintptr_t>(p) & (sizeof(key)-1);
switch(i)
{
case 1: p[2] ^= static_cast<std::uint8_t>(key >> 16); BOOST_BEAST_FALLTHROUGH;
case 2: p[1] ^= static_cast<std::uint8_t>(key >> 8); BOOST_BEAST_FALLTHROUGH;
case 1: p[2] ^= static_cast<std::uint8_t>(key >> 16); BOOST_FALLTHROUGH;
case 2: p[1] ^= static_cast<std::uint8_t>(key >> 8); BOOST_FALLTHROUGH;
case 3: p[0] ^= static_cast<std::uint8_t>(key);
{
auto const d = static_cast<unsigned>(sizeof(key) - i);
key = ror(key, 8*d);
n -= d;
p += d;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
default:
break;
@ -159,11 +159,11 @@ mask_inplace_fast(
n &= sizeof(key)-1;
switch(n)
{
case 3: p[2] ^= static_cast<std::uint8_t>(key >> 16); BOOST_BEAST_FALLTHROUGH;
case 2: p[1] ^= static_cast<std::uint8_t>(key >> 8); BOOST_BEAST_FALLTHROUGH;
case 3: p[2] ^= static_cast<std::uint8_t>(key >> 16); BOOST_FALLTHROUGH;
case 2: p[1] ^= static_cast<std::uint8_t>(key >> 8); BOOST_FALLTHROUGH;
case 1: p[0] ^= static_cast<std::uint8_t>(key);
key = ror(key, static_cast<unsigned>(8*n));
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
default:
break;
}

View File

@ -151,13 +151,13 @@ write(std::uint8_t const* in, std::size_t size)
{
default:
BOOST_ASSERT(false);
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case 1:
cp_[1] = 0x81;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case 2:
cp_[2] = 0x81;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case 3:
cp_[3] = 0x81;
break;

View File

@ -380,12 +380,12 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
mode_ = COPY_;
if(flush == Flush::trees)
return done();
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case COPY_:
mode_ = COPY;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case COPY:
{
@ -419,7 +419,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
return err(error::too_many_symbols);
have_ = 0;
mode_ = LENLENS;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case LENLENS:
{
@ -447,7 +447,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
}
have_ = 0;
mode_ = CODELENS;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case CODELENS:
@ -536,12 +536,12 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
mode_ = LEN_;
if(flush == Flush::trees)
return done();
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case LEN_:
mode_ = LEN;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case LEN:
{
@ -594,7 +594,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
return err(error::invalid_literal_length);
extra_ = cp->op & 15;
mode_ = LENEXT;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case LENEXT:
@ -609,7 +609,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
}
was_ = length_;
mode_ = DIST;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case DIST:
{
@ -638,7 +638,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
offset_ = cp->val;
extra_ = cp->op & 15;
mode_ = DISTEXT;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
}
case DISTEXT:
@ -656,7 +656,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
return err(error::invalid_distance);
#endif
mode_ = MATCH;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case MATCH:
{
@ -701,7 +701,7 @@ doWrite(z_params& zs, Flush flush, error_code& ec)
case CHECK:
mode_ = DONE;
BOOST_BEAST_FALLTHROUGH;
BOOST_FALLTHROUGH;
case DONE:
ec = error::end_of_stream;