ci, iwyu: Fix warnings in src/primitives and treat them as errors #34352

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:260120-iwyu-primitives changing 6 files +18 −5
  1. hebasto commented at 2:47 pm on January 20, 2026: member

    This PR continues the ongoing effort to enforce IWYU warnings.

    See Developer Notes.

  2. ci, iwyu: Fix warnings in `src/primitives` and treat them as errors fdc9fe2da6
  3. hebasto added the label Refactoring on Jan 20, 2026
  4. DrahtBot commented at 2:47 pm on January 20, 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/34352.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK janb84, maflcko, 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:

    • #34338 (ci, iwyu: Fix warnings in src/zmq and treat them as errors by hebasto)

    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.

  5. janb84 commented at 7:02 pm on January 26, 2026: contributor

    ACK fdc9fe2da6a8640b11a2871f8b653764652f8c1f

    This PR fixes the src/primitives warnings as reported by iwyu on master:

     0/home/admin/actions-runner/_work/_temp/src/primitives/transaction.h should add these lines:
     1#include <compare>                              // for operator<
     2
     3/home/admin/actions-runner/_work/_temp/src/primitives/transaction.h should remove these lines:
     4- #include <uint256.h>  // lines 14-14
     5
     6/home/admin/actions-runner/_work/_temp/src/primitives/transaction.cpp should add these lines:
     7#include <span>                                 // for as_bytes, span
     8
     9/home/admin/actions-runner/_work/_temp/src/primitives/transaction.cpp should remove these lines:
    10- #include <uint256.h>  // lines 15-15
    11
    12
    13/home/admin/actions-runner/_work/_temp/src/primitives/block.h should add these lines:
    14#include <cinttypes>                 // for uint32_t, int64_t, int32_t
    15#include <string>                    // for string
    16#include <utility>                   // for move
    17#include <vector>                    // for vector
    18
    19/home/admin/actions-runner/_work/_temp/src/primitives/block.h should remove these lines:
    20
    21
    22/home/admin/actions-runner/_work/_temp/src/primitives/block.cpp should add these lines:
    23#include <memory>        // for shared_ptr
    24#include <span>          // for as_bytes
    25#include <sstream>       // for basic_stringstream, basic_ostream, operator<<, basic_ios, basic_iostream, basic_istream, stringstream
    26
    27/home/admin/actions-runner/_work/_temp/src/primitives/block.cpp should remove these lines:
    

    There is one deviation from the suggestion from the tool, in src/primitives/block.h not <cinttypes> is included but <cstdint>. This deviation is preferable, this include is a subset of <cinttypes> and is the ‘correct’ choice for the project.

    After these changes the iwyu does not warn anymore:

     0(/home/admin/actions-runner/_work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls)
     1
     2(/home/admin/actions-runner/_work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls)
     3
     4(/home/admin/actions-runner/_work/_temp/src/primitives/transaction.cpp has correct #includes/fwd-decls)
     5
     6(/home/admin/actions-runner/_work/_temp/src/primitives/block.h has correct #includes/fwd-decls)
     7
     8(/home/admin/actions-runner/_work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls)
     9
    10(/home/admin/actions-runner/_work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls)
    11
    12(/home/admin/actions-runner/_work/_temp/src/primitives/block.cpp has correct #includes/fwd-decls)
    13
    14(/home/admin/actions-runner/_work/_temp/src/primitives/block.h has correct #includes/fwd-decls)
    15
    16(/home/admin/actions-runner/_work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls)
    17
    18(/home/admin/actions-runner/_work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls)
    19
    20(/home/admin/actions-runner/_work/_temp/src/primitives/block.h has correct #includes/fwd-decls)
    21
    22(/home/admin/actions-runner/_work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls)
    23
    24(/home/admin/actions-runner/_work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls)
    

    also the folder is added to the iwyu enforcing list

  6. maflcko commented at 8:35 am on January 27, 2026: member

    review ACK fdc9fe2da6a8640b11a2871f8b653764652f8c1f 📀

    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 fdc9fe2da6a8640b11a2871f8b653764652f8c1f 📀
    3UB5Ype1A3WQdjfSaWb9SnYMwmdF45Ywya3AnUIggRLx85yULrAqgnuFbcjGPdknf4TpJfWFwPXoghJHe8dYXBw==
    
  7. maflcko commented at 8:42 am on January 27, 2026: member
    in the pull description, i think it is fine and sufficient to just link to https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#using-iwyu instead of all prior PRs
  8. hebasto commented at 11:12 am on January 27, 2026: member

    in the pull description, i think it is fine and sufficient to just link to https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#using-iwyu instead of all prior PRs

    Thanks! Amended.

  9. sedited approved
  10. sedited commented at 2:15 pm on January 28, 2026: contributor
    ACK fdc9fe2da6a8640b11a2871f8b653764652f8c1f
  11. sedited merged this on Jan 28, 2026
  12. sedited closed this on Jan 28, 2026

  13. hebasto deleted the branch on Jan 28, 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-02-11 21:13 UTC

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