Skip to content

Commit 277450e

Browse files
committed
Merge branch 'develop' into bthomee/node_depth
2 parents e699352 + afc660a commit 277450e

File tree

20 files changed

+52
-43
lines changed

20 files changed

+52
-43
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Checks: "-*,
1010
bugprone-copy-constructor-init,
1111
bugprone-dangling-handle,
1212
bugprone-dynamic-static-initializers,
13+
bugprone-empty-catch,
1314
bugprone-fold-init-type,
1415
bugprone-forward-declaration-namespace,
1516
bugprone-inaccurate-erase,
@@ -83,7 +84,6 @@ Checks: "-*,
8384
# ---
8485
# checks that have some issues that need to be resolved:
8586
#
86-
# bugprone-empty-catch,
8787
# bugprone-crtp-constructor-accessibility,
8888
# bugprone-inc-dec-in-conditions,
8989
# bugprone-reserved-identifier,

cspell.config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ words:
176176
- nixfmt
177177
- nixos
178178
- nixpkgs
179+
- NOLINT
180+
- NOLINTNEXTLINE
179181
- nonxrp
180182
- noripple
181183
- nudb

src/libxrpl/beast/insight/StatsDCollector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class StatsDCollectorImp : public StatsDCollector,
249249
{
250250
m_timer.cancel();
251251
}
252-
catch (boost::system::system_error const&)
252+
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
253253
{
254254
// ignored
255255
}

src/libxrpl/nodestore/backend/NuDBFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class NuDBBackend : public Backend
8383
// close can throw and we don't want the destructor to throw.
8484
close();
8585
}
86-
catch (nudb::system_error const&)
86+
catch (nudb::system_error const&) // NOLINT(bugprone-empty-catch)
8787
{
8888
// Don't allow exceptions to propagate out of destructors.
8989
// close() has already logged the error.

src/libxrpl/protocol/STAmount.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ getRate(STAmount const& offerOut, STAmount const& offerIn)
443443
{
444444
if (offerOut == beast::zero)
445445
return 0;
446+
446447
try
447448
{
448449
STAmount r = divide(offerIn, offerOut, noIssue());
@@ -454,12 +455,11 @@ getRate(STAmount const& offerOut, STAmount const& offerIn)
454455
std::uint64_t ret = r.exponent() + 100;
455456
return (ret << (64 - 8)) | r.mantissa();
456457
}
457-
catch (std::exception const&)
458+
catch (...)
458459
{
460+
// overflow -- very bad offer
461+
return 0;
459462
}
460-
461-
// overflow -- very bad offer
462-
return 0;
463463
}
464464

465465
/**

src/libxrpl/protocol/STTx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ STTx::checkSign(Rules const& rules, STObject const& sigObject) const
246246
return signingPubKey.empty() ? checkMultiSign(rules, sigObject)
247247
: checkSingleSign(sigObject);
248248
}
249-
catch (std::exception const&)
249+
catch (...)
250250
{
251+
return Unexpected("Internal signature check failure.");
251252
}
252-
return Unexpected("Internal signature check failure.");
253253
}
254254

255255
Expected<void, std::string>

src/libxrpl/tx/transactors/XChainBridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,8 @@ toClaim(STTx const& tx)
11261126
}
11271127
catch (...)
11281128
{
1129+
return std::nullopt;
11291130
}
1130-
return std::nullopt;
11311131
}
11321132

11331133
template <class TAttestation>

src/test/app/Manifest_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Manifest_test : public beast::unit_test::suite
7171
{
7272
setupDatabaseDir(getDatabasePath());
7373
}
74-
catch (std::exception const&)
74+
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
7575
{
7676
}
7777
}
@@ -81,7 +81,7 @@ class Manifest_test : public beast::unit_test::suite
8181
{
8282
cleanupDatabaseDir(getDatabasePath());
8383
}
84-
catch (std::exception const&)
84+
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
8585
{
8686
}
8787
}

src/test/core/SociDB_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class SociDB_test final : public TestSuite
5858
{
5959
setupDatabaseDir(getDatabasePath());
6060
}
61-
catch (std::exception const&)
61+
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
6262
{
6363
}
6464
}
@@ -68,7 +68,7 @@ class SociDB_test final : public TestSuite
6868
{
6969
cleanupDatabaseDir(getDatabasePath());
7070
}
71-
catch (std::exception const&)
71+
catch (std::exception const&) // NOLINT(bugprone-empty-catch)
7272
{
7373
}
7474
}

src/test/jtx/impl/Env.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,10 @@ Env::st(JTx const& jt)
587587
{
588588
return sterilize(STTx{std::move(*obj)});
589589
}
590-
catch (std::exception const&)
590+
catch (...)
591591
{
592+
return nullptr;
592593
}
593-
return nullptr;
594594
}
595595

596596
std::shared_ptr<STTx const>
@@ -613,10 +613,10 @@ Env::ust(JTx const& jt)
613613
{
614614
return std::make_shared<STTx const>(std::move(*obj));
615615
}
616-
catch (std::exception const&)
616+
catch (...)
617617
{
618+
return nullptr;
618619
}
619-
return nullptr;
620620
}
621621

622622
Json::Value

0 commit comments

Comments
 (0)