mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Merge branch 'develop' into ximinez/acquireAsyncDispatch
This commit is contained in:
@@ -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<T>(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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<void const*>(&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<void*>(&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<void const*>(&l_), sizeof(std::uint8_t*));
|
||||
l_ = ptr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ struct aged_associative_container_extract_t<false>
|
||||
Value const&
|
||||
operator()(Value const& value) const
|
||||
{
|
||||
return value;
|
||||
return value; // NOLINT(bugprone-return-const-ref-from-parameter)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -257,7 +257,8 @@ private:
|
||||
|
||||
config_t(config_t&& other)
|
||||
: KeyValueCompare(std::move(other.key_compare()))
|
||||
, beast::detail::empty_base_optimization<ElementAllocator>(std::move(other))
|
||||
, beast::detail::empty_base_optimization<ElementAllocator>(std::move(
|
||||
static_cast<beast::detail::empty_base_optimization<ElementAllocator>&>(other)))
|
||||
, clock(other.clock)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ struct CopyConst<T const, U>
|
||||
template <typename T, typename Tag>
|
||||
class ListNode
|
||||
{
|
||||
private:
|
||||
ListNode() = default;
|
||||
|
||||
using value_type = T;
|
||||
|
||||
friend T;
|
||||
friend class List<T, Tag>;
|
||||
|
||||
template <typename>
|
||||
|
||||
@@ -203,7 +203,8 @@ template <class Hasher, class T>
|
||||
inline std::enable_if_t<is_contiguously_hashable<T, Hasher>::value>
|
||||
hash_append(Hasher& h, T const& t) noexcept
|
||||
{
|
||||
h(std::addressof(t), sizeof(t));
|
||||
// NOLINTNEXTLINE(bugprone-sizeof-expression)
|
||||
h(static_cast<void const*>(std::addressof(t)), sizeof(t));
|
||||
}
|
||||
|
||||
template <class Hasher, class T>
|
||||
|
||||
@@ -53,8 +53,9 @@ is_white(char c)
|
||||
case '\t':
|
||||
case '\v':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class FwdIter>
|
||||
|
||||
@@ -118,18 +118,18 @@ private:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::suite_results::add(case_results const& r)
|
||||
reporter<Unused>::suite_results::add(case_results const& r)
|
||||
{
|
||||
++cases;
|
||||
total += r.total;
|
||||
failed += r.failed;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::results::add(suite_results const& r)
|
||||
reporter<Unused>::results::add(suite_results const& r)
|
||||
{
|
||||
++suites;
|
||||
total += r.total;
|
||||
@@ -160,13 +160,13 @@ reporter<_>::results::add(suite_results const& r)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template <class _>
|
||||
reporter<_>::reporter(std::ostream& os) : os_(os)
|
||||
template <class Unused>
|
||||
reporter<Unused>::reporter(std::ostream& os) : os_(os)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _>
|
||||
reporter<_>::~reporter()
|
||||
template <class Unused>
|
||||
reporter<Unused>::~reporter()
|
||||
{
|
||||
if (results_.top.size() > 0)
|
||||
{
|
||||
@@ -180,9 +180,9 @@ reporter<_>::~reporter()
|
||||
<< amount{results_.failed, "failure"} << std::endl;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
std::string
|
||||
reporter<_>::fmtdur(typename clock_type::duration const& d)
|
||||
reporter<Unused>::fmtdur(typename clock_type::duration const& d)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto const ms = duration_cast<milliseconds>(d);
|
||||
@@ -193,46 +193,46 @@ reporter<_>::fmtdur(typename clock_type::duration const& d)
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_suite_begin(suite_info const& info)
|
||||
reporter<Unused>::on_suite_begin(suite_info const& info)
|
||||
{
|
||||
suite_results_ = suite_results{info.full_name()};
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_suite_end()
|
||||
reporter<Unused>::on_suite_end()
|
||||
{
|
||||
results_.add(suite_results_);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_case_begin(std::string const& name)
|
||||
reporter<Unused>::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 <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_case_end()
|
||||
reporter<Unused>::on_case_end()
|
||||
{
|
||||
suite_results_.add(case_results_);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_pass()
|
||||
reporter<Unused>::on_pass()
|
||||
{
|
||||
++case_results_.total;
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_fail(std::string const& reason)
|
||||
reporter<Unused>::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 <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
reporter<_>::on_log(std::string const& s)
|
||||
reporter<Unused>::on_log(std::string const& s)
|
||||
{
|
||||
os_ << s;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 <class F, class... Args>
|
||||
explicit thread(suite& s, F&& f, Args&&... args) : s_(&s)
|
||||
explicit Thread(suite& s, F&& f, Args&&... args) : s_(&s)
|
||||
{
|
||||
std::function<void(void)> b = std::bind(std::forward<F>(f), std::forward<Args>(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)
|
||||
|
||||
@@ -43,15 +43,15 @@ private:
|
||||
murmurhash3(result_type x);
|
||||
};
|
||||
|
||||
template <class _>
|
||||
xor_shift_engine<_>::xor_shift_engine(result_type val)
|
||||
template <class Unused>
|
||||
xor_shift_engine<Unused>::xor_shift_engine(result_type val)
|
||||
{
|
||||
seed(val);
|
||||
}
|
||||
|
||||
template <class _>
|
||||
template <class Unused>
|
||||
void
|
||||
xor_shift_engine<_>::seed(result_type seed)
|
||||
xor_shift_engine<Unused>::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 <class _>
|
||||
template <class Unused>
|
||||
auto
|
||||
xor_shift_engine<_>::operator()() -> result_type
|
||||
xor_shift_engine<Unused>::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 <class _>
|
||||
template <class Unused>
|
||||
auto
|
||||
xor_shift_engine<_>::murmurhash3(result_type x) -> result_type
|
||||
xor_shift_engine<Unused>::murmurhash3(result_type x) -> result_type
|
||||
{
|
||||
x ^= x >> 33;
|
||||
x *= 0xff51afd7ed558ccdULL;
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
{
|
||||
lowest_layer().shutdown(plain_socket::shutdown_both);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
catch (boost::system::system_error const& e)
|
||||
{
|
||||
ec = e.code();
|
||||
}
|
||||
|
||||
@@ -138,9 +138,11 @@ forApiVersions(Fn const& fn, Args&&... args)
|
||||
{
|
||||
constexpr auto size = maxVer + 1 - minVer;
|
||||
[&]<std::size_t... offset>(std::index_sequence<offset...>) {
|
||||
// NOLINTBEGIN(bugprone-use-after-move)
|
||||
(((void)fn(
|
||||
std::integral_constant<unsigned int, minVer + offset>{}, std::forward<Args>(args)...)),
|
||||
...);
|
||||
// NOLINTEND(bugprone-use-after-move)
|
||||
}(std::make_index_sequence<size>{});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,10 +74,12 @@ public:
|
||||
|
||||
Derived classes will load the object with all the known formats.
|
||||
*/
|
||||
private:
|
||||
KnownFormats() : name_(beast::type_name<Derived>())
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
/** Destroy the known formats object.
|
||||
|
||||
The defined formats are deleted.
|
||||
@@ -181,6 +183,7 @@ private:
|
||||
|
||||
boost::container::flat_map<std::string, Item const*> names_;
|
||||
boost::container::flat_map<KeyType, Item const*> types_;
|
||||
friend Derived;
|
||||
};
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -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) };
|
||||
|
||||
@@ -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 <xrpl/protocol/detail/permissions.macro>
|
||||
|
||||
|
||||
@@ -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) };
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -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<T const*>(rf);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -146,7 +146,7 @@ getOptional(Json::Value const& v, xrpl::SField const& field)
|
||||
{
|
||||
return getOrThrow<T>(v, field);
|
||||
}
|
||||
catch (...)
|
||||
catch (...) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
}
|
||||
return {};
|
||||
|
||||
@@ -34,6 +34,7 @@ protected:
|
||||
boost::asio::strand<boost::asio::executor> strand_;
|
||||
|
||||
public:
|
||||
// NOLINTNEXTLINE(bugprone-crtp-constructor-accessibility)
|
||||
BasePeer(
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
|
||||
@@ -392,7 +392,7 @@ BaseWSPeer<Handler, Impl>::cancel_timer()
|
||||
{
|
||||
timer_.cancel();
|
||||
}
|
||||
catch (boost::system::system_error const&)
|
||||
catch (boost::system::system_error const&) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ struct FlowDebugInfo
|
||||
write_list(amts, get_val, delim);
|
||||
};
|
||||
auto writeIntList = [&write_list](std::vector<size_t> 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);
|
||||
};
|
||||
|
||||
@@ -429,8 +429,10 @@ toStrands(
|
||||
template <StepAmount TIn, StepAmount TOut, class TDerived>
|
||||
struct StepImp : public Step
|
||||
{
|
||||
private:
|
||||
explicit StepImp() = default;
|
||||
|
||||
public:
|
||||
std::pair<EitherAmount, EitherAmount>
|
||||
rev(PaymentSandbox& sb,
|
||||
ApplyView& afView,
|
||||
@@ -470,6 +472,7 @@ struct StepImp : public Step
|
||||
{
|
||||
return get<TIn>(lhs) == get<TIn>(rhs);
|
||||
}
|
||||
friend TDerived;
|
||||
};
|
||||
/// @endcond
|
||||
|
||||
|
||||
Reference in New Issue
Block a user