-
Notifications
You must be signed in to change notification settings - Fork 37.4k
clang-tidy: Fix modernize-use-default-member-init
in headers and force to check all headers
#26705
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
concept ack, but it might be good to create one pull/commit for each bugfix. For example, it might be easier to review if there was a separate pull/commit to fix broken |
Could this be done with a scripted-diff script using the clang-tidy -fix-errors command? |
Concept ACK I agree with @MarcoFalke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fac1a47
Please review:
Drafting this PR for now. |
…ring-init` in headers c39619e clang-tidy: Fix `readability-redundant-string-init` in headers (Hennadii Stepanov) Pull request description: Split from #26705 as was requested in #26705 (comment). To test this PR, consider applying a diff as follows: ```diff --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -12,17 +12,9 @@ readability-redundant-declaration, readability-redundant-string-init, ' WarningsAsErrors: ' -bugprone-argument-comment, -bugprone-use-after-move, -misc-unused-using-decls, -modernize-use-default-member-init, -modernize-use-nullptr, -performance-for-range-copy, -performance-move-const-arg, -performance-unnecessary-copy-initialization, -readability-redundant-declaration, readability-redundant-string-init, ' CheckOptions: - key: performance-move-const-arg.CheckTriviallyCopyableMove value: false +HeaderFilterRegex: '.' ``` ACKs for top commit: MarcoFalke: review ACK c39619e Tree-SHA512: d7b61be17737f68b8bb40b084cf03f89eae86f4951da2aa000fde0c5245491a01dbb83e5d6e870c6bab4de2dbb5c0eb0dd6613da71592b3a27cf2000a45eaeeb
…nings in headers 1308b83 clang-tidy: Fix `performance-no-automatic-move` in headers (Hennadii Stepanov) 0a5dc03 clang-tidy: Fix `performance-move-const-arg` in headers (Hennadii Stepanov) Pull request description: Split from bitcoin/bitcoin#26705 as was requested in bitcoin/bitcoin#26705 (comment). To test this PR, consider applying a diff as follows: ```diff --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,16 +1,7 @@ Checks: ' -*, -bugprone-argument-comment, -bugprone-use-after-move, -misc-unused-using-decls, -modernize-use-default-member-init, -modernize-use-nullptr, -performance-for-range-copy, performance-move-const-arg, performance-no-automatic-move, -performance-unnecessary-copy-initialization, -readability-redundant-declaration, -readability-redundant-string-init, ' WarningsAsErrors: ' bugprone-argument-comment, @@ -28,4 +19,4 @@ readability-redundant-string-init, CheckOptions: - key: performance-move-const-arg.CheckTriviallyCopyableMove value: false -HeaderFilterRegex: './qt' +HeaderFilterRegex: '.' ``` ACKs for top commit: fanquake: 8000 ACK 1308b83 Tree-SHA512: b7ef9a3e789846130ab4c3fd6fbe8d887bdbcd438e4cbc78e2b1ac01f819ae13d7f69c2a25f480bd36e3e7f58886a7d5a8609a3c3275c315e0697cd4010474bd
… headers 1308b83 clang-tidy: Fix `performance-no-automatic-move` in headers (Hennadii Stepanov) 0a5dc03 clang-tidy: Fix `performance-move-const-arg` in headers (Hennadii Stepanov) Pull request description: Split from bitcoin#26705 as was requested in bitcoin#26705 (comment). To test this PR, consider applying a diff as follows: ```diff --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,16 +1,7 @@ Checks: ' -*, -bugprone-argument-comment, -bugprone-use-after-move, -misc-unused-using-decls, -modernize-use-default-member-init, -modernize-use-nullptr, -performance-for-range-copy, performance-move-const-arg, performance-no-automatic-move, -performance-unnecessary-copy-initialization, -readability-redundant-declaration, -readability-redundant-string-init, ' WarningsAsErrors: ' bugprone-argument-comment, @@ -28,4 +19,4 @@ readability-redundant-string-init, CheckOptions: - key: performance-move-const-arg.CheckTriviallyCopyableMove value: false -HeaderFilterRegex: './qt' +HeaderFilterRegex: '.' ``` ACKs for top commit: fanquake: ACK 1308b83 Tree-SHA512: b7ef9a3e789846130ab4c3fd6fbe8d887bdbcd438e4cbc78e2b1ac01f819ae13d7f69c2a25f480bd36e3e7f58886a7d5a8609a3c3275c315e0697cd4010474bd
Rebased and ready for reviewing. |
So this is only fixing Edit: Modulo #26705 (comment) |
That's true. |
modernize-use-default-member-init
in headers and force to check all headers
Rebased. The PR description has been updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review ACK b0e9169 🍹
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK b0e916913cedb8154419ec818bb9094a72fc8379 🍹
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgbsgwAulUHjNHcytUabJBoaqpKSZ+tuqsd7gFyApI1CC7025pswCu+Ph1iCICt
rpOLfGLvKaWkDF54XUANxTSmk4xP9hnfYdRgllcVi7zbRg1I3Tnr3J5zt2L1PYQH
AcZ+p1fIZautxpg1440WHwlbJL3F8e84rQ2WPRJlpFt5gN9LuKKMVVvZpALna669
kMVk2G9995kbpzDzQWPXYl0LC5aDwdeOIui+DUcHKzIYywTpMAHCMk1F4hUF1J6Q
JdJ/X2pjNpxgRhCL2rdzZ47pZMUWfEMLMs0BslbCmg/6OdKa1NrtHCQZ1FOy+T3v
/Y9D+Z1L7Ku9tzQPzADOy8oL410DZtrchANrlUVBoLBz34uWMHgp/jNqvqvy1jzh
2+4bNe+K8srE1E3y5mUvY68ddB6+4rE05mmKyBd9Rycg5XNsKVAsoZasbD0jBX9C
adldbvwYXjOlIxXlllGGDrOB5m7kqHmWTaCN+SzjRyR/1Gy+a6epas/WHkiYHyuC
HkGz+8hB
=QqPj
-----END PGP SIGNATURE-----
@@ -107,7 +107,7 @@ class Span | |||
|
|||
|
|||
public: | |||
constexpr Span() noexcept : m_data(nullptr), m_size(0) {} | |||
constexpr Span() noexcept : m_data(nullptr) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why nullptr isn't fixed as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it has been overlooked. The clang-tidy
does not complain, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it refrains because there are multiple constructors: https://github.com/llvm/llvm-project/blob/78f88082de3627ea04501c83a08f52cf1e60b4f7/clang-tools-extra/test/clang-tidy/checkers/modernize/use-default-member-init.cpp#L56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in clang-tidy-17, see llvm/llvm-project@fa491fe
This PR:
modernize-use-default-member-init
clang-tidy
check all headersCloses #26703.