Tidy up fallthrough warning

This commit is contained in:
Vinnie Falco
2017-10-27 16:05:09 -07:00
parent 79bb602a20
commit 970daa340a
5 changed files with 31 additions and 20 deletions

View File

@ -1,3 +1,9 @@
Version 130:
* Tidy up fallthrough warning
--------------------------------------------------------------------------------
Version 129: Version 129:
* Add autobahn test report to doc * Add autobahn test report to doc

View File

@ -113,6 +113,7 @@ next(error_code& ec, Visit&& visit)
go_header_only: go_header_only:
v_.template emplace<1>(frd_->get()); v_.template emplace<1>(frd_->get());
s_ = do_header_only; s_ = do_header_only;
BOOST_BEAST_FALLTHROUGH;
case do_header_only: case do_header_only:
do_visit<1>(ec, visit); do_visit<1>(ec, visit);
break; break;
@ -140,8 +141,9 @@ next(error_code& ec, Visit&& visit)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
go_init_c: go_init_c:
s_ = do_init_c; s_ = do_init_c;
BOOST_BEAST_FALLTHROUGH;
case do_init_c: case do_init_c:
{ {
rd_.init(ec); rd_.init(ec);
@ -240,12 +242,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;
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;
case do_all_c: case do_all_c:
do_visit<7>(ec, visit); do_visit<7>(ec, visit);
break; break;

View File

@ -10,6 +10,7 @@
#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP #ifndef BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP
#define BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP #define BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP
#include <boost/beast/core/detail/config.hpp>
#include <boost/asio/buffer.hpp> #include <boost/asio/buffer.hpp>
#include <array> #include <array>
#include <climits> #include <climits>
@ -131,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); 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); case 2: p[1] ^= static_cast<std::uint8_t>(key >> 8); BOOST_BEAST_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< auto const d = static_cast<unsigned>(sizeof(key) - i);
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;
} }
default: default:
break; break;
@ -158,10 +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); 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); case 2: p[1] ^= static_cast<std::uint8_t>(key >> 8); BOOST_BEAST_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;
default: default:
break; break;
} }

View File

@ -160,7 +160,6 @@ write(std::uint8_t const* in, std::size_t size)
BOOST_BEAST_FALLTHROUGH; BOOST_BEAST_FALLTHROUGH;
case 3: case 3:
cp_[3] = 0x81; cp_[3] = 0x81;
BOOST_BEAST_FALLTHROUGH;
break; break;
} }
std::uint8_t const* p = cp_; std::uint8_t const* p = cp_;

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();
// fall through BOOST_BEAST_FALLTHROUGH;
} }
case COPY_: case COPY_:
mode_ = COPY; mode_ = COPY;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_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();
// fall through BOOST_BEAST_FALLTHROUGH;
} }
case LEN_: case LEN_:
mode_ = LEN; mode_ = LEN;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_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;
// fall through BOOST_BEAST_FALLTHROUGH;
case DONE: case DONE:
ec = error::end_of_stream; ec = error::end_of_stream;