Use [[fallthrough]] in some switch statements

This commit is contained in:
seelabs
2019-08-07 13:44:56 -07:00
parent 70c2e1b419
commit 92925a0af6
6 changed files with 8 additions and 5 deletions

View File

@@ -110,7 +110,6 @@ selector::operator()(suite_info const& s)
case all: case all:
default: default:
// fall through
break; break;
}; };

View File

@@ -248,6 +248,7 @@ OpenLedger::apply (Application& app, OpenView& view,
{ {
case Result::success: case Result::success:
++changes; ++changes;
[[fallthrough]];
case Result::failure: case Result::failure:
iter = retries.erase (iter); iter = retries.erase (iter);
break; break;

View File

@@ -475,7 +475,7 @@ void InboundLedger::done ()
{ {
case Reason::SHARD: case Reason::SHARD:
app_.getShardStore()->setStored(mLedger); app_.getShardStore()->setStored(mLedger);
// TODO c++17: [[fallthrough]] [[fallthrough]];
case Reason::HISTORY: case Reason::HISTORY:
app_.getInboundLedgers().onLedgerFetched(); app_.getInboundLedgers().onLedgerFetched();
break; break;

View File

@@ -90,10 +90,10 @@ forceValidity(HashRouter& router, uint256 const& txid,
{ {
case Validity::Valid: case Validity::Valid:
flags |= SF_LOCALGOOD; flags |= SF_LOCALGOOD;
// fall through [[fallthrough]];
case Validity::SigGoodOnly: case Validity::SigGoodOnly:
flags |= SF_SIGGOOD; flags |= SF_SIGGOOD;
// fall through [[fallthrough]];
case Validity::SigBad: case Validity::SigBad:
// would be silly to call directly // would be silly to call directly
break; break;

View File

@@ -215,7 +215,7 @@ invoke_calculateConsequences(STTx const& tx)
case ttTRUST_SET: return invoke_calculateConsequences<SetTrust>(tx); case ttTRUST_SET: return invoke_calculateConsequences<SetTrust>(tx);
case ttAMENDMENT: case ttAMENDMENT:
case ttFEE: case ttFEE:
// fall through to default [[fallthrough]];
default: default:
assert(false); assert(false);
return { TxConsequences::blocker, Transactor::calculateFeePaid(tx), return { TxConsequences::blocker, Transactor::calculateFeePaid(tx),

View File

@@ -216,6 +216,7 @@ Logs::fromSeverity (beast::severities::Severity level)
default: default:
assert(false); assert(false);
[[fallthrough]];
case kFatal: case kFatal:
break; break;
} }
@@ -236,6 +237,7 @@ Logs::toSeverity (LogSeverity level)
case lsERROR: return kError; case lsERROR: return kError;
default: default:
assert(false); assert(false);
[[fallthrough]];
case lsFATAL: case lsFATAL:
break; break;
} }
@@ -306,6 +308,7 @@ Logs::format (std::string& output, std::string const& message,
case kError: output += "ERR "; break; case kError: output += "ERR "; break;
default: default:
assert(false); assert(false);
[[fallthrough]];
case kFatal: output += "FTL "; break; case kFatal: output += "FTL "; break;
} }