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: Version 152:
* Refactor detect_ssl_op * Refactor detect_ssl_op

View File

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

View File

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

View File

@ -48,12 +48,6 @@
#endif #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 \ #define BOOST_BEAST_DEPRECATION_STRING \
"This is a deprecated interface, #define BOOST_BEAST_ALLOW_DEPRECATED to allow it" "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: case 2:
s_.buffer_.commit(bytes_transferred); s_.buffer_.commit(bytes_transferred);
BOOST_BEAST_FALLTHROUGH; BOOST_FALLTHROUGH;
case 3: case 3:
bytes_transferred = bytes_transferred =

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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