Update clang-format (#4414)

* Update required `clang-format` version to 17

* Apply formatting
This commit is contained in:
Piotr Wójcik 2024-02-01 16:33:29 +01:00 committed by GitHub
commit 38c0c347e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 97 additions and 82 deletions

View file

@ -1,36 +1,51 @@
name: Static Analyzers
on: [push, pull_request]
on: [ push, pull_request ]
jobs:
clang_format:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Installing clang-format 12
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Installing clang-format
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get install clang-format-12
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt install clang-format-17
- name: Check clang-format
run: ci/clang-format-check.sh
cmake_format:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 #v4.3.0
with:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
- name: Setup Python
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 #v4.3.0
with:
python-version: '3.x'
architecture: 'x64'
- uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318
with:
- name: Install cmake-format
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318
with:
packages: |
cmake-format
- name: Check cmake-format
run: ci/cmake-format-check.sh
code_inspector:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

View file

@ -3,7 +3,7 @@
###################################################################################################
CLANG_FORMAT=""
CLANG_FORMAT_VERSION="12"
CLANG_FORMAT_VERSION="17"
###################################################################################################

View file

@ -373,9 +373,9 @@ nano::error::operator std::string () const
}
/**
* Get error message, or an empty string if there's no error. If a custom error message is set,
* that will be returned, otherwise the error_code#message() is returned.
*/
* Get error message, or an empty string if there's no error. If a custom error message is set,
* that will be returned, otherwise the error_code#message() is returned.
*/
std::string nano::error::get_message () const
{
std::string res = message;

View file

@ -84,7 +84,7 @@ namespace ipc
}
/**
* Returns a buffer with an IPC preamble for the given \p encoding_a followed by the payload. Depending on encoding,
* Returns a buffer with an IPC preamble for the given \p encoding_a followed by the payload. Depending on encoding,
* the buffer may contain a payload length or end sentinel.
*/
nano::shared_const_buffer prepare_request (nano::ipc::payload_encoding encoding_a, std::string const & payload_a);

View file

@ -21,7 +21,7 @@ nano::jsonconfig::jsonconfig (boost::property_tree::ptree & tree_a, std::shared_
}
/**
* Reads a json object from the stream
* Reads a json object from the stream
* @return nano::error&, including a descriptive error message if the config file is malformed.
*/
nano::error & nano::jsonconfig::read (std::filesystem::path const & path_a)

View file

@ -179,7 +179,7 @@ private:
};
/** Assumes std implementations of std::condition_variable never actually call nano::unique_lock::lock/unlock,
but instead use OS intrinsics with the mutex handle directly. Due to this we also do not account for any
but instead use OS intrinsics with the mutex handle directly. Due to this we also do not account for any
time the condition variable is blocked on another holder of the mutex. */
class condition_variable final
{
@ -283,7 +283,7 @@ public:
owner->mutex.unlock ();
}
T * operator-> ()
T * operator->()
{
return &owner->obj;
}
@ -301,7 +301,7 @@ public:
locked * owner{ nullptr };
};
scoped_lock operator-> ()
scoped_lock operator->()
{
return scoped_lock (this);
}

View file

@ -16,8 +16,8 @@ bool get_use_memory_pools ();
void set_use_memory_pools (bool use_memory_pools);
/** This makes some heuristic assumptions about the implementation defined shared_ptr internals.
Should only be used in the memory pool purge functions at exit, which doesn't matter much if
it is incorrect (other than reports from heap memory analysers) */
Should only be used in the memory pool purge functions at exit, which doesn't matter much if
it is incorrect (other than reports from heap memory analysers) */
template <typename T>
constexpr size_t determine_shared_ptr_pool_size ()
{

View file

@ -55,14 +55,14 @@ public:
return *ptr;
}
T * const operator-> ()
T * const operator->()
{
return ptr.operator-> ();
return ptr.operator->();
}
T const * const operator-> () const
T const * const operator->() const
{
return ptr.operator-> ();
return ptr.operator->();
}
T const * const get () const

View file

@ -166,8 +166,8 @@ std::shared_ptr<cpptoml::array> nano::tomlconfig::create_array (std::string cons
}
/**
* Erase keys whose values are equal to the one in \p defaults
*/
* Erase keys whose values are equal to the one in \p defaults
*/
void nano::tomlconfig::erase_default_values (tomlconfig & defaults_a)
{
std::shared_ptr<cpptoml::table> clone = std::dynamic_pointer_cast<cpptoml::table> (tree->clone ());

View file

@ -77,7 +77,7 @@ TEST (bootstrap_ascending, profile)
flags_server.disable_ongoing_bootstrap = true;
flags_server.disable_ascending_bootstrap = true;
auto data_path_server = nano::working_path (network);
//auto data_path_server = "";
// auto data_path_server = "";
auto server = std::make_shared<nano::node> (system.io_ctx, data_path_server, config_server, system.work, flags_server);
system.nodes.push_back (server);
server->start ();
@ -93,10 +93,10 @@ TEST (bootstrap_ascending, profile)
config_client.ipc_config.transport_tcp.enabled = true;
// Disable database integrity safety for higher throughput
config_client.lmdb_config.sync = nano::lmdb_config::sync_strategy::nosync_unsafe;
//auto client = system.add_node (config_client, flags_client);
// auto client = system.add_node (config_client, flags_client);
// macos 16GB RAM disk: diskutil erasevolume HFS+ "RAMDisk" `hdiutil attach -nomount ram://33554432`
//auto data_path_client = "/Volumes/RAMDisk";
// auto data_path_client = "/Volumes/RAMDisk";
auto data_path_client = nano::unique_path ();
auto client = std::make_shared<nano::node> (system.io_ctx, data_path_client, config_client, system.work, flags_client);
system.nodes.push_back (client);
@ -186,7 +186,7 @@ TEST (bootstrap_ascending, profile)
rate.observe (*client, nano::stat::type::ledger, nano::stat::detail::gap_previous, nano::stat::dir::in);
rate.background_print (3s);
//wait_for_key ();
// wait_for_key ();
while (true)
{
nano::test::establish_tcp (system, *client, server->network.endpoint ());

View file

@ -45,7 +45,7 @@ public:
return *this;
}
iterator<T, U> & operator= (iterator<T, U> const &) = delete;
std::pair<T, U> * operator-> ()
std::pair<T, U> * operator->()
{
return &current;
}

View file

@ -29,27 +29,27 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::account, nano::account_info>, store::iterator<nano::account, nano::account_info>)> const & action_a) const override;
/**
* Maps account v1 to account information, head, rep, open, balance, timestamp and block count. (Removed)
* nano::account -> nano::block_hash, nano::block_hash, nano::block_hash, nano::amount, uint64_t, uint64_t
*/
* Maps account v1 to account information, head, rep, open, balance, timestamp and block count. (Removed)
* nano::account -> nano::block_hash, nano::block_hash, nano::block_hash, nano::amount, uint64_t, uint64_t
*/
MDB_dbi accounts_v0_handle{ 0 };
/**
* Maps account v0 to account information, head, rep, open, balance, timestamp and block count. (Removed)
* nano::account -> nano::block_hash, nano::block_hash, nano::block_hash, nano::amount, uint64_t, uint64_t
*/
* Maps account v0 to account information, head, rep, open, balance, timestamp and block count. (Removed)
* nano::account -> nano::block_hash, nano::block_hash, nano::block_hash, nano::amount, uint64_t, uint64_t
*/
MDB_dbi accounts_v1_handle{ 0 };
/**
* Maps account v0 to account information, head, rep, open, balance, timestamp, block count and epoch
* nano::account -> nano::block_hash, nano::block_hash, nano::block_hash, nano::amount, uint64_t, uint64_t, nano::epoch
*/
* Maps account v0 to account information, head, rep, open, balance, timestamp, block count and epoch
* nano::account -> nano::block_hash, nano::block_hash, nano::block_hash, nano::amount, uint64_t, uint64_t, nano::epoch
*/
MDB_dbi accounts_handle{ 0 };
/**
* Representative weights. (Removed)
* nano::account -> nano::uint128_t
*/
* Representative weights. (Removed)
* nano::account -> nano::uint128_t
*/
MDB_dbi representation_handle{ 0 };
};
} // amespace nano::store::lmdb

View file

@ -37,9 +37,9 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, block_w_sideband>, store::iterator<nano::block_hash, block_w_sideband>)> const & action_a) const override;
/**
* Contains block_sideband and block for all block types (legacy send/change/open/receive & state blocks)
* nano::block_hash -> nano::block_sideband, nano::block
*/
* Contains block_sideband and block for all block types (legacy send/change/open/receive & state blocks)
* nano::block_hash -> nano::block_sideband, nano::block
*/
MDB_dbi blocks_handle{ 0 };
protected:

View file

@ -29,9 +29,9 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::account, nano::confirmation_height_info>, store::iterator<nano::account, nano::confirmation_height_info>)> const & action_a) const override;
/*
* Confirmation height of an account, and the hash for the block at that height
* nano::account -> uint64_t, nano::block_hash
*/
* Confirmation height of an account, and the hash for the block at that height
* nano::account -> uint64_t, nano::block_hash
*/
MDB_dbi confirmation_height_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -29,9 +29,9 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::qualified_root, nano::block_hash>, store::iterator<nano::qualified_root, nano::block_hash>)> const & action_a) const override;
/**
* Maps root to block hash for generated final votes.
* nano::qualified_root -> nano::block_hash
*/
* Maps root to block hash for generated final votes.
* nano::qualified_root -> nano::block_hash
*/
MDB_dbi final_votes_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -26,9 +26,9 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, nano::account>, store::iterator<nano::block_hash, nano::account>)> const & action_a) const override;
/**
* Maps head block to owning account
* nano::block_hash -> nano::account
*/
* Maps head block to owning account
* nano::block_hash -> nano::account
*/
MDB_dbi frontiers_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -95,7 +95,7 @@ public:
return *this;
}
std::pair<store::db_val<MDB_val>, store::db_val<MDB_val>> * operator-> ()
std::pair<store::db_val<MDB_val>, store::db_val<MDB_val>> * operator->()
{
return &current;
}
@ -213,9 +213,9 @@ public:
return *this;
}
std::pair<store::db_val<MDB_val>, store::db_val<MDB_val>> * operator-> ()
std::pair<store::db_val<MDB_val>, store::db_val<MDB_val>> * operator->()
{
return least_iterator ().operator-> ();
return least_iterator ().operator->();
}
bool operator== (merge_iterator<T, U> const & other) const

View file

@ -22,9 +22,9 @@ public:
void clear (store::write_transaction const & transaction_a) override;
/**
* Samples of online vote weight
* uint64_t -> nano::amount
*/
* Samples of online vote weight
* uint64_t -> nano::amount
*/
MDB_dbi online_weight_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -22,9 +22,9 @@ public:
store::iterator<nano::endpoint_key, nano::no_value> end () const override;
/*
* Endpoints for peers
* nano::endpoint_key -> no_value
*/
* Endpoints for peers
* nano::endpoint_key -> no_value
*/
MDB_dbi peers_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -28,21 +28,21 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::pending_key, nano::pending_info>, store::iterator<nano::pending_key, nano::pending_info>)> const & action_a) const override;
/**
* Maps min_version 0 (destination account, pending block) to (source account, amount). (Removed)
* nano::account, nano::block_hash -> nano::account, nano::amount
*/
* Maps min_version 0 (destination account, pending block) to (source account, amount). (Removed)
* nano::account, nano::block_hash -> nano::account, nano::amount
*/
MDB_dbi pending_v0_handle{ 0 };
/**
* Maps min_version 1 (destination account, pending block) to (source account, amount). (Removed)
* nano::account, nano::block_hash -> nano::account, nano::amount
*/
* Maps min_version 1 (destination account, pending block) to (source account, amount). (Removed)
* nano::account, nano::block_hash -> nano::account, nano::amount
*/
MDB_dbi pending_v1_handle{ 0 };
/**
* Maps (destination account, pending block) to (source account, amount, version). (Removed)
* nano::account, nano::block_hash -> nano::account, nano::amount, nano::epoch
*/
* Maps (destination account, pending block) to (source account, amount, version). (Removed)
* nano::account, nano::block_hash -> nano::account, nano::amount, nano::epoch
*/
MDB_dbi pending_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -25,9 +25,9 @@ public:
void for_each_par (std::function<void (store::read_transaction const &, store::iterator<nano::block_hash, std::nullptr_t>, store::iterator<nano::block_hash, std::nullptr_t>)> const & action_a) const override;
/**
* Pruned blocks hashes
* nano::block_hash -> none
*/
* Pruned blocks hashes
* nano::block_hash -> none
*/
MDB_dbi pruned_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -17,9 +17,9 @@ public:
int get (store::transaction const & transaction_a) const override;
/**
* Meta information about block store, such as versions.
* nano::uint256_union (arbitrary key) -> blob
*/
* Meta information about block store, such as versions.
* nano::uint256_union (arbitrary key) -> blob
*/
MDB_dbi meta_handle{ 0 };
};
} // namespace nano::store::lmdb

View file

@ -129,7 +129,7 @@ public:
return *this;
}
std::pair<nano::store::rocksdb::db_val, nano::store::rocksdb::db_val> * operator-> ()
std::pair<nano::store::rocksdb::db_val, nano::store::rocksdb::db_val> * operator->()
{
return &current;
}