Skip to content

Commit

Permalink
Fix or silence a few more tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Aug 5, 2024
1 parent c361cdf commit 855e7f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ql/experimental/math/laplaceinterpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ for (auto const& m : map_)
// handling of the "corners", all second derivs are zero in the op
// this directly generalizes Numerical Recipes, 3rd ed, eq 3.8.6
Real sum_corner_h =
std::accumulate(corner_h.begin(), corner_h.end(), Real(0.0), std::plus<Real>());
std::accumulate(corner_h.begin(), corner_h.end(), Real(0.0), std::plus<>());
for (Size j = 0; j < dim.size(); ++j) {
std::vector<Size> coord_j(coord);
coord_j[j] = corner_neighbour_index[j];
Expand Down
3 changes: 2 additions & 1 deletion ql/instruments/makecds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ namespace QuantLib {
end = tradeDate + *tenor_;
}
} else {
end = *termDate_;
// we have two exclusive constructors; if we don't have a tenor, we have a term date
end = *termDate_; // NOLINT(bugprone-unchecked-optional-access)
}

Schedule schedule(protectionStart, end, couponTenor_, WeekendsOnly(), Following,
Expand Down
2 changes: 1 addition & 1 deletion ql/pricingengines/swap/discretizedswap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace QuantLib {

// NOLINTNEXTLINE(readability-implicit-bool-conversion)
auto includeTodaysCashFlows = Settings::instance().includeTodaysCashFlows() &&
*Settings::instance().includeTodaysCashFlows();
*Settings::instance().includeTodaysCashFlows(); // NOLINT(bugprone-unchecked-optional-access)

auto nrOfFixedCoupons = args.fixedResetDates.size();
fixedResetTimes_.resize(nrOfFixedCoupons);
Expand Down
6 changes: 3 additions & 3 deletions test-suite/quantlibbenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ namespace {
Benchmark(Benchmark&& move) = default;
Benchmark& operator=(const Benchmark &other) = default;
Benchmark& operator=(Benchmark &&other) = default;
~Benchmark() = default;

double getCost() const { return cost_; }
std::string getName() const { return name_; }
Expand Down Expand Up @@ -262,8 +263,7 @@ namespace {
std::string msg = "Unable to find the Boost test unit for Benchmark '";
msg += b.getName();
msg += "'";
std::runtime_error err(msg);
throw err;
throw std::runtime_error(msg);
}
}
}
Expand Down Expand Up @@ -575,7 +575,7 @@ QL_BENCHMARK_DECLARE(RoundingTests, testClosest, 100000, 0.1);



int main(int argc, char* argv[] )
int main(int argc, char* argv[] ) // NOLINT(bugprone-exception-escape)
{
const std::string clientModeStr = "--client_mode=true";
bool clientMode = false;
Expand Down
4 changes: 2 additions & 2 deletions test-suite/quantlibglobalfixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ QuantLibGlobalFixture::QuantLibGlobalFixture() {
? "reference date events are included,\n"
: "reference date events are excluded,\n")
<< (settings.includeTodaysCashFlows()
? (*settings.includeTodaysCashFlows()
? (*settings.includeTodaysCashFlows() // NOLINT(bugprone-unchecked-optional-access)
? "today's cashflows are included,\n"
: "today's cashflows are excluded,\n")
: "")
Expand Down Expand Up @@ -166,4 +166,4 @@ SpeedLevel speed_level(int argc, char** argv) {
return Faster;
}
return Slow;
}
}

0 comments on commit 855e7f4

Please sign in to comment.