This PR continues the ongoing effort to enforce IWYU warnings.
See Developer Notes.
Additionally, this adds a new include category to src/.clang-format.
This PR continues the ongoing effort to enforce IWYU warnings.
See Developer Notes.
Additionally, this adds a new include category to src/.clang-format.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34338.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
src/util and treat them as errors by hebasto)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.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
Rebased to resolve a conflict with the merged bitcoin/bitcoin#34296.
Rebased.
ACK 01ab21f83824d124e9ca37f67a9535893ad9ae28
This PR fixes the zmq warnings as reported by iwyu on master:
<details>
/home/admin/actions-runner/_work/_temp/src/zmq/zmqnotificationinterface.h should add these lines:
#include <cstddef> // for byte
/home/admin/actions-runner/_work/_temp/src/zmq/zmqnotificationinterface.h should remove these lines:
- class CBlock; // lines 17-17
- struct NewMempoolTransactionInfo; // lines 20-20
/home/admin/actions-runner/_work/_temp/src/zmq/zmqnotificationinterface.cpp should add these lines:
#include <util/check.h> // for inline_assertion_check, assert
/home/admin/actions-runner/_work/_temp/src/zmq/zmqnotificationinterface.cpp should remove these lines:
- #include <validationinterface.h> // lines 14-14
- #include <cassert> // lines 21-21
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqrpc.h has correct #includes/fwd-decls)
/home/admin/actions-runner/_work/_temp/src/zmq/zmqrpc.cpp should add these lines:
#include <memory> // for operator==, unique_ptr, default_delete
#include <utility> // for move
#include <vector> // for vector
/home/admin/actions-runner/_work/_temp/src/zmq/zmqrpc.cpp should remove these lines:
/usr/include/c++/14/bits/unicode-data.h:1:1: warning: no private include name for [@headername](/bitcoin-bitcoin/contributor/headername/) mapping
/home/admin/actions-runner/_work/_temp/src/zmq/zmqpublishnotifier.h should add these lines:
#include <utility> // for move
/home/admin/actions-runner/_work/_temp/src/zmq/zmqpublishnotifier.h should remove these lines:
- class CTransaction; // lines 16-16
/home/admin/actions-runner/_work/_temp/src/zmq/zmqpublishnotifier.cpp should add these lines:
#include <util/check.h> // for inline_assertion_check, assert
#include <span> // for as_bytes
/home/admin/actions-runner/_work/_temp/src/zmq/zmqpublishnotifier.cpp should remove these lines:
- #include <chainparams.h> // lines 8-8
- #include <kernel/cs_main.h> // lines 10-10
- #include <node/blockstorage.h> // lines 14-14
- #include <primitives/block.h> // lines 15-15
- #include <rpc/server.h> // lines 17-17
- #include <sync.h> // lines 20-20
- #include <cassert> // lines 26-26
- namespace Consensus { struct Params; } // lines 38-38
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqutil.h has correct #includes/fwd-decls)
/home/admin/actions-runner/_work/_temp/src/zmq/zmqutil.cpp should add these lines:
#include <util/check.h> // for inline_assertion_check
/home/admin/actions-runner/_work/_temp/src/zmq/zmqutil.cpp should remove these lines:
</details>
After change IWUY does not complain about zmq:
<details>
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqabstractnotifier.h has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqabstractnotifier.cpp has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqutil.h has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqutil.cpp has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqpublishnotifier.h has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqpublishnotifier.cpp has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqrpc.h has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqrpc.cpp has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqnotificationinterface.h has correct #includes/fwd-decls)
(/home/admin/actions-runner/_work/_temp/src/zmq/zmqnotificationinterface.cpp has correct #includes/fwd-decls)
</details>
The enforcement is also added to the zmq folder, and will result in iwyu to fail, tested on master:
<details>
diff --git a/src/zmq/zmqutil.cpp b/src/zmq/zmqutil.cpp
index d3addaad4b..f2d22dbe73 100644
--- a/src/zmq/zmqutil.cpp
+++ b/src/zmq/zmqutil.cpp
@@ -5,6 +5,7 @@
#include <zmq/zmqutil.h>
#include <logging.h>
+#include <util/check.h>
#include <zmq.h>
#include <cerrno>
+ echo '^^^ ?? Failure generated from IWYU'
+ false
^^^ ?? Failure generated from IWYU
</details>
16 | #include <vector> 17 | 18 | -class CBlock; 19 | class CBlockIndex; 20 | class CZMQAbstractNotifier; 21 | -struct NewMempoolTransactionInfo;
seems wrong to remove?
These types are part of the signatures of overridden virtual functions. Since the base class is fully defined here, these types are guaranteed to be declared already.
9 | @@ -10,10 +10,10 @@ 10 | #include <cstddef> 11 | #include <cstdint> 12 | #include <functional> 13 | +#include <utility> 14 | #include <vector> 15 | 16 | class CBlockIndex; 17 | -class CTransaction;
same?
01ab21f83824d124e9ca37f67a9535893ad9ae28 🚣
<details><summary>Show signature</summary>
Signature:
untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: 01ab21f83824d124e9ca37f67a9535893ad9ae28 🚣
fcZfYPWOW71LWfnqPn2sYlXBe2sSRgj375V9CwdZgq1AvlONo5B4fwuvLL9OlfjwVy5KZosKsWpGkoJdzhjyAA==
</details>
review ACK efcbf794484ecc02cae05e520120df9d1aa8c93a 🐼
<details><summary>Show signature</summary>
Signature:
untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK efcbf794484ecc02cae05e520120df9d1aa8c93a 🐼
dK9vUftLo0y2W3gamChSO1sXSyBXPZ1O39nEhmzU0oQNbDW5hZTqX0EzwMzSqp3bnGgf1YK2hKYEie3Inqi2AQ==
</details>
re ACK efcbf794484ecc02cae05e520120df9d1aa8c93a
change since last ACK:
ACK efcbf794484ecc02cae05e520120df9d1aa8c93a