[RFC] Enable `-Wunused` #36167

pull fanquake wants to merge 7 commits into bitcoin:master from fanquake:enable_wunused changing 168 files +595 −578
  1. fanquake commented at 2:32 PM on September 4, 2026: member

    We've had a handful of dead code removal PRs over the last month or two:

    Also well as an instance of what was thought to be dead code, but it'd actually just been forgotten to be used: #36137.

    It could be beneficial to get -Wunused & related flags enabled, to catch dead/unused code in CI. A number of changes here need to go to subtrees.

    Enabling some of these flags may also help enforce other stuff, like inline constexpr usage (#35852). i.e:

      /home/runner/work/_temp/src/leveldb/db/dbformat.h:67:29: error: 'leveldb::kMaxSequenceNumber' defined but not used [-Werror=unused-const-variable=]
         67 | static const SequenceNumber kMaxSequenceNumber = ((0x1ull << 56) - 1);
            |                             ^~~~~~~~~~~~~~~~~~
    

    and there are some related changes here.

  2. DrahtBot commented at 2:32 PM on September 4, 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/36167.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36182 (fees: return block_policy fee rate estimate when mempool_policy is not ready by ismaelsadeeq)
    • #36154 (wallet: fill PSBT_GLOBAL_XPUB for descriptors with more than one key by jeanpablojp)
    • #36122 (BIP460: CISA for Taproot key path spends by fjahr)
    • #36097 (mining: replace interrupt methods with cancellation arguments by xyzconstant)
    • #35998 (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)
    • #35911 (Warn on and add missing [[noreturn]] by fanquake)
    • #35906 (First steps towards a stateless, side-effect free validation library by purpleKarrot)
    • #35760 (wallet: make corrupted transaction records fail wallet loading instead of forcing a rescan by achow101)
    • #35752 (wallet: make encryption state updates atomic by l0rinc)
    • #35744 (coins: prevent DB resize from invalidating cursors by l0rinc)
    • #35716 (wallet: Replace mapWallet and wtxOrdered with a boost::multi_index by achow101)
    • #35591 ([DO NOT MERGE] Erlay: bandwidth-efficient transaction relay protocol (Full implementation) by sr-gi)
    • #35445 (wallet, descriptor: Revert StringType::COMPAT for Miniscript expressions and drop the concept of a Descriptor ID that can be validated by achow101)
    • #35322 (logging: streamline Logger state and drop redundant methods by ryanofsky)
    • #35301 (Silent Payments: Implement bip352 (take 2) by Eunovo)
    • #34520 (refactor: Add [[nodiscard]] to functions returning bool+mutable ref by maflcko)
    • #34038 (logging: replace -loglevel with -trace, expose trace logging via RPC by ajtowns)
    • #33324 (blocks: add resumable reobfuscation for existing block files by l0rinc)
    • #33117 (Interfaces: Expose UTXO Snapshot Loading and Add Progress Notifications by D33r-Gee)
    • #32387 (ipc: add windows support by ryanofsky)
    • #31507 (build: Use clang-cl to build on Windows natively by hebasto)
    • #30342 (kernel, logging: Pass Logger instances to kernel objects by ryanofsky)
    • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. DrahtBot added the label CI failed on Sep 4, 2026
  4. DrahtBot commented at 3:54 PM on September 4, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task lint: https://github.com/bitcoin/bitcoin/actions/runs/33884346846/job/101060370925</sub> <sub>LLM reason (✨ experimental): CI failed the subtree lint check because a subtree directory was modified without the required subtree merge (FAIL: subtree directory was touched without subtree merge).</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>

  5. fanquake force-pushed on Sep 4, 2026
  6. [[nomerge]] leveldb: unused changes eb582a8cd7
  7. [[nomerge]] minisketch: unused changes fe17db324c
  8. [[nomerge]] libmultiprocess changes 1fcc64259f
  9. [[nomerge]] crc32c changes 35cfd73309
  10. refactor: fix -Wunused issues 149c58c958
  11. build: add -Wunused and friends 15b75cfa9b
  12. refactor: inline constexpr
    In file included from /home/runner/work/_temp/src/init/common.cpp:11:
    /home/runner/work/_temp/src/logging.h:66:24: error: ‘BCLog::RATELIMIT_MAX_BYTES’ defined but not used [-Werror=unused-const-variable=]
       66 |     constexpr uint64_t RATELIMIT_MAX_BYTES{1_MiB}; // maximum number of bytes per source location that can be logged within the RATELIMIT_WINDOW
          |                        ^~~~~~~~~~~~~~~~~~~
    cc1plus: all warnings being treated as errors
    a04be30d05
  13. fanquake force-pushed on Sep 7, 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-09 07:56 UTC