From 119666110a08a51263eaf4f1aa5174dbd50b88a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 01:23:12 +0000 Subject: [PATCH] Automated fixes by clang-tidy --- ql/time/asx.cpp | 4 ++-- ql/time/ecb.cpp | 8 ++++---- test-suite/quantlibbenchmark.cpp | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ql/time/asx.cpp b/ql/time/asx.cpp index da4d5899559..bf84629e5cf 100644 --- a/ql/time/asx.cpp +++ b/ql/time/asx.cpp @@ -61,7 +61,7 @@ namespace QuantLib { return false; // 2nd character of code needs to be digit - if (!std::isdigit(static_cast(in[1]))) + if (std::isdigit(static_cast(in[1])) == 0) return false; // 1st character needs to represent the correct month @@ -101,7 +101,7 @@ namespace QuantLib { QL_ASSERT(idxZeroBased != All_MONTH_CODES.npos, "invalid ASX month letter. code: " + asxCode); // QuantLib::Month is 1-based! - const QuantLib::Month m = static_cast(idxZeroBased + 1); + const auto m = static_cast(idxZeroBased + 1); // convert 2nd char to year digit Year y = static_cast(asxCode[1]) - static_cast('0'); diff --git a/ql/time/ecb.cpp b/ql/time/ecb.cpp index fba486d6142..71bea514671 100644 --- a/ql/time/ecb.cpp +++ b/ql/time/ecb.cpp @@ -73,7 +73,7 @@ namespace QuantLib { //clang-format off // Start of maintenance period // source: https://web.archive.org/web/20230610050642/https://www.ecb.europa.eu/press/calendars/reserve/html/index.en.html - static std::set ecbKnownDateSet = { + std::set ecbKnownDateSet = { // 2005 Date(38371), Date(38391), Date(38420), Date(38455), Date(38483), Date(38511), Date(38546), Date(38574), Date(38602), Date(38637), Date(38665), Date(38692), @@ -261,8 +261,8 @@ namespace QuantLib { } // 4th, 5th characters need to be digit - return std::isdigit(static_cast(ecbCode[3])) - && std::isdigit(static_cast(ecbCode[4])); + return (std::isdigit(static_cast(ecbCode[3])) != 0) + && (std::isdigit(static_cast(ecbCode[4])) != 0); } string ECB::nextCode(const std::string& ecbCode) { @@ -276,7 +276,7 @@ namespace QuantLib { nextCodeStr.reserve(5); if (monthEnum != December) { // use next month - const Month nextMonthEnum = static_cast(monthEnum + 1); + const auto nextMonthEnum = static_cast(monthEnum + 1); const boost::string_view nextMonth = MONTHS.right.at(nextMonthEnum); nextCodeStr.append(nextMonth.data(), 3); diff --git a/test-suite/quantlibbenchmark.cpp b/test-suite/quantlibbenchmark.cpp index d97adb57876..a3d3310657a 100644 --- a/test-suite/quantlibbenchmark.cpp +++ b/test-suite/quantlibbenchmark.cpp @@ -59,6 +59,7 @@ #include #include +#include #include #include #include @@ -254,8 +255,8 @@ namespace { class TimedBenchmark { public: - TimedBenchmark(std::function f, const std::string& name) - : f_(std::move(f)), name_(name) {} + TimedBenchmark(std::function f, std::string name) + : f_(std::move(f)), name_(std::move(name)) {} void startMeasurement() const { //QL_REQUIRE(PAPI_hl_region_begin(name_.c_str()) == PAPI_OK,