Skip to content

Commit da67b75

Browse files
committed
Merge bitcoin/bitcoin#22903: Enable clang-tidy bugprone-argument-comment and fix violations
fa57fa1 Enable clang-tidy bugprone-argument-comment and fix violations (MarcoFalke) Pull request description: Named arguments can be dangerous when they are wrong, because they are not enforced by the compiler. Currently there are only minor typos, no actual bugs. Fix the typos and add the `.clang-tidy` file to make it easier to find them in the future. ACKs for top commit: practicalswift: cr ACK fa57fa1 fanquake: ACK fa57fa1 Tree-SHA512: b66f01e0a1e77e56ed8454002176df660cc2cc0947a90785aa33cc5b8003a1f99fd8b2f8f89f2a0bf180ff2c42c031d69e669d127bb557b879c17975275a220b
2 parents 5e3380b + fa57fa1 commit da67b75

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

src/.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Checks: '-*,bugprone-argument-comment'
2+
WarningsAsErrors: bugprone-argument-comment

src/bench/coin_selection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void CoinSelection(benchmark::Bench& bench)
5353
const CoinSelectionParams coin_selection_params(/* change_output_size= */ 34,
5454
/* change_spend_size= */ 148, /* effective_feerate= */ CFeeRate(0),
5555
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
56-
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
56+
/* tx_noinputs_size= */ 0, /* avoid_partial= */ false);
5757
bench.run([&] {
5858
std::set<CInputCoin> setCoinsRet;
5959
CAmount nValueRet;

src/qt/test/addressbooktests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void TestAddAddressesToSendBook(interfaces::Node& node)
112112
WalletContext& context = *node.walletClient().context();
113113
AddWallet(context, wallet);
114114
WalletModel walletModel(interfaces::MakeWallet(context, wallet), clientModel, platformStyle.get());
115-
RemoveWallet(context, wallet, /* load_on_startup= */ std::nullopt);
115+
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt);
116116
EditAddressDialog editAddressDialog(EditAddressDialog::NewSendingAddress);
117117
editAddressDialog.setModel(walletModel.getAddressTableModel());
118118

src/qt/test/wallettests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void TestGUI(interfaces::Node& node)
167167
WalletContext& context = *node.walletClient().context();
168168
AddWallet(context, wallet);
169169
WalletModel walletModel(interfaces::MakeWallet(context, wallet), clientModel, platformStyle.get());
170-
RemoveWallet(context, wallet, /* load_on_startup= */ std::nullopt);
170+
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt);
171171
sendCoinsDialog.setModel(&walletModel);
172172
transactionView.setModel(&walletModel);
173173

src/signet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ bool CheckSignetBlockSolution(const CBlock& block, const Consensus::Params& cons
141141

142142
PrecomputedTransactionData txdata;
143143
txdata.Init(signet_txs->m_to_sign, {signet_txs->m_to_spend.vout[0]});
144-
TransactionSignatureChecker sigcheck(&signet_txs->m_to_sign, /*nIn=*/ 0, /*amount=*/ signet_txs->m_to_spend.vout[0].nValue, txdata, MissingDataBehavior::ASSERT_FAIL);
144+
TransactionSignatureChecker sigcheck(&signet_txs->m_to_sign, /* nInIn= */ 0, /* amountIn= */ signet_txs->m_to_spend.vout[0].nValue, txdata, MissingDataBehavior::ASSERT_FAIL);
145145

146146
if (!VerifyScript(scriptSig, signet_txs->m_to_spend.vout[0].scriptPubKey, &witness, BLOCK_SCRIPT_VERIFY_FLAGS, sigcheck)) {
147147
LogPrint(BCLog::VALIDATION, "CheckSignetBlockSolution: Errors in block (block solution invalid)\n");

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static bool CheckInputsFromMempoolAndCache(const CTransaction& tx, TxValidationS
415415
}
416416

417417
// Call CheckInputScripts() to cache signature and script validity against current tip consensus rules.
418-
return CheckInputScripts(tx, state, view, flags, /* cacheSigStore = */ true, /* cacheFullSciptStore = */ true, txdata);
418+
return CheckInputScripts(tx, state, view, flags, /* cacheSigStore= */ true, /* cacheFullScriptStore= */ true, txdata);
419419
}
420420

421421
namespace {

src/wallet/load.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void UnloadWallets(WalletContext& context)
165165
auto wallet = wallets.back();
166166
wallets.pop_back();
167167
std::vector<bilingual_str> warnings;
168-
RemoveWallet(context, wallet, /* load_on_startup= */ std::nullopt, warnings);
168+
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt, warnings);
169169
UnloadWallet(std::move(wallet));
170170
}
171171
}

src/wallet/test/coinselector_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ CoinEligibilityFilter filter_standard_extra(6, 6, 0);
4040
CoinSelectionParams coin_selection_params(/* change_output_size= */ 0,
4141
/* change_spend_size= */ 0, /* effective_feerate= */ CFeeRate(0),
4242
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
43-
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
43+
/* tx_noinputs_size= */ 0, /* avoid_partial= */ false);
4444

4545
static void add_coin(const CAmount& nValue, int nInput, std::vector<CInputCoin>& set)
4646
{
@@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
287287
CoinSelectionParams coin_selection_params_bnb(/* change_output_size= */ 0,
288288
/* change_spend_size= */ 0, /* effective_feerate= */ CFeeRate(3000),
289289
/* long_term_feerate= */ CFeeRate(1000), /* discard_feerate= */ CFeeRate(1000),
290-
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
290+
/* tx_noinputs_size= */ 0, /* avoid_partial= */ false);
291291
CoinSet setCoinsRet;
292292
CAmount nValueRet;
293293
empty_wallet();
@@ -654,7 +654,7 @@ BOOST_AUTO_TEST_CASE(SelectCoins_test)
654654
CoinSelectionParams cs_params(/* change_output_size= */ 34,
655655
/* change_spend_size= */ 148, /* effective_feerate= */ CFeeRate(0),
656656
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
657-
/* tx_no_inputs_size= */ 0, /* avoid_partial= */ false);
657+
/* tx_noinputs_size= */ 0, /* avoid_partial= */ false);
658658
CoinSet out_set;
659659
CAmount out_value = 0;
660660
CCoinControl cc;

src/wallet/test/wallet_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ BOOST_FIXTURE_TEST_CASE(importmulti_rescan, TestChain100Setup)
235235
"downloading and rescanning the relevant blocks (see -reindex and -rescan "
236236
"options).\"}},{\"success\":true}]",
237237
0, oldTip->GetBlockTimeMax(), TIMESTAMP_WINDOW));
238-
RemoveWallet(context, wallet, /* load_on_startup= */ std::nullopt);
238+
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt);
239239
}
240240
}
241241

@@ -280,7 +280,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
280280
request.params.push_back(backup_file);
281281

282282
::dumpwallet().HandleRequest(request);
283-
RemoveWallet(context, wallet, /* load_on_startup= */ std::nullopt);
283+
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt);
284284
}
285285

286286
// Call importwallet RPC and verify all blocks with timestamps >= BLOCK_TIME
@@ -299,7 +299,7 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
299299
AddWallet(context, wallet);
300300
wallet->SetLastBlockProcessed(m_node.chainman->ActiveChain().Height(), m_node.chainman->ActiveChain().Tip()->GetBlockHash());
301301
::importwallet().HandleRequest(request);
302-
RemoveWallet(context, wallet, /* load_on_startup= */ std::nullopt);
302+
RemoveWallet(context, wallet, /* load_on_start= */ std::nullopt);
303303

304304
BOOST_CHECK_EQUAL(wallet->mapWallet.size(), 3U);
305305
BOOST_CHECK_EQUAL(m_coinbase_txns.size(), 103U);

0 commit comments

Comments
 (0)