cmake: Fix silent include-what-you-use failures #371

pull ryanofsky wants to merge 2 commits into bitcoin-core:master from ryanofsky:pr/iwyuerr changing 2 files +28 −1
  1. ryanofsky commented at 2:42 AM on October 2, 2026: collaborator

    Problem: The IWYU check in the default CI job can fail with a bare Error 1 and no diagnostics (example). IWYU's clang frontend receives the GCC job's warning flags, so with -Werror -Wpedantic every KJ_TEST reports '__COUNTER__' is a C2y extension and the GCC-only -Wtrailing-whitespace is an unknown option. A file with 19 or more KJ_TESTs reaches clang's error limit, clang gives up before IWYU checks anything, and CMake discards IWYU's output because it contains no include suggestions. test/mp/test/test.cpp has 16 tests now. #335 adds three more and its default job fails this way, and master will hit it too once a few more tests are added.

    Solution: Pass -w to IWYU so compiler warning flags no longer affect it, and run it through a small wrapper script that makes CMake print IWYU's output whenever it fails without suggesting includes. The wrapper works around a CMake bug (cmake#28020; an upstream fix in cmake!9210 was approved but never finished) and can be dropped once CMake fixes it.

  2. cmake: Pass -w to include-what-you-use
    Stop the compiler warning flags in CXXFLAGS from turning clang warnings
    into errors in the IWYU pass. IWYU's clang frontend receives the same
    flags as the real compiler, so in the GCC CI jobs (-Werror -Wpedantic)
    every KJ_TEST reports "'__COUNTER__' is a C2y extension" and the
    GCC-only -Wtrailing-whitespace is an unknown option. Once a file has
    enough tests to reach clang's 20-error limit (test/mp/test/test.cpp
    currently has 16), clang gives up, IWYU exits 1 without analyzing the
    file, and the build fails with no diagnostics. Real IWYU findings are
    still reported with -w.
    
    This change was written with Claude Opus 5.5 (1M context).
    92127a984a
  3. cmake: Show include-what-you-use diagnostics when it fails
    Run include-what-you-use through a wrapper script that makes CMake print
    its output when it fails without suggesting includes. CMake only relays
    IWYU output containing "should add these lines:" or "should remove
    these lines:", so a clang error in the IWYU pass (like the
    too-many-errors abort fixed in the previous commit) failed the build
    with a bare "Error 1" and nothing to debug.
    
    This change was written with Claude Opus 5.5 (1M context).
    f0a14754ef
  4. DrahtBot commented at 2:42 AM on October 2, 2026: none

    <!--e57a25ab6845829454e8d69fc972939a-->

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

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

  5. hebasto commented at 12:51 PM on October 2, 2026: member

    Concept ACK.

  6. hebasto approved
  7. hebasto commented at 6:20 PM on October 3, 2026: member

    ACK f0a14754ef4f922c8e391c201f3d4329cb69ee0e, I have reviewed the code and it looks OK.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-08 00:30 UTC

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