ci: Update Clang in “tidy” job #31306

pull hebasto wants to merge 4 commits into bitcoin:master from hebasto:241117-tidy changing 8 files +15 −13
  1. hebasto commented at 4:25 pm on November 17, 2024: member

    This PR switches to the latest IWYU 0.23, which is compatible with Clang 19.

    The “bugprone-use-after-move” and “modernize-use-starts-ends-with” warnings that emerged have been resolved.

    Enabling the “performance-inefficient-vector-operation” and “performance-unnecessary-copy-initialization” checks is deferred to follow-up PRs (e.g., #31305).

  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. hebasto added the label Refactoring on Nov 17, 2024
  6. hebasto added the label Tests on Nov 17, 2024
  7. DrahtBot commented at 4:25 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/31306.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept NACK l0rinc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    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.

  8. iwyu: Drop backported mapping
    See: https://github.com/include-what-you-use/include-what-you-use/pull/1560
    4b833038de
  9. hebasto force-pushed on Nov 17, 2024
  10. in src/.clang-tidy:22 in 4b833038de
    18@@ -19,8 +19,10 @@ performance-*,
    19 -performance-avoid-endl,
    20 -performance-enum-size,
    21 -performance-inefficient-string-concatenation,
    22+-performance-inefficient-vector-operation,
    


    l0rinc commented at 9:04 pm on November 17, 2024:
    Given that #31305 fixes the issue, are we disabling it as a temporary measure?

    hebasto commented at 9:07 pm on November 17, 2024:

    Right.

    It depends on which PR is merged first :)

  11. in ci/test/00_setup_env_native_tidy.sh:9 in 4b833038de
     5@@ -6,9 +6,9 @@
     6 
     7 export LC_ALL=C.UTF-8
     8 
     9-export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
    10+export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.10"
    


    maflcko commented at 8:39 am on November 18, 2024:

    Not sure about using releases which are basically EOL in less than 6 months after the release branch is created. This requires touching the release branches to bump those along.

    My preference would be to use APT_LLVM_V

  12. in src/test/result_tests.cpp:66 in 4b833038de
    63+void ExpectSuccess(const util::Result<T>& result, const bilingual_str& str, const Args&... args)
    64 {
    65     ExpectResult(result, true, str);
    66     BOOST_CHECK_EQUAL(result.has_value(), true);
    67-    BOOST_CHECK_EQUAL(result.value(), T{std::forward<Args>(args)...});
    68+    BOOST_CHECK_EQUAL(result.value(), T{args...});
    


    maflcko commented at 8:44 am on November 18, 2024:
    are you sure this is correct? Not that it matters, but isn’t it theoretically pessimising in ExpectSuccess(StrFn(Untranslated("S"), true), {}, Untranslated("S"));?
  13. in src/test/coins_tests.cpp:774 in 4532e1d509 outdated
    770@@ -771,11 +771,10 @@ static void CheckAddCoinBase(CAmount base_value, CAmount cache_value, CAmount mo
    771 // while still verifying that the CoinsViewCache::AddCoin implementation
    772 // ignores base values.
    773 template <typename... Args>
    774-static void CheckAddCoin(Args&&... args)
    


    l0rinc commented at 10:27 am on November 18, 2024:
    This was already removed in the ACK-ed https://github.com/bitcoin/bitcoin/pull/30906/files#diff-3d0856e8b7f136c588b229e0cbd3b2e2c309cd097ade0879521daba4e1bb2a33L774-L777, could you please either revert this line or do it in a separate PR, since I think removing it completely is a better fix anyway.
  14. in src/test/result_tests.cpp:62 in 4532e1d509 outdated
    58@@ -59,12 +59,11 @@ void ExpectResult(const util::Result<T>& result, bool success, const bilingual_s
    59 }
    60 
    61 template <typename T, typename... Args>
    62-void ExpectSuccess(const util::Result<T>& result, const bilingual_str& str, Args&&... args)
    63+void ExpectSuccess(const util::Result<T>& result, const bilingual_str& str, const Args&... args)
    


    l0rinc commented at 10:35 am on November 18, 2024:

    Looking at the actual usage, ExpectSuccess doesn’t need to be a variadic template function:

    0ExpectSuccess(IntFn(5, true), {}, 5);
    1ExpectSuccess(NoCopyFn(5, true), {}, 5);
    2ExpectSuccess(StrFn(Untranslated("S"), true), {}, Untranslated("S"));
    

    , we might as well simplify to something like:

    0template <typename T, typename U>
    1void ExpectSuccess(const util::Result<T>& result, const bilingual_str& str, U&& expected)
    2{
    3    ExpectResult(result, true, str);
    4    BOOST_CHECK_EQUAL(result.has_value(), true);
    5    BOOST_CHECK_EQUAL(result.value(), expected);
    6    BOOST_CHECK_EQUAL(&result.value(), &*result);
    7}
    
  15. l0rinc changes_requested
  16. l0rinc commented at 10:37 am on November 18, 2024: contributor
    Concept ACK, but approach NACK, I think some of the examples can be fixed by removing the “feature” instead of just patching them.

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