build: enable `-Wunused-const-variable` #36275

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:unused_const_variable changing 3 files +10 −9
  1. fanquake commented at 3:14 PM on September 16, 2026: member

    Split out of #36167.

    Fixes:

    /root/bitcoin/src/leveldb/db/dbformat.h:42:18: warning: ‘leveldb::config::kMaxMemCompactLevel’ defined but not used [-Wunused-const-variable=]
       42 | static const int kMaxMemCompactLevel = 2;
          |                  ^~~~~~~~~~~~~~~~~~~
    /root/bitcoin/src/leveldb/db/dbformat.h:28:18: warning: ‘leveldb::config::kL0_CompactionTrigger’ defined but not used [-Wunused-const-variable=]
       28 | static const int kL0_CompactionTrigger = 4;
          |                  ^~~~~~~~~~~~~~~~~~~~~
    In file included from /root/bitcoin/src/leveldb/db/dbformat.h:13:
    /root/bitcoin/src/leveldb/include/leveldb/db.h:19:18: warning: ‘leveldb::kMinorVersion’ defined but not used [-Wunused-const-variable=]
       19 | static const int kMinorVersion = 22;
          |                  ^~~~~~~~~~~~~
    /root/bitcoin/src/leveldb/include/leveldb/db.h:18:18: warning: ‘leveldb::kMajorVersion’ defined but not used [-Wunused-const-variable=]
       18 | static const int kMajorVersion = 1;
          |                  ^~~~~~~~~~~~~
    
    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
    

    etc.

  2. DrahtBot added the label Build system on Sep 16, 2026
  3. DrahtBot commented at 3:14 PM on September 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/36275.

    <!--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)
    • #35322 (logging: streamline Logger state and drop redundant methods by ryanofsky)
    • #34038 (logging: replace -loglevel with -trace, expose trace logging via RPC by ajtowns)
    • #31507 (build: Use clang-cl to build on Windows natively by hebasto)

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

  4. fanquake force-pushed on Sep 16, 2026
  5. DrahtBot added the label CI failed on Sep 16, 2026
  6. DrahtBot commented at 3:45 PM on September 16, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task lint: https://github.com/bitcoin/bitcoin/actions/runs/35114035836/job/104854768994</sub> <sub>LLM reason (✨ experimental): CI failed because the lint “subtree” check detected that a subtree directory was touched without a corresponding 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>

  7. sedited referenced this in commit a604a76475 on Sep 17, 2026
  8. fanquake force-pushed on Sep 18, 2026
  9. fanquake referenced this in commit 5ca3773414 on Sep 21, 2026
  10. fanquake force-pushed on Sep 21, 2026
  11. hebasto referenced this in commit 4ecbc82d41 on Sep 21, 2026
  12. refactor: use 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
    b45a7084d8
  13. build: add -Wunused-const-variable cf57dc281e
  14. fanquake force-pushed on Sep 22, 2026
  15. fanquake marked this as ready for review on Sep 22, 2026
  16. DrahtBot removed the label CI failed on Sep 22, 2026
  17. maflcko commented at 9:06 AM on September 22, 2026: member

    Maybe leave in draft while this conflicts with a backport?


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-23 05:51 UTC

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