Skip to content

build: Enable -Wunused - #36167

Draft
fanquake wants to merge 3 commits into
bitcoin:masterfrom
fanquake:enable_wunused
Draft

fanquake wants to merge 3 commits into
bitcoin:masterfrom
fanquake:enable_wunused

Conversation

@fanquake

@fanquake fanquake commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

We've had a handful of dead code removal PRs recently:

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

It could be beneficial to get -Wunused enabled, to catch dead/unused code in CI.

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);
        |                             ^~~~~~~~~~~~~~~~~~

Based on:

@DrahtBot

DrahtBot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #37033 (rpc: remove duplicate avgfeerate key in getblockstats by fanquake)
  • #36946 (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)
  • #36897 (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
  • #36885 (wallet, rpc: Add analyzedescriptor for multisig setups by pablomartin4btc)
  • #36871 (wallet: Clear streams before advancing BDB cursor by jaromil)
  • #36856 (kernel: add manual pruning by pzafonte)
  • #36854 (kernel: let callers create the block manager by pzafonte)
  • #36823 (wallet, migration: Skip legacy wallet records rather than erasing them, and drop unused record erase functions by achow101)
  • #36820 (refactor: remove more dead code by fanquake)
  • #36603 (Improve loadtxoutset performance by ajtowns)
  • #36326 (kernel: Use typed errors for fatal and flush error notifications by arejula27)
  • #36154 (wallet: fill PSBT_GLOBAL_XPUB by jeanpablojp)
  • #36122 (BIP460: CISA for Taproot key path spends by fjahr)
  • #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)
  • #35591 ([DO NOT MERGE] Erlay: bandwidth-efficient transaction relay protocol (Full implementation) by sr-gi)
  • #35302 (Silent Payments: Sending (take 2) by Eunovo)
  • #34520 (refactor: Add [[nodiscard]] to functions returning bool+mutable ref by maflcko)
  • #34132 (coins,dbwrapper: make database point-read failures fatal by l0rinc)
  • #33324 (blocks: add resumable reobfuscation for existing block files by l0rinc)
  • #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.

@DrahtBot

DrahtBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/33884346846/job/101060370925
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).

Hints

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.

This was referenced Sep 5, 2026
@fanquake fanquake changed the title [RFC] Enable -Wunused build: Enable -Wunused Nov 5, 2026
hebasto added a commit that referenced this pull request Nov 6, 2026
9449723 Squashed 'src/leveldb/' changes from 24a446f834..e267773191 (fanquake)

Pull request description:

  Includes:
  * bitcoin-core/leveldb-subtree#67
  * bitcoin-core/leveldb-subtree#69

  67 could be used in #36167. There's a followup to 67 in bitcoin-core/leveldb-subtree#68, which could be used in #36743.

ACKs for top commit:
  sedited:
    ACK 7580a91
  hebasto:
    ACK 7580a91.

Tree-SHA512: 3d626180789566c7288c084c396dd4610d0cadd1b0a427a725d463e0792bb90ed80bde0f8796793e461003590190cc77933649fd9fd8ab1d17f7060c2c2ae9ca
@fanquake
fanquake force-pushed the enable_wunused branch 2 times, most recently from 71a4371 to 8074b36 Compare November 25, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants