First two commits address comments from discussion in #33779:
The last commit adds a new section to the Developer Notes to document IWYU usage.
<!--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/34319.
<!--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:
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-->
review ACK 923d9ec210275380d8ccacd72076e45b3fe1300d 🗝
<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 923d9ec210275380d8ccacd72076e45b3fe1300d 🗝
3gbYgUA7TO+HxA5uAklmQ6kkZ9K2WfRkMuZwtv0dac3+u03TG/UXcrLUYCRYjojS4wOsSRkBO8g6NXEbBkWYDA==
</details>
557 | @@ -558,6 +558,25 @@ llvm-cov show \ 558 | 559 | The generated coverage report can be accessed at `build/coverage_report/index.html`. 560 | 561 | +### Using IWYU 562 | + 563 | +The [`include-what-you-use`](https://github.com/include-what-you-use/include-what-you-use) tool (IWYU) 564 | +helps to enforce the source code organization [policy](#source-code-organization) in this repository. 565 | + 566 | +When running IWYU locally, it is recommended to use the same version as the [CI](/ci/test/00_setup_env_native_iwyu.sh)
Does this actually work? Doesn't the standard library/compiler version also need to match? I'm guessing it won't work for anyone on macOS?
I would think it'd be better to only recommended using the CI job (locally), so it's guaranteed to produce the same results.
570 | +In some cases, IWYU might suggest headers that seem unnecessary at first glance, but are actually required. 571 | +For example, a macro may use a symbol that requires its own include. Another example is passing a string literal 572 | +to a function that accepts a `std::string` parameter: an implicit conversion occurs at the callsite using the 573 | +`std::string` constructor, which makes the corresponding header required. 574 | + 575 | +We accept these suggestions, and no further action is required to silence them.
If the suggestion has been applied, there shouldn't be anything left to silence?
ACK d9c244d715fea8dbd43a523291a2ab3e078a20d3
re-ACK d9c244d715fea8dbd43a523291a2ab3e078a20d3 🎇
<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: re-ACK d9c244d715fea8dbd43a523291a2ab3e078a20d3 🎇
Kn0A9qUoWRMcrTQTa8FuqTne/hvBfdUet1MEWJ7/qsHbwUhOwK2TMPh/0kLqU2HgTs09i7q6CkcIiXH9vp9sBg==
</details>
Rebased to resolve a silent conflict with the merged bitcoin/bitcoin#33779.
re-ACK 8eaed49fc812ad9a11ba3f0766fbb3f7ef6d3fc5 👐
<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: re-ACK 8eaed49fc812ad9a11ba3f0766fbb3f7ef6d3fc5 👐
HNT1K8/I26C+IlzgmYzHWCeG2y/L3y1Le1euZ03l7jK/j2+6wzPVkWCAt/NmHwAiG1qD+ApdZQeWCObnYcLwDg==
</details>
`IWYU pragma: export` enforces the transitive inclusion of the headers,
which undermines the purpose of IWYU.
The remained cases seem useful and could be considered separately:
- `<cassert>` in `util/check.h`
- `<filesystem>` in `util/fs.h`
- `<chrono>` in `util/time.h`
Rebased to resolve a conflict with the merged bitcoin/bitcoin#34296.
re-ACK d938947b3a89a61784a72c533df623f9eb2fec49 🚀
<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: re-ACK d938947b3a89a61784a72c533df623f9eb2fec49 🚀
Z5UwG1phFy1b4JCBvhWEIXLVpwQII8kH+NSqOBSz/0wkRkmZS58Lcf/15ee89wDpMY/vFh6pWNL2eZblFP4rDA==
</details>