Skip to content

Commit

Permalink
Use [[fallthrough]] in some switch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
seelabs committed Aug 23, 2019
1 parent 70c2e1b commit 92925a0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/beast/extras/beast/unit_test/match.hpp
Expand Up @@ -110,7 +110,6 @@ selector::operator()(suite_info const& s)

case all:
default:
// fall through
break;
};

Expand Down
1 change: 1 addition & 0 deletions src/ripple/app/ledger/OpenLedger.h
Expand Up @@ -248,6 +248,7 @@ OpenLedger::apply (Application& app, OpenView& view,
{
case Result::success:
++changes;
[[fallthrough]];
case Result::failure:
iter = retries.erase (iter);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/ledger/impl/InboundLedger.cpp
Expand Up @@ -475,7 +475,7 @@ void InboundLedger::done ()
{
case Reason::SHARD:
app_.getShardStore()->setStored(mLedger);
// TODO c++17: [[fallthrough]]
[[fallthrough]];
case Reason::HISTORY:
app_.getInboundLedgers().onLedgerFetched();
break;
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/app/tx/impl/apply.cpp
Expand Up @@ -90,10 +90,10 @@ forceValidity(HashRouter& router, uint256 const& txid,
{
case Validity::Valid:
flags |= SF_LOCALGOOD;
// fall through
[[fallthrough]];
case Validity::SigGoodOnly:
flags |= SF_SIGGOOD;
// fall through
[[fallthrough]];
case Validity::SigBad:
// would be silly to call directly
break;
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/tx/impl/applySteps.cpp
Expand Up @@ -215,7 +215,7 @@ invoke_calculateConsequences(STTx const& tx)
case ttTRUST_SET: return invoke_calculateConsequences<SetTrust>(tx);
case ttAMENDMENT:
case ttFEE:
// fall through to default
[[fallthrough]];
default:
assert(false);
return { TxConsequences::blocker, Transactor::calculateFeePaid(tx),
Expand Down
3 changes: 3 additions & 0 deletions src/ripple/basics/impl/Log.cpp
Expand Up @@ -216,6 +216,7 @@ Logs::fromSeverity (beast::severities::Severity level)

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

Expand Down

0 comments on commit 92925a0

Please sign in to comment.