-
Notifications
You must be signed in to change notification settings - Fork 38.8k
tidy: Enable more clang-tidy bugprone checks #25780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
aureleoules
wants to merge
14
commits into
bitcoin:master
from
aureleoules:2022-08-enable-bugprone-checks
Closed
tidy: Enable more clang-tidy bugprone checks #25780
aureleoules
wants to merge
14
commits into
bitcoin:master
from
aureleoules:2022-08-enable-bugprone-checks
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d3ded83 to
0e37516
Compare
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
This was referenced Aug 5, 2022
Fixes 'bugprone-bool-pointer-implicit-conversion'
Fixes 'bugprone-string-literal-with-embedded-null'
Fixes 'bugprone-inaccurate-erase'
Fixes 'bugprone-string-constructor'
Fixes 'bugprone-too-small-loop-variable'
Fixes 'bugprone-unhandled-self-assignment'
Fixes 'bugprone-suspicious-include'
Fixes 'bugprone-suspicious-string-compare'
Fixes 'bugprone-incorrect-roundings'
Fixes 'bugprone-sizeof-expression'
Fixes 'bugprone-suspicious-missing-comma'
Fixes 'bugprone-signed-char-misuse'
Fixes 'bugprone-unused-return-value'
Checks enabled: bugprone-argument-comment bugprone-assert-side-effect bugprone-assignment-in-if-condition bugprone-bad-signal-to-kill-thread bugprone-bool-pointer-implicit-conversion bugprone-copy-constructor-init bugprone-dangling-handle bugprone-dynamic-static-initializers bugprone-fold-init-type bugprone-forward-declaration-namespace bugprone-forwarding-reference-overload bugprone-inaccurate-erase bugprone-incorrect-roundings bugprone-infinite-loop bugprone-macro-repeated-side-effects bugprone-misplaced-operator-in-strlen-in-alloc bugprone-misplaced-pointer-arithmetic-in-alloc bugprone-move-forwarding-reference bugprone-multiple-statement-macro bugprone-no-escape bugprone-not-null-terminated-result bugprone-parent-virtual-call bugprone-posix-return bugprone-redundant-branch-condition bugprone-shared-ptr-array-mismatch bugprone-signal-handler bugprone-sizeof-container bugprone-sizeof-expression bugprone-spuriously-wake-up-functions bugprone-string-constructor bugprone-string-integer-assignment bugprone-string-literal-with-embedded-nul bugprone-stringview-nullptr bugprone-suspicious-enum-usage bugprone-suspicious-include bugprone-suspicious-memory-comparison bugprone-suspicious-memset-usage bugprone-suspicious-missing-comma bugprone-suspicious-semicolon bugprone-suspicious-string-compare bugprone-swapped-arguments bugprone-terminating-continue bugprone-throw-keyword-missing bugprone-too-small-loop-variable bugprone-unchecked-optional-access bugprone-undefined-memory-manipulation bugprone-undelegated-constructor bugprone-unhandled-exception-at-new bugprone-unhandled-self-assignment bugprone-unused-raii bugprone-virtual-near-miss
0e37516 to
c80038e
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables more clang-tidy bugprone checks and fixes issues discovered by enabling them.
Here are the checks now enabled:
bugprone-argument-comment
bugprone-assert-side-effect
bugprone-assignment-in-if-condition
bugprone-bad-signal-to-kill-thread
bugprone-bool-pointer-implicit-conversion
bugprone-copy-constructor-init
bugprone-dangling-handle
bugprone-dynamic-static-initializers
bugprone-fold-init-type
bugprone-forward-declaration-namespace
bugprone-forwarding-reference-overload
bugprone-inaccurate-erase
bugprone-incorrect-roundings
bugprone-infinite-loop
bugprone-macro-repeated-side-effects
bugprone-misplaced-operator-in-strlen-in-alloc
bugprone-misplaced-pointer-arithmetic-in-alloc
bugprone-move-forwarding-reference
bugprone-multiple-statement-macro
bugprone-no-escape
bugprone-not-null-terminated-result
bugprone-parent-virtual-call
bugprone-posix-return
bugprone-redundant-branch-condition
bugprone-shared-ptr-array-mismatch
bugprone-signal-handler
bugprone-sizeof-container
bugprone-sizeof-expression
bugprone-spuriously-wake-up-functions
bugprone-string-constructor
bugprone-string-integer-assignment
bugprone-string-literal-with-embedded-nul
bugprone-stringview-nullptr
bugprone-suspicious-enum-usage
bugprone-suspicious-include
bugprone-suspicious-memory-comparison
bugprone-suspicious-memset-usage
bugprone-suspicious-missing-comma
bugprone-suspicious-semicolon
bugprone-suspicious-string-compare
bugprone-swapped-arguments
bugprone-terminating-continue
bugprone-throw-keyword-missing
bugprone-too-small-loop-variable
bugprone-unchecked-optional-access
bugprone-undefined-memory-manipulation
bugprone-undelegated-constructor
bugprone-unhandled-exception-at-new
bugprone-unhandled-self-assignment
bugprone-unused-raii
bugprone-virtual-near-miss
Adding these checks makes the code more secure and helps to catch bugs and errors early. It also avoids reviewers to manually check for these issues during reviews.
I think we should enable the remaining bugprone-* checks but they require much more refactoring so it may be better to enable them in follow-ups PRs.