diff --git a/CHANGELOG.md b/CHANGELOG.md index 913e8166..7c6f4040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 51 * Fix operator<< for header * Tidy up file_body * Fix file_body::get() not setting the more flag correctly +* Use BOOST_FALLTHROUGH API Changes: diff --git a/include/beast/http/impl/basic_parser.ipp b/include/beast/http/impl/basic_parser.ipp index 00eb3a55..343760a4 100644 --- a/include/beast/http/impl/basic_parser.ipp +++ b/include/beast/http/impl/basic_parser.ipp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -114,7 +115,7 @@ loop: return 0; } state_ = state::header; - // [[fallthrough]] + BOOST_FALLTHROUGH; case state::header: parse_header(p, n, ec); @@ -127,7 +128,7 @@ loop: if(ec) goto done; state_ = state::body; - // [[fallthrough]] + BOOST_FALLTHROUGH; case state::body: parse_body(p, n, ec); @@ -140,7 +141,7 @@ loop: if(ec) goto done; state_ = state::body_to_eof; - // [[fallthrough]] + BOOST_FALLTHROUGH; case state::body_to_eof: parse_body_to_eof(p, n, ec); @@ -153,7 +154,7 @@ loop: if(ec) goto done; state_ = state::chunk_header; - // [[fallthrough]] + BOOST_FALLTHROUGH; case state::chunk_header: parse_chunk_header(p, n, ec); diff --git a/include/beast/http/impl/read.ipp b/include/beast/http/impl/read.ipp index cc3fe2da..06f354aa 100644 --- a/include/beast/http/impl/read.ipp +++ b/include/beast/http/impl/read.ipp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -139,7 +140,7 @@ operator()(error_code ec, std::size_t bytes_transferred) if(! ec || ec != http::error::need_more) goto do_upcall; ec = {}; - // [[fallthrough]] + BOOST_FALLTHROUGH; do_read: try @@ -277,7 +278,7 @@ operator()(error_code ec) bind_handler(std::move(*this), ec)); } state_ = 2; - // [[fallthrough]] + BOOST_FALLTHROUGH; do_read: return async_read_some( diff --git a/include/beast/http/impl/serializer.ipp b/include/beast/http/impl/serializer.ipp index 79df9268..0a226864 100644 --- a/include/beast/http/impl/serializer.ipp +++ b/include/beast/http/impl/serializer.ipp @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace beast { @@ -63,7 +64,7 @@ get(error_code& ec, Visit&& visit) if(m_.has_chunked()) goto go_init_c; s_ = do_init; - // [[fallthrough]] + BOOST_FALLTHROUGH; } case do_init: @@ -89,7 +90,7 @@ get(error_code& ec, Visit&& visit) frd_->get(), result->first}; s_ = do_header; - // [[fallthrough]] + BOOST_FALLTHROUGH; } case do_header: @@ -110,7 +111,7 @@ get(error_code& ec, Visit&& visit) if(ec) return; s_ = do_body + 1; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_body + 1: { @@ -122,7 +123,7 @@ get(error_code& ec, Visit&& visit) more_ = result->second; v_ = cb1_t{result->first}; s_ = do_body + 2; - // [[fallthrough]] + BOOST_FALLTHROUGH; } case do_body + 2: @@ -167,7 +168,7 @@ get(error_code& ec, Visit&& visit) result->first, detail::chunk_crlf()}; s_ = do_header_c; - // [[fallthrough]] + BOOST_FALLTHROUGH; } case do_header_c: @@ -188,7 +189,7 @@ get(error_code& ec, Visit&& visit) if(ec) return; s_ = do_body_c + 1; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_body_c + 1: { @@ -213,7 +214,7 @@ get(error_code& ec, Visit&& visit) result->first, detail::chunk_crlf()}; s_ = do_body_c + 2; - // [[fallthrough]] + BOOST_FALLTHROUGH; } case do_body_c + 2: @@ -235,7 +236,7 @@ get(error_code& ec, Visit&& visit) }(), detail::chunk_crlf()}; s_ = do_final_c + 1; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_final_c + 1: visit(ec, boost::get(v_)); diff --git a/include/beast/http/impl/status.ipp b/include/beast/http/impl/status.ipp index 5a7d579b..6058247a 100644 --- a/include/beast/http/impl/status.ipp +++ b/include/beast/http/impl/status.ipp @@ -8,6 +8,7 @@ #ifndef BEAST_HTTP_IMPL_STATUS_IPP #define BEAST_HTTP_IMPL_STATUS_IPP +#include #include namespace beast { @@ -24,7 +25,7 @@ int_to_status(int v) case status::continue_: case status::switching_protocols: case status::processing: - // [[fallthrough]] + BOOST_FALLTHROUGH; // 2xx case status::ok: @@ -37,7 +38,7 @@ int_to_status(int v) case status::multi_status: case status::already_reported: case status::im_used: - // [[fallthrough]] + BOOST_FALLTHROUGH; // 3xx case status::multiple_choices: @@ -48,7 +49,7 @@ int_to_status(int v) case status::use_proxy: case status::temporary_redirect: case status::permanent_redirect: - // [[fallthrough]] + BOOST_FALLTHROUGH; // 4xx case status::bad_request: @@ -80,7 +81,7 @@ int_to_status(int v) case status::connection_closed_without_response: case status::unavailable_for_legal_reasons: case status::client_closed_request: - // [[fallthrough]] + BOOST_FALLTHROUGH; // 5xx case status::internal_server_error: diff --git a/include/beast/http/impl/verb.ipp b/include/beast/http/impl/verb.ipp index f72e1089..a898d718 100644 --- a/include/beast/http/impl/verb.ipp +++ b/include/beast/http/impl/verb.ipp @@ -8,6 +8,7 @@ #ifndef BEAST_HTTP_IMPL_VERB_IPP #define BEAST_HTTP_IMPL_VERB_IPP +#include #include #include @@ -155,7 +156,7 @@ string_to_verb(string_view v) return verb::connect; if(eq(v, "PY")) return verb::copy; - // [[fallthrough]] + BOOST_FALLTHROUGH; default: break; @@ -216,7 +217,7 @@ string_to_verb(string_view v) case 'O': if(eq(v, "VE")) return verb::move; - // [[fallthrough]] + BOOST_FALLTHROUGH; default: break; @@ -260,7 +261,7 @@ string_to_verb(string_view v) return verb::purge; if(eq(v, "T")) return verb::put; - // [[fallthrough]] + BOOST_FALLTHROUGH; default: break; diff --git a/include/beast/http/impl/write.ipp b/include/beast/http/impl/write.ipp index 5742eed2..a71cf2ca 100644 --- a/include/beast/http/impl/write.ipp +++ b/include/beast/http/impl/write.ipp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -317,7 +318,7 @@ operator()(error_code ec, case 2: state_ = 3; - // [[fallthrough]] + BOOST_FALLTHROUGH; case 3: { diff --git a/include/beast/websocket/impl/close.ipp b/include/beast/websocket/impl/close.ipp index e6ac1083..43d68ef7 100644 --- a/include/beast/websocket/impl/close.ipp +++ b/include/beast/websocket/impl/close.ipp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -153,7 +154,7 @@ operator()(error_code ec, bool again) return; } d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case 1: // send close frame diff --git a/include/beast/websocket/impl/ping.ipp b/include/beast/websocket/impl/ping.ipp index 5083cb9e..598953f0 100644 --- a/include/beast/websocket/impl/ping.ipp +++ b/include/beast/websocket/impl/ping.ipp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -152,7 +153,7 @@ operator()(error_code ec, bool again) return; } d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case 1: // send ping frame diff --git a/include/beast/websocket/impl/read.ipp b/include/beast/websocket/impl/read.ipp index ed1f157d..eba9bab4 100644 --- a/include/beast/websocket/impl/read.ipp +++ b/include/beast/websocket/impl/read.ipp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -522,7 +523,7 @@ operator()(error_code ec, ec = boost::asio::error::operation_aborted; goto upcall; } - // [[fallthrough]] + BOOST_FALLTHROUGH; //------------------------------------------------------------------ diff --git a/include/beast/websocket/impl/write.ipp b/include/beast/websocket/impl/write.ipp index a3dbd242..36a4a971 100644 --- a/include/beast/websocket/impl/write.ipp +++ b/include/beast/websocket/impl/write.ipp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -230,7 +231,7 @@ operator()(error_code ec, case do_nomask_nofrag: BOOST_ASSERT(! d.ws.wr_block_); d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_nomask_nofrag + 1: { @@ -253,7 +254,7 @@ operator()(error_code ec, case do_nomask_frag: BOOST_ASSERT(! d.ws.wr_block_); d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_nomask_frag + 1: { @@ -301,7 +302,7 @@ operator()(error_code ec, case do_mask_nofrag: BOOST_ASSERT(! d.ws.wr_block_); d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_mask_nofrag + 1: { @@ -353,7 +354,7 @@ operator()(error_code ec, case do_mask_frag: BOOST_ASSERT(! d.ws.wr_block_); d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_mask_frag + 1: { @@ -406,7 +407,7 @@ operator()(error_code ec, case do_deflate: BOOST_ASSERT(! d.ws.wr_block_); d.ws.wr_block_ = &d; - // [[fallthrough]] + BOOST_FALLTHROUGH; case do_deflate + 1: { diff --git a/test/websocket/ssl/websocket_async_ssl_echo_server.hpp b/test/websocket/ssl/websocket_async_ssl_echo_server.hpp index 6a2f0b50..9a5bb4d5 100644 --- a/test/websocket/ssl/websocket_async_ssl_echo_server.hpp +++ b/test/websocket/ssl/websocket_async_ssl_echo_server.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -234,7 +235,7 @@ private: case 2: if(ec) return fail("async_handshake", ec); - // [[fallthrough]] + BOOST_FALLTHROUGH; // WebSocket read case 3: