iwyu: Fix warnings in more modules in `src/` and treat them as errors #36844

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:261112-iwyu-src changing 21 files +100 −30
  1. hebasto commented at 10:27 AM on November 12, 2026: member

    Split from #36808.

    This PR fixes IWYU warnings in the following source files and their associated headers, and add them to IWYU_SRC_FILES, so that any new warnings there fail CI:

    • chain.cpp
    • headerssync.cpp
    • key_io.cpp
    • merkleblock.cpp
    • pow.cpp

    The changes in other files add includes of headers that were previously included transitively.

  2. DrahtBot commented at 10:27 AM on November 12, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Stale ACK jeanpablojp

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #37015 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/37015.svg"></sub> (Use O(log n) skiplist construction in CBlockIndex by sipa)
    • #36946 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36946.svg"></sub> (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)
    • #36897 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36897.svg"></sub> (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
    • #36114 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36114.svg"></sub> (wallet: harden external signer psbt processing, revamp mock by Sjors)
    • #35229 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35229.svg"></sub> (refactor: Use CBlockIndex parameters as reference by optout21)
    • #27260 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/27260.svg"></sub> (Enhanced error messages for invalid network prefix during address parsing. by portlandhodl)

    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-->

  3. hebasto force-pushed on Nov 16, 2026
  4. hebasto force-pushed on Nov 16, 2026
  5. DrahtBot added the label CI failed on Nov 16, 2026
  6. DrahtBot removed the label CI failed on Nov 16, 2026
  7. jeanpablojp commented at 10:23 PM on November 19, 2026: contributor

    tACK 24a91c966e08906c450128393da28867ef3dc946

    Checked with Apple clang that the PR only changes line numbers in the code.

    small nit: since the only change outside src/ is the CI script, maybe the description could say "The changes in other files"

  8. hebasto renamed this:
    iwyu: Fix warnings in some modules in `src/` and treat them as errors
    iwyu: Fix warnings in more modules in `src/` and treat them as errors
    on Nov 20, 2026
  9. hebasto force-pushed on Nov 20, 2026
  10. hebasto commented at 6:15 PM on November 20, 2026: member

    small nit: since the only change outside src/ is the CI script, maybe the description could say "The changes in other files"

    Thanks! The commit message and the PR description have been updated.

  11. fanquake requested review from maflcko on Nov 25, 2026
  12. fanquake closed this on Nov 25, 2026

  13. fanquake reopened this on Nov 25, 2026

  14. fanquake commented at 12:19 PM on November 25, 2026: member

    This needs a fixup:

    [53](https://github.com/bitcoin/bitcoin/actions/runs/45612297545/job/139198659864?pr=36844#step:11:1654)
    /home/runner/work/_temp/src/wallet/migration.cpp:207:19: error: variable has incomplete type 'CBlockLocator'
      207 |     CBlockLocator best_block_locator;
          |                   ^
    /home/runner/work/_temp/src/interfaces/chain.h:36:8: note: forward declaration of 'CBlockLocator'
       36 | struct CBlockLocator;
          |        ^
    1 error generated.
    
  15. DrahtBot added the label CI failed on Nov 25, 2026
  16. DrahtBot commented at 12:32 PM on November 25, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task macOS-cross to x86_64: https://github.com/bitcoin/bitcoin/actions/runs/45612297545/job/139198659201</sub> <sub>LLM reason (✨ experimental): CI failed during compilation: migration.cpp instantiates CBlockLocator while only its forward declaration is visible, causing an incomplete-type error.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  17. hebasto force-pushed on Nov 25, 2026
  18. hebasto commented at 1:03 PM on November 25, 2026: member

    This needs a fixup:

    [53](https://github.com/bitcoin/bitcoin/actions/runs/45612297545/job/139198659864?pr=36844#step:11:1654) /home/runner/work/_temp/src/wallet/migration.cpp:207:19: error: variable has incomplete type 'CBlockLocator' 207 | CBlockLocator best_block_locator; | ^ /home/runner/work/_temp/src/interfaces/chain.h:36:8: note: forward declaration of 'CBlockLocator' 36 | struct CBlockLocator; | ^ 1 error generated.

    Rebased to resolve a conflict with the recently merged #34909, which caused the error above.

  19. DrahtBot removed the label CI failed on Nov 25, 2026
  20. DrahtBot added the label Needs rebase on Nov 26, 2026
  21. ci, refactor: List top-level IWYU-enforced files one per line
    This makes the list easier to read and extend, and keeps diffs
    minimal when files are added.
    3a540e6639
  22. iwyu: Fix warnings in more modules in `src/` and treat them as errors
    Fix IWYU warnings in the following source files and their associated
    headers, and add them to `IWYU_SRC_FILES`, so that any new warnings
    there fail CI:
    - chain.cpp
    - headerssync.cpp
    - key_io.cpp
    - merkleblock.cpp
    - pow.cpp
    
    The changes in other files add includes of headers that were previously
    included transitively.
    9214667bdf
  23. hebasto force-pushed on Nov 26, 2026
  24. hebasto commented at 5:42 PM on November 26, 2026: member

    Rebased to resolve a conflict with the merged bitcoin/bitcoin#36967.

  25. DrahtBot removed the label Needs rebase on Nov 26, 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-12-05 03:51 UTC

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