First two commits address comments from discussion in #33779:
The last commit adds a new section to the Developer Notes to document IWYU usage.
IWYU pragma: export and document IWYU usage
#34319
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34319.
See the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.
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.
review ACK 923d9ec210275380d8ccacd72076e45b3fe1300d 🗝
Signature:
0untrusted 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}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: review ACK 923d9ec210275380d8ccacd72076e45b3fe1300d 🗝
33gbYgUA7TO+HxA5uAklmQ6kkZ9K2WfRkMuZwtv0dac3+u03TG/UXcrLUYCRYjojS4wOsSRkBO8g6NXEbBkWYDA==
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.
re-ACK d9c244d715fea8dbd43a523291a2ab3e078a20d3 🎇
Signature:
0untrusted 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}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: re-ACK d9c244d715fea8dbd43a523291a2ab3e078a20d3 🎇
3Kn0A9qUoWRMcrTQTa8FuqTne/hvBfdUet1MEWJ7/qsHbwUhOwK2TMPh/0kLqU2HgTs09i7q6CkcIiXH9vp9sBg==
re-ACK 8eaed49fc812ad9a11ba3f0766fbb3f7ef6d3fc5 👐
Signature:
0untrusted 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}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: re-ACK 8eaed49fc812ad9a11ba3f0766fbb3f7ef6d3fc5 👐
3HNT1K8/I26C+IlzgmYzHWCeG2y/L3y1Le1euZ03l7jK/j2+6wzPVkWCAt/NmHwAiG1qD+ApdZQeWCObnYcLwDg==
`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`
re-ACK d938947b3a89a61784a72c533df623f9eb2fec49 🚀
Signature:
0untrusted 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}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: re-ACK d938947b3a89a61784a72c533df623f9eb2fec49 🚀
3Z5UwG1phFy1b4JCBvhWEIXLVpwQII8kH+NSqOBSz/0wkRkmZS58Lcf/15ee89wDpMY/vFh6pWNL2eZblFP4rDA==