Skip to content
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Checks: "-*,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-empty-catch,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-inaccurate-erase,
Expand Down Expand Up @@ -83,7 +84,6 @@ Checks: "-*,
# ---
# checks that have some issues that need to be resolved:
#
# bugprone-empty-catch,
# bugprone-crtp-constructor-accessibility,
# bugprone-inc-dec-in-conditions,
# bugprone-reserved-identifier,
Expand Down
2 changes: 2 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ words:
- nixfmt
- nixos
- nixpkgs
- NOLINT
- NOLINTNEXTLINE
- nonxrp
- noripple
- nudb
Expand Down
2 changes: 1 addition & 1 deletion src/libxrpl/beast/insight/StatsDCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class StatsDCollectorImp : public StatsDCollector,
{
m_timer.cancel();
}
catch (boost::system::system_error const&)
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
{
// ignored
}
Expand Down
2 changes: 1 addition & 1 deletion src/libxrpl/nodestore/backend/NuDBFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class NuDBBackend : public Backend
// close can throw and we don't want the destructor to throw.
close();
}
catch (nudb::system_error const&)
catch (nudb::system_error const&) // NOLINT(bugprone-empty-catch)
{
// Don't allow exceptions to propagate out of destructors.
// close() has already logged the error.
Expand Down
8 changes: 4 additions & 4 deletions src/libxrpl/protocol/STAmount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ getRate(STAmount const& offerOut, STAmount const& offerIn)
{
if (offerOut == beast::zero)
return 0;

try
{
STAmount r = divide(offerIn, offerOut, noIssue());
Expand All @@ -454,12 +455,11 @@ getRate(STAmount const& offerOut, STAmount const& offerIn)
std::uint64_t ret = r.exponent() + 100;
return (ret << (64 - 8)) | r.mantissa();
}
catch (std::exception const&)
catch (...)
{
// overflow -- very bad offer
return 0;
}

// overflow -- very bad offer
return 0;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/libxrpl/protocol/STTx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ STTx::checkSign(Rules const& rules, STObject const& sigObject) const
return signingPubKey.empty() ? checkMultiSign(rules, sigObject)
: checkSingleSign(sigObject);
}
catch (std::exception const&)
catch (...)
{
return Unexpected("Internal signature check failure.");
}
return Unexpected("Internal signature check failure.");
}

Expected<void, std::string>
Expand Down
2 changes: 1 addition & 1 deletion src/libxrpl/tx/transactors/XChainBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,8 @@ toClaim(STTx const& tx)
}
catch (...)
{
return std::nullopt;
}
return std::nullopt;
}

template <class TAttestation>
Expand Down
4 changes: 2 additions & 2 deletions src/test/app/Manifest_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Manifest_test : public beast::unit_test::suite
{
setupDatabaseDir(getDatabasePath());
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
}
}
Expand All @@ -81,7 +81,7 @@ class Manifest_test : public beast::unit_test::suite
{
cleanupDatabaseDir(getDatabasePath());
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/core/SociDB_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SociDB_test final : public TestSuite
{
setupDatabaseDir(getDatabasePath());
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
}
}
Expand All @@ -68,7 +68,7 @@ class SociDB_test final : public TestSuite
{
cleanupDatabaseDir(getDatabasePath());
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/jtx/impl/Env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ Env::st(JTx const& jt)
{
return sterilize(STTx{std::move(*obj)});
}
catch (std::exception const&)
catch (...)
{
return nullptr;
}
return nullptr;
}

std::shared_ptr<STTx const>
Expand All @@ -613,10 +613,10 @@ Env::ust(JTx const& jt)
{
return std::make_shared<STTx const>(std::move(*obj));
}
catch (std::exception const&)
catch (...)
{
return nullptr;
}
return nullptr;
}

Json::Value
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/Oracle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ validDocumentID(AnyValue const& v)
}
catch (...)
{
return false;
}
return false;
}

} // namespace oracle
Expand Down
1 change: 1 addition & 0 deletions src/test/jtx/impl/WSClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class WSClientImpl : public WSClient
{
stream_.cancel();
}
// NOLINTNEXTLINE(bugprone-empty-catch)
catch (boost::system::system_error const&)
{
// ignored
Expand Down
12 changes: 6 additions & 6 deletions src/tests/libxrpl/basics/scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TEST(scope, scope_exit)
scope_exit x{[&i]() { i = 5; }};
throw 1;
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}
}
Expand All @@ -47,7 +47,7 @@ TEST(scope, scope_exit)
x.release();
throw 1;
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}
}
Expand Down Expand Up @@ -85,7 +85,7 @@ TEST(scope, scope_fail)
scope_fail x{[&i]() { i = 5; }};
throw 1;
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}
}
Expand All @@ -97,7 +97,7 @@ TEST(scope, scope_fail)
x.release();
throw 1;
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ TEST(scope, scope_success)
scope_success x{[&i]() { i = 5; }};
throw 1;
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}
}
Expand All @@ -147,7 +147,7 @@ TEST(scope, scope_success)
x.release();
throw 1;
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/ledger/detail/InboundLedgers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class InboundLedgersImp : public InboundLedgers
newNode->getHash().as_uint256(), std::make_shared<Blob>(s.begin(), s.end()));
}
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/ledger/detail/LedgerMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ LedgerMaster::getLedgerBySeq(std::uint32_t index)
if (hash)
return mLedgerHistory.getLedgerByHash(*hash);
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
// Missing nodes are already handled
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/ledger/detail/SkipListAcquire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ SkipListAcquire::processData(
return;
}
}
catch (...)
catch (...) // NOLINT(bugprone-empty-catch)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/main/GRPCServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ getEndpoint(std::string const& peer)
if (endpoint)
return beast::IP::to_asio_endpoint(endpoint.value());
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
}
return {};
Expand Down
4 changes: 2 additions & 2 deletions src/xrpld/app/misc/detail/ValidatorSite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ ValidatorSite::stop()
{
timer_.cancel();
}
catch (boost::system::system_error const&)
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
{
}
stopping_ = false;
Expand Down Expand Up @@ -222,7 +222,7 @@ ValidatorSite::makeRequest(
{
timer_.cancel_one();
}
catch (boost::system::system_error const&)
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
{
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/overlay/detail/ConnectAttempt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ConnectAttempt::cancelTimer()
timer_.cancel();
stepTimer_.cancel();
}
catch (boost::system::system_error const&)
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
{
// ignored
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/rpc/detail/RPCCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ rpcClient(
setup = setup_ServerHandler(
config, beast::logstream{logs.journal("HTTPClient").warn()});
}
catch (std::exception const&)
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
{
// ignore any exceptions, so the command
// line client works without a config file
Expand Down
Loading