diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -5,9 +5,9 @@ }, "clang-format": { "type": "clang-format", - "version": ">=12.0", + "version": ">=16.0", "bin": [ - "clang-format-12", + "clang-format-16", "clang-format" ], "include": "(^(src|chronik)/.*\\.(h|c|cpp|mm)$)", diff --git a/arcanist/linter/ClangFormatLinter.php b/arcanist/linter/ClangFormatLinter.php --- a/arcanist/linter/ClangFormatLinter.php +++ b/arcanist/linter/ClangFormatLinter.php @@ -38,28 +38,15 @@ list($stdout) = execx('%C -version', $this->getExecutableCommand()); $matches = array(); - $regex = '/clang-format version (?P\d+\.\d+)\./'; + $regex = '/clang-format version (?P\d+\.\d+(\.\d+)?)/'; if (preg_match($regex, $stdout, $matches)) { $version = $matches['version']; } else { throw new Exception(pht('Unable to read clang-format version. Please '. - 'make sure clang-format version 12.x is '. + 'make sure clang-format version 16.x is '. 'installed and in the PATH.')); } - /* - * FIXME: This is a hack to only allow for clang-format version 12.x. - * The .arclint `version` field only allow to filter versions using `=`, - * `>`, `<`, `>=` or `<=`. There is no facility to define that the required - * version should be >= 12.0 and < 13.0. - */ - if (substr($version, 0, 2) != '12') { - throw new Exception(pht('Linter %s requires clang-format version 12.x. '. - 'You have version %s.', - ClangFormatLinter::class, - $version)); - } - return $version; } diff --git a/src/addrman.cpp b/src/addrman.cpp --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -132,8 +132,8 @@ AddrManImpl::AddrManImpl(std::vector &&asmap, int32_t consistency_check_ratio) - : m_consistency_check_ratio{consistency_check_ratio}, m_asmap{std::move( - asmap)} {} + : m_consistency_check_ratio{consistency_check_ratio}, + m_asmap{std::move(asmap)} {} AddrManImpl::~AddrManImpl() { nKey.SetNull(); diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -118,8 +118,8 @@ CDBWrapper::CDBWrapper(const fs::path &path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate) - : m_name{fs::PathToString(path.stem())}, m_path{path}, m_is_memory{ - fMemory} { + : m_name{fs::PathToString(path.stem())}, m_path{path}, + m_is_memory{fMemory} { penv = nullptr; readoptions.verify_checksums = true; iteroptions.verify_checksums = true; diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -3450,9 +3450,8 @@ const std::string &addrNameIn, ConnectionType conn_type_in, bool inbound_onion) : m_connected(GetTime()), addr(addrIn), - addrBind(addrBindIn), m_addr_name{addrNameIn.empty() - ? addr.ToStringIPPort() - : addrNameIn}, + addrBind(addrBindIn), + m_addr_name{addrNameIn.empty() ? addr.ToStringIPPort() : addrNameIn}, m_inbound_onion(inbound_onion), nKeyedNetGroup(nKeyedNetGroupIn), // Don't relay addr messages to peers that we connect to as // block-relay-only peers (to prevent adversaries from inferring these diff --git a/src/rcu.h b/src/rcu.h --- a/src/rcu.h +++ b/src/rcu.h @@ -221,7 +221,9 @@ private: \ mutable std::atomic refcount{0}; \ \ - void incrementRefCount() const { refcount++; } \ + void incrementRefCount() const { \ + refcount++; \ + } \ \ bool tryDecrement() const { \ T count = refcount.load(); \ diff --git a/src/tinyformat.h b/src/tinyformat.h --- a/src/tinyformat.h +++ b/src/tinyformat.h @@ -1024,8 +1024,8 @@ #ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES template explicit FormatListN(const Args &...args) - : FormatList(&m_formatterStore[0], N), m_formatterStore{ - FormatArg(args)...} { + : FormatList(&m_formatterStore[0], N), + m_formatterStore{FormatArg(args)...} { static_assert(sizeof...(args) == N, "Number of args must be N"); } #else // C++98 version diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -53,9 +53,9 @@ int64_t time, unsigned int entry_height, bool spends_coinbase, int64_t _sigChecks, LockPoints lp) - : tx{_tx}, nFee{fee}, - nTxSize(tx->GetTotalSize()), nUsageSize{RecursiveDynamicUsage(tx)}, - nTime(time), entryHeight{entry_height}, spendsCoinbase(spends_coinbase), + : tx{_tx}, nFee{fee}, nTxSize(tx->GetTotalSize()), + nUsageSize{RecursiveDynamicUsage(tx)}, nTime(time), + entryHeight{entry_height}, spendsCoinbase(spends_coinbase), sigChecks(_sigChecks), lockPoints(lp) {} size_t CTxMemPoolEntry::GetTxVirtualSize() const { @@ -159,8 +159,8 @@ } CTxMemPool::CTxMemPool(const Options &opts) - : m_check_ratio(opts.check_ratio), - m_max_size_bytes{opts.max_size_bytes}, m_expiry{opts.expiry} { + : m_check_ratio(opts.check_ratio), m_max_size_bytes{opts.max_size_bytes}, + m_expiry{opts.expiry} { // lock free clear _clear(); } diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -1256,8 +1256,8 @@ using Options = kernel::ChainstateManagerOpts; explicit ChainstateManager(const Options &opts) - : m_config(opts.config), m_adjusted_time_callback{ - Assert(opts.adjusted_time_callback)} {}; + : m_config(opts.config), + m_adjusted_time_callback{Assert(opts.adjusted_time_callback)} {}; const CChainParams &GetParams() const { return m_config.GetChainParams(); } const Consensus::Params &GetConsensus() const { diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -370,8 +370,8 @@ : m_config{config}, m_accept_time{accept_time}, m_bypass_limits{bypass_limits}, m_coins_to_uncache{coins_to_uncache}, m_test_accept{test_accept}, - m_heightOverride{height_override}, m_package_submission{ - package_submission} {} + m_heightOverride{height_override}, + m_package_submission{package_submission} {} }; // Single transaction acceptance