Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Dec 15, 2022

This PR:

  • fixes the only remained check in headers, i.e., modernize-use-default-member-init
  • forces clang-tidy check all headers

Closes #26703.

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 15, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK MarcoFalke
Concept ACK RandyMcMillan
Stale ACK w0xlt

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26812 (test: add end-to-end tests for CConnman and PeerManager by vasild)
  • #26312 (Remove Sock::Get() and Sock::Sock() by vasild)
  • #21878 (Make all networking code mockable by vasild)
  • #14485 (Try to use posix_fadvise with CBufferedFile by luke-jr)
  • #10443 (Add fee_est tool for debugging fee estimation code by ryanofsky)

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.

@maflcko
Copy link
Member

maflcko commented Dec 15, 2022

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 std::move.

@aureleoules
Copy link
Contributor

Could this be done with a scripted-diff script using the clang-tidy -fix-errors command?

@RandyMcMillan
Copy link
Contributor

Concept ACK

I agree with @MarcoFalke

Copy link
Contributor

@w0xlt w0xlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fac1a47

@hebasto
Copy link
Member Author

hebasto commented Dec 15, 2022

@hebasto hebasto marked this pull request as draft December 15, 2022 21:39
maflcko pushed a commit that referenced this pull request Dec 16, 2022
…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
maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Jan 24, 2023
…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:
    ACK 1308b83

Tree-SHA512: b7ef9a3e789846130ab4c3fd6fbe8d887bdbcd438e4cbc78e2b1ac01f819ae13d7f69c2a25f480bd36e3e7f58886a7d5a8609a3c3275c315e0697cd4010474bd
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 24, 2023
… 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
@hebasto hebasto marked this pull request as ready for review January 24, 2023 20:47
@hebasto
Copy link
Member Author

hebasto commented Jan 24, 2023

Rebased and ready for reviewing.

@maflcko
Copy link
Member

maflcko commented Jan 26, 2023

So this is only fixing modernize-use-default-member-init, and no other remaining checks?

Edit: Modulo #26705 (comment)

@hebasto
Copy link
Member Author

hebasto commented Jan 26, 2023

So this is only fixing modernize-use-default-member-init, and no other remaining checks?

Edit: Modulo #26705 (comment)

That's true.

@hebasto hebasto changed the title clang-tidy: Check headers and fixes them clang-tidy: Fix modernize-use-default-member-init in headers and force to check all headers Jan 31, 2023
@hebasto
Copy link
Member Author

hebasto commented Jan 31, 2023

Rebased. The PR description has been updated.

Copy link
Member

@maflcko maflcko left a 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) {}
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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

@maflcko maflcko merged commit e1bf547 into bitcoin:master Feb 1, 2023
@hebasto hebasto deleted the 221215-tidy branch February 1, 2023 12:29
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 1, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Mar 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ci: clang-tidy does not check header files?
6 participants