ci, iwyu: generate embedded ASMap header explicitly #36228

pull kriss39 wants to merge 2 commits into bitcoin:master from kriss39:ci/iwyu-generate-asmap-header changing 5 files +17 −6
  1. kriss39 commented at 3:13 PM on September 11, 2026: contributor

    Fixes the remaining ip_asn.dat.h errors reported in #35361.

    The IWYU job currently reads compile commands for files such as src/init.cpp before the embedded ASMap header has been generated, which results in fatal error: 'node/data/ip_asn.dat.h' file not found messages in the CI logs.

    This adds a dedicated raw-data header generation target and makes the IWYU job build bitcoin_node_raw_data_headers before running the checks. This keeps the change limited to build/CI behavior and avoids building the full bitcoin_node target just to generate the header.

  2. DrahtBot commented at 3:13 PM on September 11, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK hebasto

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. fanquake requested review from hebasto on Sep 11, 2026
  4. DrahtBot added the label CI failed on Sep 11, 2026
  5. DrahtBot commented at 5:10 PM on September 11, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/34614871422/job/103331903901</sub> <sub>LLM reason (✨ experimental): CI failed because the IWYU (include-what-you-use) check triggered an “Failure generated from IWYU” error (exit status 1).</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>

  6. in cmake/module/TargetDataSources.cmake:57 in cc464492a1
      50 | @@ -50,6 +51,8 @@ function(target_raw_data_sources target)
      51 |        ${CODEGEN_OPT}
      52 |        ${DEPENDS_EXPLICIT_OPT}
      53 |      )
      54 | +    list(APPEND headers ${header})
      55 |      target_sources(${target} PRIVATE ${header})
      56 |    endforeach()
      57 | +  add_custom_target(${target}_raw_data_headers DEPENDS ${headers})
    


    hebasto commented at 1:12 PM on September 12, 2026:

    The following code allows calling target_raw_data_sources() multiple times for the same target:

      if(TARGET ${target}_raw_data_headers)
        target_sources(${target}_raw_data_headers PRIVATE ${headers})
      else()
        add_custom_target(${target}_raw_data_headers DEPENDS ${headers})
      endif()
    

    kriss39 commented at 1:25 PM on September 12, 2026:

    Thanks for the review and the suggestion.

    I updated the branch by folding in the raw-data header target handling you suggested, so repeated target_raw_data_sources() calls for the same target should now be handled correctly. I also included the IWYU-generated include fixes in the same commit, so the PR should now match what the IWYU job expects.

    Appreciate the guidance.

  7. hebasto commented at 1:14 PM on September 12, 2026: member

    Concept and approach ACK cc464492a14f17f9b758536a8a1b354909702d76.

    Please amend the last commit with the include fixes, so that the IWYU CI job passes.

  8. kriss39 force-pushed on Sep 12, 2026
  9. in src/rpc/net.cpp:5 in 6815a303e3
       1 | @@ -2,16 +2,15 @@
       2 |  // Distributed under the MIT software license, see the accompanying
       3 |  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4 |  
       5 | -#include <rpc/register.h> // IWYU pragma: associated
       6 | -#include <rpc/server.h>
       7 | +#include <net.h>
    


    hebasto commented at 1:54 PM on September 12, 2026:

    clang-format-diff.py gets confused about the actual associated headers here. That's why we use IWYU pragma: associated. Please keep only that file at the top:

    --- a/src/rpc/net.cpp
    +++ b/src/rpc/net.cpp
    @@ -2,7 +2,7 @@
     // Distributed under the MIT software license, see the accompanying
     // file COPYING or http://www.opensource.org/licenses/mit-license.php.
     
    -#include <net.h>
    +#include <rpc/register.h> // IWYU pragma: associated
     
     #include <addrman.h>
     #include <addrman_impl.h>
    @@ -11,6 +11,7 @@
     #include <clientversion.h>
     #include <core_io.h>
     #include <crypto/hex_base.h>
    +#include <net.h>
     #include <net_permissions.h>
     #include <net_processing.h>
     #include <net_types.h>
    @@ -23,7 +24,6 @@
     #include <policy/feerate.h>
     #include <protocol.h>
     #include <rpc/protocol.h>
    -#include <rpc/register.h> // IWYU pragma: associated
     #include <rpc/request.h>
     #include <rpc/server.h>
     #include <rpc/server_util.h>
    
  10. kriss39 force-pushed on Sep 12, 2026
  11. cmake: add raw data header generation target 1afa0cd70a
  12. ci, iwyu: generate embedded ASMap header explicitly 1cbbf64ea8
  13. kriss39 force-pushed on Sep 12, 2026
  14. kriss39 commented at 2:08 PM on September 12, 2026: contributor

    Thanks — done, and rebased on master, which changed the shape of this a bit.

    src/rpc/net.cpp had moved under me: #36116 landed the src/rpc IWYU pass and already put rpc/register.h with the pragma at the top, with net.h down in the sorted block. So the reordering you asked for is in master now, and my branch was 7 commits behind with the old layout — before rebasing, the diff would have removed #include <rpc/server.h> from the top, which was a stale-base artifact rather than anything I meant to change. I kept your arrangement as-is.

    What is left in that file after the rebase is only what IWYU wants once it can finally parse the ASMap header: +crypto/hex_base.h, +<span>, -<functional>.

    The target_raw_data_sources() suggestion is applied verbatim, so repeated calls for the same target now append to the existing header target.

    One thing I could not check locally: I have no cmake on this machine, so the CMake change is unverified outside CI — the if(TARGET ...) block is your code, and the rest is the set(headers) / list(APPEND ...) plumbing around it. test/lint/lint-includes.py, lint-include-guards.py, lint-files.py and lint-circular-dependencies.py all pass.

  15. DrahtBot removed the label CI failed on Sep 12, 2026
  16. hebasto approved
  17. hebasto commented at 3:38 PM on September 12, 2026: member

    ACK 1cbbf64ea81085109bd9cc594a0e1cf1cf943596.

  18. hebasto merged this on Sep 12, 2026
  19. hebasto closed this on Sep 12, 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-09-15 18:51 UTC

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