mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:26:38 +00:00
refactor: Enable more tidy bugprone checks #36588
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36588
Loading…
Reference in a new issue
No description provided.
Delete branch "2610-tidy-bugprone"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enable some bugprone clang-tidy checks, which seem useful.
Apart from a test-only bug, they didn't find anything severe, but I think it still makes sense to enable them, so that it is easier to read the resulting code. Also, it is trivial to disable them, if they turn out annoying.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Base:
631b0065a7f2696a7240db4bbb63589444dc96b8Head:
facb2209061ce40f558d9e1feaaf8e9a627117e5Findings
Suggestions
Replace the unused
<algorithm>include (src/qt/walletcontroller.cpp:182, head)The
std::removecall was replaced, and this file has no remaining<algorithm>use.std::eraseis available through the vector header, while the remainingstd::make_pairandstd::moveuses need<utility>. Replace<algorithm>with<utility>to keep the direct standard-library dependencies explicit.Previously reported; verified as still present in this revision. Status: still_present. Author position: none. Originally reported at
facb2209061ce40f558d9e1feaaf8e9a627117e5. The file still includes , while the former std::remove call has been replaced by std::erase. The file continues to use std::make_pair and std::move without directly including , so the reported include-maintenance issue remains; the change removed the prior algorithm use, so it is not unchanged.Full review report
🚧 At least one of the CI tasks failed.
Task
tidy: https://github.com/bitcoin/bitcoin/actions/runs/39580996840/job/119158281831LLM reason (✨ experimental): The build failed because Clang treated the unused
copy_targetvariable inutil_not_null_tests.cppas an error (-Werror).Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
Concept ACK.
Concept ACK
fa60b2ae8dWhat do you mean by this?
https://en.cppreference.com/cpp/container/vector/erase2 seems to specify that they are equivalent.
Heh, the docs say that
std::erase(c,v);
is equivalent to
c.erase(std::remove(c.begin(), c.end(), value), c.end());
However, the code here is:
m_wallets.erase(std::remove(m_wallets.begin(), m_wallets.end(), wallet_model)); // note the "missing" end
This is harmless in this case, but confusing, because:
So my recommendation would be to completely get rid of std::vector::erase and instead use the C++20 std::erase(vector,...)
Dang, missed it. :D
nit: The commit message could be made clearer:
ACK
fa60b2ae8dThx, will leave this thread open for now, so that reviewers see it, and so that I can avoid a push and review churn.
ACK
fa60b2ae8dnote: it seems like
string-literal-with-embedded-nulonly checksstd::stringconstructors, notstd::string_view. SimilarToLower(:1156) andToUpper(:1170) tests have the same bug and don't get flagged. For example, the below diff passes the test.git diff on
fa60b2ae8dthx, done
ACK
facb220906.""svinutil_tests.cppneeds#include <string_view>.re-ACK
facb220906thx, will leave this for iwyu to fix, to limit the review churn here. (The include exists indirectly, so this is just a iwyu style issue)
put the follow-up in https://github.com/bitcoin/bitcoin/pull/36682