Drop some IWYU pragma: export and document IWYU usage #34319

pull hebasto wants to merge 3 commits into bitcoin:master from hebasto:260116-iwyu-export changing 6 files +24 −6
  1. hebasto commented at 2:19 pm on January 16, 2026: member

    First two commits address comments from discussion in #33779:

    The last commit adds a new section to the Developer Notes to document IWYU usage.

  2. DrahtBot commented at 2:19 pm on January 16, 2026: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34319.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko
    Stale ACK sedited

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34296 (refactor: [move-only] Merge core_io module, remove from libkernel by maflcko)

    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.

  3. maflcko commented at 2:44 pm on January 16, 2026: member

    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==
    
  4. in doc/developer-notes.md:566 in 923d9ec210
    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)
    


    fanquake commented at 4:26 pm on January 16, 2026:

    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.


    hebasto commented at 5:16 pm on January 16, 2026:
    Thanks! Updated.
  5. in doc/developer-notes.md:575 in 923d9ec210
    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.
    


    fanquake commented at 4:27 pm on January 16, 2026:
    If the suggestion has been applied, there shouldn’t be anything left to silence?

    hebasto commented at 5:16 pm on January 16, 2026:
    Thanks! Reworded.
  6. hebasto force-pushed on Jan 16, 2026
  7. hebasto commented at 5:16 pm on January 16, 2026: member
    The recent feedback from @fanquake has been addressed.
  8. hebasto added the label Refactoring on Jan 16, 2026
  9. hebasto added the label Docs on Jan 16, 2026
  10. sedited approved
  11. sedited commented at 11:56 am on January 19, 2026: contributor
    ACK d9c244d715fea8dbd43a523291a2ab3e078a20d3
  12. DrahtBot requested review from maflcko on Jan 19, 2026
  13. maflcko commented at 12:05 pm on January 19, 2026: member

    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==
    
  14. hebasto force-pushed on Jan 19, 2026
  15. hebasto commented at 12:39 pm on January 19, 2026: member
    Rebased to resolve a silent conflict with the merged bitcoin/bitcoin#33779.
  16. maflcko commented at 12:45 pm on January 19, 2026: member

    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==
    
  17. DrahtBot requested review from sedited on Jan 19, 2026
  18. iwyu: Do not export C++ headers in most cases
    `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`
    19a2edde50
  19. iwyu: Do not export `crypto/hex_base.h` header e1a90bcecc
  20. doc: Add "Using IWYU" to Developer Notes d938947b3a
  21. hebasto force-pushed on Jan 19, 2026
  22. hebasto commented at 5:04 pm on January 19, 2026: member
    Rebased to resolve a conflict with the merged bitcoin/bitcoin#34296.
  23. maflcko commented at 5:08 pm on January 19, 2026: member

    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==
    
  24. fanquake merged this on Jan 20, 2026
  25. fanquake closed this on Jan 20, 2026

  26. hebasto deleted the branch on Jan 20, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-22 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me