Skip to content

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

Open
hebasto wants to merge 2 commits into
bitcoin:masterfrom
hebasto:261112-iwyu-src
Open

hebasto wants to merge 2 commits into
bitcoin:masterfrom
hebasto:261112-iwyu-src

Conversation

@hebasto

@hebasto hebasto commented Nov 12, 2026 •

Copy link
Copy Markdown
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.

@DrahtBot

DrahtBot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

External sites

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 <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #37015 (Use O(log n) skiplist construction in CBlockIndex by sipa)
  • #36946 (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)
  • #36897 (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
  • #36114 (wallet: harden external signer psbt processing, revamp mock by Sjors)
  • #35229 (refactor: Use CBlockIndex parameters as reference by optout21)
  • #27260 (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.

@jeanpablojp jeanpablojp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 24a91c9

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"

@hebasto hebasto changed the title 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 Nov 20, 2026
@hebasto

hebasto commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

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.

@fanquake

Copy link
Copy Markdown
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.

@DrahtBot

Copy link
Copy Markdown
Contributor

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

Hints

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.

@hebasto

hebasto commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

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.

This makes the list easier to read and extend, and keeps diffs
minimal when files are added.
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.
@hebasto

hebasto commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Rebased to resolve a conflict with the merged #36967.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants