test: Move cluster_linearize.h contents into cluster_linearize namespace #35737

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:260716-cluster-unused changing 1 files +4 −6
  1. hebasto commented at 6:21 PM on July 16, 2026: member

    Clang recently enabled -Wunused-template under -Wall (see https://github.com/llvm/llvm-project/pull/206123, https://github.com/llvm/llvm-project/pull/207848, https://github.com/llvm/llvm-project/pull/208001). Our codebase triggers some of these warnings.

    This PR:

    1. Avoids Clang's -Wunused-template warnings in src/test/util/cluster_linearize.h when building the bench_bitcoin and fuzz targets.

    2. Follows the C++ Core Guidelines: "SF.21: Don't use an unnamed (anonymous) namespace in a header".

    3. Drops [[maybe_unused]] annotations, which are no longer needed after changing the linkage from internal to external.

    Along with #35679, this resolves all instances of this warning in the test/bench/fuzz code.

    Another related change: https://github.com/bitcoin-core/minisketch/pull/102.


    Steps to reproduce on the master branch @ 70d9ec7f3d452789d04dce81dc02db0b3b778bb5:

    $ CXXFLAGS="-Wunused-template" cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_BENCH=ON
    $ cmake --build build -t test_bitcoin
    $ cmake --build build -t bench_bitcoin
    [19/62] Building CXX object src/bench/CMakeFiles/bench_bitcoin.dir/cluster_linearize.cpp.o
    In file included from /home/hebasto/dev/bitcoin/src/bench/cluster_linearize.cpp:9:
    /home/hebasto/dev/bitcoin/src/test/util/cluster_linearize.h:122:17: warning: unused function template 'Ser' [-Wunused-template]
      122 |     static void Ser(Stream& s, const DepGraph<SetType>& depgraph)
          |                 ^~~
    /home/hebasto/dev/bitcoin/src/test/util/cluster_linearize.h:286:6: warning: unused function template 'SanityCheck' [-Wunused-template]
      286 | void SanityCheck(const DepGraph<SetType>& depgraph)
          |      ^~~~~~~~~~~
    /home/hebasto/dev/bitcoin/src/test/util/cluster_linearize.h:383:6: warning: unused function template 'SanityCheck' [-Wunused-template]
      383 | void SanityCheck(const DepGraph<SetType>& depgraph, std::span<const DepGraphIndex> linearization)
          |      ^~~~~~~~~~~
    3 warnings generated.
    [62/62] Linking CXX executable bin/bench_bitcoin
    
  2. DrahtBot added the label Tests on Jul 16, 2026
  3. DrahtBot commented at 6:21 PM on July 16, 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/35737.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    ACK sedited

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

  4. test: Move cluster_linearize.h contents into cluster_linearize namespace
    This change:
    1. Avoids Clang's `-Wunused-template` warnings when building the
       `bench_bitcoin` or `fuzz` targets.
    2. Follows C++ Core Guidelines: "SF.21: Don't use an unnamed (anonymous)
       namespace in a header".
    3. Drops `[[maybe_unused]]` annotations, which are no longer needed
       after changing the linkage from internal to external.
    21b4b790e4
  5. hebasto force-pushed on Jul 17, 2026
  6. sedited approved
  7. sedited commented at 12:18 PM on July 21, 2026: contributor

    ACK 21b4b790e4884e1edef6ea8da589e71f1ceacde8


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-07-22 05:50 UTC

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