ci, iwyu: Treat warnings as errors for specific targets #31308

pull hebasto wants to merge 6 commits into bitcoin:master from hebasto:241117-force-iwyu changing 27 files +63 −37
  1. hebasto commented at 9:00 pm on November 17, 2024: member

    This PR is the first step towards treating IWYU warnings as errors. It utilises CMake’s native support via the CMAKE_CXX_INCLUDE_WHAT_YOU_USE) variable. While this approach introduces some duplication at present, it will ultimately enable us to consolidate how the IWYU tool is executed, allowing for a choice between using the iwyu_tool.py script or CMake’s built-in functionality.

    At this stage, only the headers for the bitcoin_crypto target have been updated, and the CI will now treat any future IWYU warnings as errors:

     0...
     1Warning: include-what-you-use reported diagnostics:
     2
     3(/ci_container_base/src/crypto/chacha20.h has correct #includes/fwd-decls)
     4
     5/ci_container_base/src/crypto/chacha20.cpp should add these lines:
     6#include <assert.h>           // for assert
     7
     8/ci_container_base/src/crypto/chacha20.cpp should remove these lines:
     9- #include <string.h>  // lines 15-15
    10
    11The full include-list for /ci_container_base/src/crypto/chacha20.cpp:
    12#include <crypto/chacha20.h>
    13#include <assert.h>           // for assert
    14#include <crypto/common.h>    // for WriteLE32, ReadLE32
    15#include <span.h>             // for Span, UCharCast
    16#include <support/cleanse.h>  // for memory_cleanse
    17#include <algorithm>          // for copy, min
    18#include <bit>                // for rotl
    19---
    20
    21gmake[3]: *** [src/crypto/CMakeFiles/bitcoin_crypto.dir/build.make:90: src/crypto/CMakeFiles/bitcoin_crypto.dir/chacha20.cpp.o] Error 1
    22gmake[3]: *** Waiting for unfinished jobs....
    23gmake[2]: *** [CMakeFiles/Makefile2:1097: src/crypto/CMakeFiles/bitcoin_crypto.dir/all] Error 2
    24gmake[1]: *** [CMakeFiles/Makefile2:1104: src/crypto/CMakeFiles/bitcoin_crypto.dir/rule] Error 2
    25gmake: *** [Makefile:452: bitcoin_crypto] Error 2
    

    Based on #31306.

  2. ci: Update Clang in "tidy" job
    This change switches to the latest IWYU 0.23, which is compatible with
    Clang 19.
    ec5bea9cd5
  3. test, refactor: Fix "bugprone-use-after-move" clang-tidy warnings 4532e1d509
  4. refactor: Fix "modernize-use-starts-ends-with" clang-tidy warnings 3035a82f13
  5. iwyu: Drop backported mapping
    See: https://github.com/include-what-you-use/include-what-you-use/pull/1560
    4b833038de
  6. hebasto added the label Refactoring on Nov 17, 2024
  7. hebasto added the label Tests on Nov 17, 2024
  8. DrahtBot commented at 9:00 pm on November 17, 2024: 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/31308.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #31061 (refactor: Check translatable format strings at compile-time by maflcko)
    • #30975 (Add multiprocess binaries to release build by Sjors)
    • #30906 (refactor: prohibit direct flags access in CCoinsCacheEntry and remove invalid tests by l0rinc)
    • #26022 (Add util::ResultPtr class by ryanofsky)
    • #25722 (refactor: Use util::Result class for wallet loading by ryanofsky)
    • #25665 (refactor: Add util::Result failure values, multiple error and warning messages by ryanofsky)

    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.

  9. refactor: Fix includes for `libbitcoin_crypto` 4ed97f4a84
  10. ci, iwyu: Treat warnings as errors for specific targets
    Currently, this applies only to the `bitcoin_crypto` target.
    2df21bd515
  11. hebasto force-pushed on Nov 18, 2024
  12. DrahtBot added the label CI failed on Nov 18, 2024

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: 2024-11-21 06:12 UTC

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