diff --git a/.clang-tidy b/.clang-tidy index 07274eb53a..e67e7a4c6c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,26 +10,26 @@ Checks: "-*, bugprone-chained-comparison, bugprone-compare-pointer-to-member-virtual-function, bugprone-copy-constructor-init, - # bugprone-crtp-constructor-accessibility, # has issues + bugprone-crtp-constructor-accessibility, bugprone-dangling-handle, bugprone-dynamic-static-initializers, - # bugprone-empty-catch, # has issues + bugprone-empty-catch, bugprone-fold-init-type, - # bugprone-forward-declaration-namespace, # has issues - # bugprone-inaccurate-erase, - # bugprone-inc-dec-in-conditions, - # bugprone-incorrect-enable-if, - # bugprone-incorrect-roundings, - # bugprone-infinite-loop, - # bugprone-integer-division, + bugprone-forward-declaration-namespace, + bugprone-inaccurate-erase, + bugprone-inc-dec-in-conditions, + bugprone-incorrect-enable-if, + bugprone-incorrect-roundings, + bugprone-infinite-loop, + bugprone-integer-division, bugprone-lambda-function-name, - # bugprone-macro-parentheses, # has issues + bugprone-macro-parentheses, bugprone-macro-repeated-side-effects, bugprone-misplaced-operator-in-strlen-in-alloc, bugprone-misplaced-pointer-arithmetic-in-alloc, bugprone-misplaced-widening-cast, bugprone-move-forwarding-reference, - # bugprone-multi-level-implicit-pointer-conversion, # has issues + bugprone-multi-level-implicit-pointer-conversion, bugprone-multiple-new-in-one-expression, bugprone-multiple-statement-macro, bugprone-no-escape, @@ -39,13 +39,13 @@ Checks: "-*, bugprone-pointer-arithmetic-on-polymorphic-object, bugprone-posix-return, bugprone-redundant-branch-condition, - # bugprone-reserved-identifier, # has issues - # bugprone-return-const-ref-from-parameter, # has issues + bugprone-reserved-identifier, + bugprone-return-const-ref-from-parameter, bugprone-shared-ptr-array-mismatch, bugprone-signal-handler, bugprone-signed-char-misuse, bugprone-sizeof-container, - # bugprone-sizeof-expression, # has issues + bugprone-sizeof-expression, bugprone-spuriously-wake-up-functions, bugprone-standalone-empty, bugprone-string-constructor, @@ -62,7 +62,7 @@ Checks: "-*, bugprone-suspicious-string-compare, bugprone-suspicious-stringview-data-usage, bugprone-swapped-arguments, - # bugprone-switch-missing-default-case, # has issues + bugprone-switch-missing-default-case, bugprone-terminating-continue, bugprone-throw-keyword-missing, bugprone-too-small-loop-variable, @@ -73,7 +73,7 @@ Checks: "-*, bugprone-unhandled-self-assignment, bugprone-unique-ptr-array-mismatch, bugprone-unsafe-functions, - # bugprone-use-after-move, # has issues + bugprone-use-after-move, # has issues bugprone-unused-raii, bugprone-unused-return-value, bugprone-unused-local-non-trivial-variable, diff --git a/include/xrpl/basics/BasicConfig.h b/include/xrpl/basics/BasicConfig.h index eaa53f93d6..f6fa5c52dc 100644 --- a/include/xrpl/basics/BasicConfig.h +++ b/include/xrpl/basics/BasicConfig.h @@ -296,7 +296,7 @@ set(T& target, std::string const& name, Section const& section) if ((found_and_valid = val.has_value())) target = *val; } - catch (boost::bad_lexical_cast&) + catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) { } return found_and_valid; @@ -330,7 +330,7 @@ get(Section const& section, std::string const& name, T const& defaultValue = T{} { return section.value_or(name, defaultValue); } - catch (boost::bad_lexical_cast&) + catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) { } return defaultValue; @@ -345,7 +345,7 @@ get(Section const& section, std::string const& name, char const* defaultValue) if (val.has_value()) return *val; } - catch (boost::bad_lexical_cast&) + catch (boost::bad_lexical_cast const&) // NOLINT(bugprone-empty-catch) { } return defaultValue; diff --git a/include/xrpl/basics/CountedObject.h b/include/xrpl/basics/CountedObject.h index 1acba18949..675d1b163b 100644 --- a/include/xrpl/basics/CountedObject.h +++ b/include/xrpl/basics/CountedObject.h @@ -112,7 +112,6 @@ private: return c; } -public: CountedObject() noexcept { getCounter().increment(); @@ -126,10 +125,13 @@ public: CountedObject& operator=(CountedObject const&) noexcept = default; +public: ~CountedObject() noexcept { getCounter().decrement(); } + + friend Object; }; } // namespace xrpl diff --git a/include/xrpl/basics/Log.h b/include/xrpl/basics/Log.h index 08da3e57b5..500a1f37c1 100644 --- a/include/xrpl/basics/Log.h +++ b/include/xrpl/basics/Log.h @@ -226,7 +226,7 @@ private: // expensive argument lists if the stream is not active. #ifndef JLOG #define JLOG(x) \ - if (!x) \ + if (!(x)) \ { \ } \ else \ @@ -235,7 +235,7 @@ private: #ifndef CLOG #define CLOG(ss) \ - if (!ss) \ + if (!(ss)) \ ; \ else \ *ss diff --git a/include/xrpl/basics/SlabAllocator.h b/include/xrpl/basics/SlabAllocator.h index 4ed88a32f7..90e64b58a2 100644 --- a/include/xrpl/basics/SlabAllocator.h +++ b/include/xrpl/basics/SlabAllocator.h @@ -60,7 +60,7 @@ class SlabAllocator { // Use memcpy to avoid unaligned UB // (will optimize to equivalent code) - std::memcpy(data, &l_, sizeof(std::uint8_t*)); + std::memcpy(data, static_cast(&l_), sizeof(std::uint8_t*)); l_ = data; data += item; } @@ -102,7 +102,7 @@ class SlabAllocator { // Use memcpy to avoid unaligned UB // (will optimize to equivalent code) - std::memcpy(&l_, ret, sizeof(std::uint8_t*)); + std::memcpy(static_cast(&l_), ret, sizeof(std::uint8_t*)); } } @@ -127,7 +127,7 @@ class SlabAllocator // Use memcpy to avoid unaligned UB // (will optimize to equivalent code) - std::memcpy(ptr, &l_, sizeof(std::uint8_t*)); + std::memcpy(ptr, static_cast(&l_), sizeof(std::uint8_t*)); l_ = ptr; } }; diff --git a/include/xrpl/beast/container/detail/aged_associative_container.h b/include/xrpl/beast/container/detail/aged_associative_container.h index 34e9560cbb..af6774eb9e 100644 --- a/include/xrpl/beast/container/detail/aged_associative_container.h +++ b/include/xrpl/beast/container/detail/aged_associative_container.h @@ -26,7 +26,7 @@ struct aged_associative_container_extract_t Value const& operator()(Value const& value) const { - return value; + return value; // NOLINT(bugprone-return-const-ref-from-parameter) } }; diff --git a/include/xrpl/beast/container/detail/aged_ordered_container.h b/include/xrpl/beast/container/detail/aged_ordered_container.h index dad0d92e0b..554fed2d58 100644 --- a/include/xrpl/beast/container/detail/aged_ordered_container.h +++ b/include/xrpl/beast/container/detail/aged_ordered_container.h @@ -257,7 +257,8 @@ private: config_t(config_t&& other) : KeyValueCompare(std::move(other.key_compare())) - , beast::detail::empty_base_optimization(std::move(other)) + , beast::detail::empty_base_optimization(std::move( + static_cast&>(other))) , clock(other.clock) { } diff --git a/include/xrpl/beast/core/List.h b/include/xrpl/beast/core/List.h index 560467c8dd..a6ba71680b 100644 --- a/include/xrpl/beast/core/List.h +++ b/include/xrpl/beast/core/List.h @@ -35,9 +35,11 @@ struct CopyConst template class ListNode { -private: + ListNode() = default; + using value_type = T; + friend T; friend class List; template diff --git a/include/xrpl/beast/hash/hash_append.h b/include/xrpl/beast/hash/hash_append.h index d456bb3a73..cfae15e26b 100644 --- a/include/xrpl/beast/hash/hash_append.h +++ b/include/xrpl/beast/hash/hash_append.h @@ -203,7 +203,8 @@ template inline std::enable_if_t::value> hash_append(Hasher& h, T const& t) noexcept { - h(std::addressof(t), sizeof(t)); + // NOLINTNEXTLINE(bugprone-sizeof-expression) + h(static_cast(std::addressof(t)), sizeof(t)); } template diff --git a/include/xrpl/beast/rfc2616.h b/include/xrpl/beast/rfc2616.h index b19c2c511a..f43060eb20 100644 --- a/include/xrpl/beast/rfc2616.h +++ b/include/xrpl/beast/rfc2616.h @@ -53,8 +53,9 @@ is_white(char c) case '\t': case '\v': return true; + default: + return false; }; - return false; } template diff --git a/include/xrpl/beast/unit_test/reporter.h b/include/xrpl/beast/unit_test/reporter.h index 63ad90ff7c..011e2ca3c0 100644 --- a/include/xrpl/beast/unit_test/reporter.h +++ b/include/xrpl/beast/unit_test/reporter.h @@ -118,18 +118,18 @@ private: //------------------------------------------------------------------------------ -template +template void -reporter<_>::suite_results::add(case_results const& r) +reporter::suite_results::add(case_results const& r) { ++cases; total += r.total; failed += r.failed; } -template +template void -reporter<_>::results::add(suite_results const& r) +reporter::results::add(suite_results const& r) { ++suites; total += r.total; @@ -160,13 +160,13 @@ reporter<_>::results::add(suite_results const& r) //------------------------------------------------------------------------------ -template -reporter<_>::reporter(std::ostream& os) : os_(os) +template +reporter::reporter(std::ostream& os) : os_(os) { } -template -reporter<_>::~reporter() +template +reporter::~reporter() { if (results_.top.size() > 0) { @@ -180,9 +180,9 @@ reporter<_>::~reporter() << amount{results_.failed, "failure"} << std::endl; } -template +template std::string -reporter<_>::fmtdur(typename clock_type::duration const& d) +reporter::fmtdur(typename clock_type::duration const& d) { using namespace std::chrono; auto const ms = duration_cast(d); @@ -193,46 +193,46 @@ reporter<_>::fmtdur(typename clock_type::duration const& d) return ss.str(); } -template +template void -reporter<_>::on_suite_begin(suite_info const& info) +reporter::on_suite_begin(suite_info const& info) { suite_results_ = suite_results{info.full_name()}; } -template +template void -reporter<_>::on_suite_end() +reporter::on_suite_end() { results_.add(suite_results_); } -template +template void -reporter<_>::on_case_begin(std::string const& name) +reporter::on_case_begin(std::string const& name) { case_results_ = case_results(name); os_ << suite_results_.name << (case_results_.name.empty() ? "" : (" " + case_results_.name)) << std::endl; } -template +template void -reporter<_>::on_case_end() +reporter::on_case_end() { suite_results_.add(case_results_); } -template +template void -reporter<_>::on_pass() +reporter::on_pass() { ++case_results_.total; } -template +template void -reporter<_>::on_fail(std::string const& reason) +reporter::on_fail(std::string const& reason) { ++case_results_.failed; ++case_results_.total; @@ -240,9 +240,9 @@ reporter<_>::on_fail(std::string const& reason) << std::endl; } -template +template void -reporter<_>::on_log(std::string const& s) +reporter::on_log(std::string const& s) { os_ << s; } diff --git a/include/xrpl/beast/unit_test/results.h b/include/xrpl/beast/unit_test/results.h index b8a8e2aadf..57327639a5 100644 --- a/include/xrpl/beast/unit_test/results.h +++ b/include/xrpl/beast/unit_test/results.h @@ -145,9 +145,9 @@ public: void insert(case_results&& r) { - cont().emplace_back(std::move(r)); total_ += r.tests.total(); failed_ += r.tests.failed(); + cont().emplace_back(std::move(r)); } void diff --git a/include/xrpl/beast/unit_test/suite.h b/include/xrpl/beast/unit_test/suite.h index fa5157e126..2f0b69b8a0 100644 --- a/include/xrpl/beast/unit_test/suite.h +++ b/include/xrpl/beast/unit_test/suite.h @@ -36,7 +36,7 @@ make_reason(String const& reason, char const* file, int line) } // namespace detail -class thread; +class Thread; enum abort_t { no_abort_on_fail, abort_on_fail }; @@ -295,7 +295,7 @@ public: } private: - friend class thread; + friend class Thread; static suite** p_this_suite() @@ -538,7 +538,7 @@ suite::run(runner& r) { run(); } - catch (abort_exception const&) + catch (abort_exception const&) // NOLINT(bugprone-empty-catch) { // ends the suite } diff --git a/include/xrpl/beast/unit_test/thread.h b/include/xrpl/beast/unit_test/thread.h index b49f8ed36e..9267b84ac3 100644 --- a/include/xrpl/beast/unit_test/thread.h +++ b/include/xrpl/beast/unit_test/thread.h @@ -14,7 +14,7 @@ namespace beast { namespace unit_test { /** Replacement for std::thread that handles exceptions in unit tests. */ -class thread +class Thread { private: suite* s_ = nullptr; @@ -24,17 +24,17 @@ public: using id = std::thread::id; using native_handle_type = std::thread::native_handle_type; - thread() = default; - thread(thread const&) = delete; - thread& - operator=(thread const&) = delete; + Thread() = default; + Thread(Thread const&) = delete; + Thread& + operator=(Thread const&) = delete; - thread(thread&& other) : s_(other.s_), t_(std::move(other.t_)) + Thread(Thread&& other) : s_(other.s_), t_(std::move(other.t_)) { } - thread& - operator=(thread&& other) + Thread& + operator=(Thread&& other) { s_ = other.s_; t_ = std::move(other.t_); @@ -42,10 +42,10 @@ public: } template - explicit thread(suite& s, F&& f, Args&&... args) : s_(&s) + explicit Thread(suite& s, F&& f, Args&&... args) : s_(&s) { std::function b = std::bind(std::forward(f), std::forward(args)...); - t_ = std::thread(&thread::run, this, std::move(b)); + t_ = std::thread(&Thread::run, this, std::move(b)); } bool @@ -80,7 +80,7 @@ public: } void - swap(thread& other) + swap(Thread& other) { std::swap(s_, other.s_); std::swap(t_, other.t_); @@ -94,7 +94,7 @@ private: { f(); } - catch (suite::abort_exception const&) + catch (suite::abort_exception const&) // NOLINT(bugprone-empty-catch) { } catch (std::exception const& e) diff --git a/include/xrpl/beast/xor_shift_engine.h b/include/xrpl/beast/xor_shift_engine.h index 4fbe5ec165..85504f51aa 100644 --- a/include/xrpl/beast/xor_shift_engine.h +++ b/include/xrpl/beast/xor_shift_engine.h @@ -43,15 +43,15 @@ private: murmurhash3(result_type x); }; -template -xor_shift_engine<_>::xor_shift_engine(result_type val) +template +xor_shift_engine::xor_shift_engine(result_type val) { seed(val); } -template +template void -xor_shift_engine<_>::seed(result_type seed) +xor_shift_engine::seed(result_type seed) { if (seed == 0) throw std::domain_error("invalid seed"); @@ -59,9 +59,9 @@ xor_shift_engine<_>::seed(result_type seed) s_[1] = murmurhash3(s_[0]); } -template +template auto -xor_shift_engine<_>::operator()() -> result_type +xor_shift_engine::operator()() -> result_type { result_type s1 = s_[0]; result_type const s0 = s_[1]; @@ -70,9 +70,9 @@ xor_shift_engine<_>::operator()() -> result_type return (s_[1] = (s1 ^ s0 ^ (s1 >> 17) ^ (s0 >> 26))) + s0; } -template +template auto -xor_shift_engine<_>::murmurhash3(result_type x) -> result_type +xor_shift_engine::murmurhash3(result_type x) -> result_type { x ^= x >> 33; x *= 0xff51afd7ed558ccdULL; diff --git a/include/xrpl/protocol/ApiVersion.h b/include/xrpl/protocol/ApiVersion.h index 8772b5a49d..653b4830bf 100644 --- a/include/xrpl/protocol/ApiVersion.h +++ b/include/xrpl/protocol/ApiVersion.h @@ -138,9 +138,11 @@ forApiVersions(Fn const& fn, Args&&... args) { constexpr auto size = maxVer + 1 - minVer; [&](std::index_sequence) { + // NOLINTBEGIN(bugprone-use-after-move) (((void)fn( std::integral_constant{}, std::forward(args)...)), ...); + // NOLINTEND(bugprone-use-after-move) }(std::make_index_sequence{}); } diff --git a/include/xrpl/protocol/Feature.h b/include/xrpl/protocol/Feature.h index 112f66f4a1..cbd41b84f8 100644 --- a/include/xrpl/protocol/Feature.h +++ b/include/xrpl/protocol/Feature.h @@ -125,10 +125,12 @@ namespace detail { #pragma push_macro("XRPL_RETIRE_FIX") #undef XRPL_RETIRE_FIX +// NOLINTBEGIN(bugprone-macro-parentheses) #define XRPL_FEATURE(name, supported, vote) +1 #define XRPL_FIX(name, supported, vote) +1 #define XRPL_RETIRE_FEATURE(name) +1 #define XRPL_RETIRE_FIX(name) +1 +// NOLINTEND(bugprone-macro-parentheses) // This value SHOULD be equal to the number of amendments registered in // Feature.cpp. Because it's only used to reserve storage, and determine how diff --git a/include/xrpl/protocol/KnownFormats.h b/include/xrpl/protocol/KnownFormats.h index c454683e19..d965f43b78 100644 --- a/include/xrpl/protocol/KnownFormats.h +++ b/include/xrpl/protocol/KnownFormats.h @@ -74,10 +74,12 @@ public: Derived classes will load the object with all the known formats. */ +private: KnownFormats() : name_(beast::type_name()) { } +public: /** Destroy the known formats object. The defined formats are deleted. @@ -181,6 +183,7 @@ private: boost::container::flat_map names_; boost::container::flat_map types_; + friend Derived; }; } // namespace xrpl diff --git a/include/xrpl/protocol/LedgerFormats.h b/include/xrpl/protocol/LedgerFormats.h index 06fd1040e1..009a96533a 100644 --- a/include/xrpl/protocol/LedgerFormats.h +++ b/include/xrpl/protocol/LedgerFormats.h @@ -211,7 +211,7 @@ enum LedgerEntryType : std::uint16_t { // lsfRequireDestTag = 0x00020000, // ... // }; -#define TO_VALUE(name, value) name = value, +#define TO_VALUE(name, value) name = (value), #define NULL_NAME(name, values) values #define NULL_OUTPUT(name, value) enum LedgerSpecificFlags : std::uint32_t { XMACRO(NULL_NAME, TO_VALUE, NULL_OUTPUT) }; diff --git a/include/xrpl/protocol/Permissions.h b/include/xrpl/protocol/Permissions.h index 0ec4f04f1a..ea8bd77643 100644 --- a/include/xrpl/protocol/Permissions.h +++ b/include/xrpl/protocol/Permissions.h @@ -20,7 +20,7 @@ enum GranularPermissionType : std::uint32_t { #pragma push_macro("PERMISSION") #undef PERMISSION -#define PERMISSION(type, txType, value) type = value, +#define PERMISSION(type, txType, value) type = (value), #include diff --git a/include/xrpl/protocol/SField.h b/include/xrpl/protocol/SField.h index 7a864b1b58..cbc2c12f4e 100644 --- a/include/xrpl/protocol/SField.h +++ b/include/xrpl/protocol/SField.h @@ -84,7 +84,7 @@ class STCurrency; #pragma push_macro("TO_MAP") #undef TO_MAP -#define TO_ENUM(name, value) name = value, +#define TO_ENUM(name, value) name = (value), #define TO_MAP(name, value) {#name, value}, enum SerializedTypeID { XMACRO(TO_ENUM) }; diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index 3fa4a53e3f..e33d7f0df4 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -401,7 +401,7 @@ amountFromJsonNoThrow(STAmount& result, Json::Value const& jvSource); inline STAmount const& toSTAmount(STAmount const& a) { - return a; + return a; // NOLINT(bugprone-return-const-ref-from-parameter) } //------------------------------------------------------------------------------ diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 7553521237..561758df16 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -1188,6 +1188,7 @@ STObject::getFieldByConstRef(SField const& field, V const& empty) const SerializedTypeID const id = rf->getSType(); if (id == STI_NOTPRESENT) + // NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter) return empty; // optional field not present T const* cf = dynamic_cast(rf); diff --git a/include/xrpl/protocol/TxFlags.h b/include/xrpl/protocol/TxFlags.h index 7c2085109f..7bbbd12707 100644 --- a/include/xrpl/protocol/TxFlags.h +++ b/include/xrpl/protocol/TxFlags.h @@ -235,7 +235,7 @@ XMACRO(NULL_NAME, TO_VALUE, NULL_OUTPUT, NULL_MASK_ADJ) // The mask adjustment (maskAdj) allows adding flags back to the mask, making them invalid. // For example, Batch uses MASK_ADJ(tfInnerBatchTxn) to reject tfInnerBatchTxn on outer Batch. #define TO_MASK(name, values, maskAdj) \ - inline constexpr FlagValue tf##name##Mask = ~(tfUniversal values) | maskAdj; + inline constexpr FlagValue tf##name##Mask = ~(tfUniversal values) | (maskAdj); #define VALUE_TO_MASK(name, value) | name #define MASK_ADJ_TO_MASK(value) value XMACRO(TO_MASK, VALUE_TO_MASK, VALUE_TO_MASK, MASK_ADJ_TO_MASK) diff --git a/include/xrpl/protocol/json_get_or_throw.h b/include/xrpl/protocol/json_get_or_throw.h index 4406d9ff24..949fb64cf2 100644 --- a/include/xrpl/protocol/json_get_or_throw.h +++ b/include/xrpl/protocol/json_get_or_throw.h @@ -146,7 +146,7 @@ getOptional(Json::Value const& v, xrpl::SField const& field) { return getOrThrow(v, field); } - catch (...) + catch (...) // NOLINT(bugprone-empty-catch) { } return {}; diff --git a/include/xrpl/server/detail/BasePeer.h b/include/xrpl/server/detail/BasePeer.h index afa1ceb993..35c6acb198 100644 --- a/include/xrpl/server/detail/BasePeer.h +++ b/include/xrpl/server/detail/BasePeer.h @@ -34,6 +34,7 @@ protected: boost::asio::strand strand_; public: + // NOLINTNEXTLINE(bugprone-crtp-constructor-accessibility) BasePeer( Port const& port, Handler& handler, diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index 9213a955f0..ebc504a863 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -392,7 +392,7 @@ BaseWSPeer::cancel_timer() { timer_.cancel(); } - catch (boost::system::system_error const&) + catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch) { // ignored } diff --git a/include/xrpl/tx/paths/detail/FlowDebugInfo.h b/include/xrpl/tx/paths/detail/FlowDebugInfo.h index 3a1f45fd02..dd25939d27 100644 --- a/include/xrpl/tx/paths/detail/FlowDebugInfo.h +++ b/include/xrpl/tx/paths/detail/FlowDebugInfo.h @@ -220,6 +220,7 @@ struct FlowDebugInfo write_list(amts, get_val, delim); }; auto writeIntList = [&write_list](std::vector const& vals, char delim = ';') { + // NOLINTNEXTLINE(bugprone-return-const-ref-from-parameter) auto get_val = [](size_t const& v) -> size_t const& { return v; }; write_list(vals, get_val); }; diff --git a/include/xrpl/tx/paths/detail/Steps.h b/include/xrpl/tx/paths/detail/Steps.h index 4fa3b09d07..c3269505b1 100644 --- a/include/xrpl/tx/paths/detail/Steps.h +++ b/include/xrpl/tx/paths/detail/Steps.h @@ -429,8 +429,10 @@ toStrands( template struct StepImp : public Step { +private: explicit StepImp() = default; +public: std::pair rev(PaymentSandbox& sb, ApplyView& afView, @@ -470,6 +472,7 @@ struct StepImp : public Step { return get(lhs) == get(rhs); } + friend TDerived; }; /// @endcond diff --git a/src/test/csf/Scheduler.h b/src/test/csf/Scheduler.h index 61ec8f62ff..b92c4341b5 100644 --- a/src/test/csf/Scheduler.h +++ b/src/test/csf/Scheduler.h @@ -265,7 +265,7 @@ inline Scheduler::queue_type::~queue_type() auto e = &*iter; ++iter; e->~event(); - alloc_->deallocate(e, sizeof(e)); + alloc_->deallocate(e, sizeof(e)); // NOLINT(bugprone-sizeof-expression) } } diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index c9304426cf..806e60f92a 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -452,7 +452,7 @@ private: bool ssl; lambda(int id_, TrustedPublisherServer& self_, socket_type&& sock_, bool ssl_) - : id(id_), self(self_), sock(std::move(sock_)), work(sock_.get_executor()), ssl(ssl_) + : id(id_), self(self_), sock(std::move(sock_)), work(sock.get_executor()), ssl(ssl_) { } diff --git a/src/test/nodestore/TestBase.h b/src/test/nodestore/TestBase.h index 893e06579c..6f29457e85 100644 --- a/src/test/nodestore/TestBase.h +++ b/src/test/nodestore/TestBase.h @@ -75,9 +75,10 @@ public: return hotTRANSACTION_NODE; case 3: return hotUNKNOWN; + default: + // will never happen, but make static analysis tool happy. + return hotUNKNOWN; } - // will never happen, but make static analysis tool happy. - return hotUNKNOWN; }(); uint256 hash; diff --git a/src/test/nodestore/Timing_test.cpp b/src/test/nodestore/Timing_test.cpp index 39e8b59638..eb40a041f5 100644 --- a/src/test/nodestore/Timing_test.cpp +++ b/src/test/nodestore/Timing_test.cpp @@ -211,7 +211,7 @@ public: parallel_for(std::size_t const n, std::size_t number_of_threads, Args const&... args) { std::atomic c(0); - std::vector t; + std::vector t; t.reserve(number_of_threads); for (std::size_t id = 0; id < number_of_threads; ++id) t.emplace_back(*this, parallel_for_lambda(n, c), args...); @@ -224,7 +224,7 @@ public: parallel_for_id(std::size_t const n, std::size_t number_of_threads, Args const&... args) { std::atomic c(0); - std::vector t; + std::vector t; t.reserve(number_of_threads); for (std::size_t id = 0; id < number_of_threads; ++id) t.emplace_back(*this, parallel_for_lambda(n, c), id, args...); diff --git a/src/xrpld/app/main/Application.h b/src/xrpld/app/main/Application.h index 45bd94adce..d0437be9a6 100644 --- a/src/xrpld/app/main/Application.h +++ b/src/xrpld/app/main/Application.h @@ -16,15 +16,6 @@ namespace xrpl { -namespace unl { -class Manager; -} // namespace unl -namespace Resource { -class Manager; -} // namespace Resource -namespace NodeStore { -class Database; -} // namespace NodeStore namespace perf { class PerfLog; } // namespace perf diff --git a/src/xrpld/app/misc/Transaction.h b/src/xrpld/app/misc/Transaction.h index fa126e6bb5..5fe8dcf4fa 100644 --- a/src/xrpld/app/misc/Transaction.h +++ b/src/xrpld/app/misc/Transaction.h @@ -21,7 +21,6 @@ namespace xrpl { // class Application; -class Database; class Rules; enum TransStatus { diff --git a/src/xrpld/app/misc/detail/WorkBase.h b/src/xrpld/app/misc/detail/WorkBase.h index 35f04efe00..825866ee9b 100644 --- a/src/xrpld/app/misc/detail/WorkBase.h +++ b/src/xrpld/app/misc/detail/WorkBase.h @@ -47,7 +47,7 @@ protected: endpoint_type lastEndpoint_; bool lastStatus_; -public: +private: WorkBase( std::string const& host, std::string const& path, @@ -56,6 +56,8 @@ public: endpoint_type const& lastEndpoint, bool lastStatus, callback_type cb); + +public: ~WorkBase(); Impl& @@ -91,6 +93,8 @@ public: private: void close(); + + friend Impl; }; //------------------------------------------------------------------------------ diff --git a/src/xrpld/overlay/Compression.h b/src/xrpld/overlay/Compression.h index e9f530035a..784e7c1607 100644 --- a/src/xrpld/overlay/Compression.h +++ b/src/xrpld/overlay/Compression.h @@ -49,7 +49,7 @@ decompress( // LCOV_EXCL_STOP } } - catch (...) + catch (...) // NOLINT(bugprone-empty-catch) { } return 0; @@ -88,7 +88,7 @@ compress( // LCOV_EXCL_STOP } } - catch (...) + catch (...) // NOLINT(bugprone-empty-catch) { } return 0; diff --git a/src/xrpld/rpc/detail/PathRequest.h b/src/xrpld/rpc/detail/PathRequest.h index f699ccb6f8..3c8f89f5fe 100644 --- a/src/xrpld/rpc/detail/PathRequest.h +++ b/src/xrpld/rpc/detail/PathRequest.h @@ -24,7 +24,7 @@ class AssetCache; class PathRequestManager; // Return values from parseJson <0 = invalid, >0 = valid -#define PFR_PJ_INVALID -1 +#define PFR_PJ_INVALID (-1) #define PFR_PJ_NOCHANGE 0 class PathRequest final : public InfoSubRequest,