Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions cmake/XrplCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ else ()
-fstack-protector
-Wno-sign-compare
-Wno-unused-but-set-variable
-Wno-missing-field-initializers
$<$<NOT:$<CONFIG:Debug>>:-fno-strict-aliasing>
# tweak gcc optimization for debug
$<$<AND:$<BOOL:${is_gcc}>,$<CONFIG:Debug>>:-O0>
Expand Down
2 changes: 2 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ words:
- nixfmt
- nixos
- nixpkgs
- NOLINT
- NOLINTNEXTLINE
- nonxrp
- noripple
- nudb
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/basics/BasicConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Section

public:
/** Create an empty section. */
explicit Section(std::string const& name = "");
explicit Section(std::string name = "");

/** Returns the name of this section. */
std::string const&
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/basics/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Logs
std::string partition_;

public:
Sink(std::string const& partition, beast::severities::Severity thresh, Logs& logs);
Sink(std::string partition, beast::severities::Severity thresh, Logs& logs);

Sink(Sink const&) = delete;
Sink&
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/beast/net/IPEndpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Endpoint
Endpoint();

/** Create an endpoint from the address and optional port. */
explicit Endpoint(Address const& addr, Port port = 0);
explicit Endpoint(Address addr, Port port = 0);

/** Create an Endpoint from a string.
If the port is omitted, the endpoint will have a zero port.
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/beast/utility/PropertyStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class PropertyStream::Proxy
std::ostringstream mutable m_ostream;

public:
Proxy(Map const& map, std::string const& key);
Proxy(Map const& map, std::string key);
Proxy(Proxy const& other);
~Proxy();

Expand Down Expand Up @@ -315,7 +315,7 @@ class PropertyStream::Source
List<Item> children_;

public:
explicit Source(std::string const& name);
explicit Source(std::string name);
virtual ~Source();

Source(Source const&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/core/JobQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class JobQueue : private Workers::Callback
// Returns the limit of running jobs for the given job type.
// For jobs with no limit, we return the largest int. Hopefully that
// will be enough.
int
static int
getJobLimit(JobType type);
};

Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/core/LoadEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LoadEvent
{
public:
// VFALCO TODO remove the dependency on LoadMonitor. Is that possible?
LoadEvent(LoadMonitor& monitor, std::string const& name, bool shouldStart);
LoadEvent(LoadMonitor& monitor, std::string name, bool shouldStart);
LoadEvent(LoadEvent const&) = delete;

~LoadEvent();
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/core/detail/Workers.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Workers
explicit Workers(
Callback& callback,
perf::PerfLog* perfLog,
std::string const& threadNames = "Worker",
std::string threadNames = "Worker",
int numberOfThreads = static_cast<int>(std::thread::hardware_concurrency()));

~Workers();
Expand Down Expand Up @@ -164,7 +164,7 @@ class Workers
public beast::LockFreeStack<Worker, PausedTag>::Node
{
public:
Worker(Workers& workers, std::string const& threadName, int const instance);
Worker(Workers& workers, std::string threadName, int const instance);

~Worker();

Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/json/json_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class Value
ObjectValues* map_{nullptr};
} value_;
ValueType type_ : 8;
int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
int allocated_ : 1 {}; // Notes: if declared as bool, bitfield is useless.
};

inline Value
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/json/json_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class StyledWriter : public WriterBase
std::string indentString_;
int rightMargin_;
int indentSize_;
bool addChildValues_;
bool addChildValues_{};
};

/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
Expand Down Expand Up @@ -175,7 +175,7 @@ class StyledStreamWriter
std::string indentString_;
int rightMargin_;
std::string indentation_;
bool addChildValues_;
bool addChildValues_{};
};

std::string
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/ledger/OpenView.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class OpenView final : public ReadView, public TxsRawView
OpenView(
open_ledger_t,
ReadView const* base,
Rules const& rules,
Rules rules,
std::shared_ptr<void const> hold = nullptr);

OpenView(open_ledger_t, Rules const& rules, std::shared_ptr<ReadView const> const& base)
Expand Down
10 changes: 5 additions & 5 deletions include/xrpl/protocol/Permissions.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ class Permission
std::optional<TxType>
getGranularTxType(GranularPermissionType const& gpType) const;

std::optional<std::reference_wrapper<uint256 const>> const
std::optional<std::reference_wrapper<uint256 const>>
getTxFeature(TxType txType) const;

bool
isDelegable(std::uint32_t const& permissionValue, Rules const& rules) const;

// for tx level permission, permission value is equal to tx type plus one
uint32_t
txToPermissionType(TxType const& type) const;
static uint32_t
txToPermissionType(TxType const& type);

// tx type value is permission value minus one
TxType
permissionToTxType(uint32_t const& value) const;
static TxType
permissionToTxType(uint32_t const& value);
};

} // namespace xrpl
2 changes: 1 addition & 1 deletion include/xrpl/protocol/PublicKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PublicKey
// All the constructed public keys are valid, non-empty and contain 33
// bytes of data.
static constexpr std::size_t size_ = 33;
std::uint8_t buf_[size_]; // should be large enough
std::uint8_t buf_[size_]{}; // should be large enough

public:
using const_iterator = std::uint8_t const*;
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/protocol/STObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class STObject : public STBase, public CountedObject<STObject>
using list_type = std::vector<detail::STVar>;

list_type v_;
SOTemplate const* mType;
SOTemplate const* mType{};

public:
using iterator = boost::transform_iterator<Transform, STObject::list_type::const_iterator>;
Expand Down Expand Up @@ -401,7 +401,7 @@ class STObject : public STBase, public CountedObject<STObject>
getStyle(SField const& field) const;

bool
hasMatchingEntry(STBase const&);
hasMatchingEntry(STBase const&) const;

bool
operator==(STObject const& o) const;
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/protocol/SecretKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace xrpl {
class SecretKey
{
private:
std::uint8_t buf_[32];
std::uint8_t buf_[32]{};

public:
using const_iterator = std::uint8_t const*;
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/protocol/Seed.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace xrpl {
class Seed
{
private:
std::array<uint8_t, 16> buf_;
std::array<uint8_t, 16> buf_{};

public:
using const_iterator = std::array<uint8_t, 16>::const_iterator;
Expand Down
4 changes: 2 additions & 2 deletions include/xrpl/protocol/XChainAttestations.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct AttestationBase
PublicKey const& publicKey_,
Buffer signature_,
AccountID const& sendingAccount_,
STAmount const& sendingAmount_,
STAmount sendingAmount_,
AccountID const& rewardAccount_,
bool wasLockingChainSend_);

Expand Down Expand Up @@ -169,7 +169,7 @@ struct AttestationCreateAccount : AttestationBase
Buffer signature_,
AccountID const& sendingAccount_,
STAmount const& sendingAmount_,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this STAmount const& sendingAmount_ also be changed like rewardAmount_?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang-tidy changed STAmount const& rewardAmount_ to STAmount rewardAmount_, but didn't change STAmount const& sendingAmount_ here, even though it did in the change above. I'm just not understanding the rationale.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging by the code it should have been able to move it the same way. But it did not, at least not from the first pass. I'd leave it for when we work on the relevant check directly. Sometimes clang-tidy can't do a multistep refactoring in one go, that's normal afaik.

STAmount const& rewardAmount_,
STAmount rewardAmount_,
AccountID const& rewardAccount_,
bool wasLockingChainSend_,
std::uint64_t createCount_,
Expand Down
6 changes: 3 additions & 3 deletions include/xrpl/protocol/digest.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct openssl_ripemd160_hasher
operator result_type() noexcept;

private:
char ctx_[96];
char ctx_[96]{};
};

/** SHA-512 digest
Expand All @@ -63,7 +63,7 @@ struct openssl_sha512_hasher
operator result_type() noexcept;

private:
char ctx_[216];
char ctx_[216]{};
};

/** SHA-256 digest
Expand All @@ -86,7 +86,7 @@ struct openssl_sha256_hasher
operator result_type() noexcept;

private:
char ctx_[112];
char ctx_[112]{};
};

//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/rdb/SociDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BasicConfig;
class DBConfig
{
std::string connectionString_;
explicit DBConfig(std::string const& dbPath);
explicit DBConfig(std::string dbPath);

public:
DBConfig(BasicConfig const& config, std::string const& dbName);
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/resource/Charge.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Charge
Charge() = delete;

/** Create a charge with the specified cost and name. */
Charge(value_type cost, std::string const& label = std::string());
Charge(value_type cost, std::string label = std::string());

/** Return the human readable label associated with the charge. */
std::string const&
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/server/InfoSub.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class InfoSub : public CountedObject<InfoSub>
send(Json::Value const& jvObj, bool broadcast) = 0;

std::uint64_t
getSeq();
getSeq() const;

void
onSendEmpty();
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/shamap/SHAMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ class SHAMap
// getMissingNodes helper functions
void
gmn_ProcessNodes(MissingNodes&, MissingNodes::StackEntry& node);
void
static void
gmn_ProcessDeferredReads(MissingNodes&);

// fetch from DB helper function
Expand Down
2 changes: 1 addition & 1 deletion include/xrpl/tx/ApplyContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ApplyContext
checkInvariants(TER const result, XRPAmount const fee);

private:
TER
static TER
failInvariantCheck(TER const result);

template <std::size_t... Is>
Expand Down
Loading