Skip to content

[RFC] build: build with -Wmissing-declarations/prototypes - #36743

Draft
fanquake wants to merge 21 commits into
bitcoin:masterfrom
fanquake:missing_prototypes
Draft

fanquake wants to merge 21 commits into
bitcoin:masterfrom
fanquake:missing_prototypes

Conversation

@fanquake

@fanquake fanquake commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Draft for now, as it requires upstream changes, and some codebase/style decisions.
Some of the fixes will be split off in advance.

Based on:

@DrahtBot

DrahtBot commented Nov 3, 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:

  • #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)
  • #36876 (GUARDED_BY annotations for nTx, m_chain_tx_count by Crypt-iQ)
  • #36858 (refactor: break the blockstorage/validation circular dependency by pzafonte)
  • #36856 (kernel: add manual pruning by pzafonte)
  • #36855 (rpc: Deprecate watchonly wallet no-op named options by maflcko)
  • #36854 (kernel: let callers create the block manager by pzafonte)
  • #36826 (rpc: Return the right RPCErrorCode more consistently by maflcko)
  • #36823 (wallet, migration: Skip legacy wallet records rather than erasing them, and drop unused record erase functions by achow101)
  • #36822 (fuzz: torcontrol: drive the control connection over a mocked socket by erickcestari)
  • #36820 (refactor: remove more dead code by fanquake)
  • #36813 (refactor: more prereqs for [RFC] build: build with -Wmissing-declarations/prototypes #36743 by fanquake)
  • #36808 (iwyu: Fix warnings in src/test/fuzz and treat them as errors by hebasto)
  • #36753 (rpc: Report -rpcwhitelist denials as JSON-RPC errors by ryanofsky)
  • #36721 (script: store interpreter stack elements as reference-counted objects by conduition)
  • #36689 (cli: Parse -signetchallenge like bitcoind by ekzyis)
  • #36631 (fuzz: add a custom mutator for PSBT by brunoerg)
  • #36598 ([Demo] validation: remove AssumeUTXO by l0rinc)
  • #36481 (wallet, rpc, gui: Allow users to manually rebroadcast a wallet transaction by achow101)
  • #36266 (rpc: Let dumptxoutset fail early on stale targets and concurrent runs by fjahr)
  • #36188 (crypto: plug hardware optimized SHA256 into libsecp256k1's context by furszy)
  • #36167 (build: Enable -Wunused by fanquake)
  • #36122 (BIP460: CISA for Taproot key path spends by fjahr)
  • #36005 (rpc, descriptor: warn when multipath expansion clones single-path key expressions by pythcoiner)
  • #35911 (Warn on and add missing [[noreturn]] by fanquake)
  • #35713 (Remove boost as a unit test runner by rustaceanrob)
  • #35474 (node: move index ownership to NodeContext by w0xlt)
  • #35322 (logging: streamline Logger state and drop redundant methods by ryanofsky)
  • #35302 (Silent Payments: Sending (take 2) by Eunovo)
  • #35281 (univalue: respect token end pointer by ferminquant)
  • #34909 (wallet, refactor: modularise wallet by extracting out legacy wallet migration by rkrux)
  • #34872 (wallet: fix mixed-input transaction accounting in history RPCs by w0xlt)
  • #34360 (bench: add WalletBalanceManySpent for high-history wallet scenario by w0xlt)
  • #34193 (wallet: make migration more robust against failures by furszy)
  • #34132 (coins,dbwrapper: make point-read and txindex lookup failures fatal by l0rinc)
  • #33637 (validation: reduce block index comparison overhead by l0rinc)
  • #33324 (blocks: add resumable reobfuscation for existing block files by l0rinc)
  • #32857 (wallet: allow skipping script paths by Sjors)
  • #31260 (scripted-diff: Type-safe settings retrieval by ryanofsky)
  • #26022 (Add util::ResultPtr class by ryanofsky)
  • #25665 (refactor: Add util::Result failure types and ability to merge result values 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.

ryanofsky added a commit to bitcoin-core/libmultiprocess that referenced this pull request Nov 3, 2026
c8ca0c0 ci: add -Wmissing-declarations to default.bash (fanquake)
641c78e ci: add -Wmissing-prototypes to LLVM config (fanquake)
52a028c gen: make AccessorType static (fanquake)

Pull request description:

  ```bash
  [4/62] Building CXX object CMakeFiles/mpgen.dir/src/mp/gen.cpp.o
  libmultiprocess/src/mp/gen.cpp:208:13: warning: no previous prototype for function 'AccessorType' [-Wmissing-prototypes]
    208 | std::string AccessorType(kj::StringPtr base_name, const Field& field)
        |             ^
  libmultiprocess/src/mp/gen.cpp:208:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
    208 | std::string AccessorType(kj::StringPtr base_name, const Field& field)
        | ^
        | static
  1 warning generated.
  ```

  Used downstream in bitcoin/bitcoin#36743.

ACKs for top commit:
  ryanofsky:
    Code review ACK c8ca0c0. Since last review, just added `-Wmissing-declarations` to the GCC CI config. Thanks!

Tree-SHA512: 249f93a37469b757d712467b5070fb1b2ccd09e43a799eb6bd6c8330cf7a785dfa4f34439f78d3ce426061cb522f6b366a7e33e4fda46f4398dcbe95b1ca90be
fanquake added a commit to bitcoin-core/gui that referenced this pull request Nov 5, 2026
…nunix platform support and fix race conditions

d5f7524 doc: Bump minimum required Cap'n Proto version to 0.9.2 (Ryan Ofsky)
4898199 build: suppress -Wc++23-lambda-attributes in warn_interface (Ryan Ofsky)
270f5db Squashed 'src/ipc/libmultiprocess/' changes from e8de5c7b68e..acded1aafae (Ryan Ofsky)

Pull request description:

  The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh).

  Changes since last subtree update (#35720):

  - Adds support for nonunix platforms, making API changes that are not backwards compatible ([#274](bitcoin-core/libmultiprocess#274)). Follow-ups add a `CurrentThread()` accessor matching compatibility code in [bitcoin/bitcoin#35084](bitcoin/bitcoin#35084) ([#323](bitcoin-core/libmultiprocess#323)) and remove code for Cap'n Proto versions before 0.9 ([#331](bitcoin-core/libmultiprocess#331)).
  - Fixes a data race between IPC calls running on worker threads and disconnects, found by Antithesis ([#349](bitcoin-core/libmultiprocess#349)).
  - Fixes a use-after-free when a socket disconnects before `ConnectStream` connects, and leaks and hangs when a client `construct()` call throws ([#298](bitcoin-core/libmultiprocess#298)).
  - Fixes a race where file descriptors from `SpawnProcess` could leak into processes forked at the same time by other threads, by clearing `FD_CLOEXEC` in the child after forking ([#311](bitcoin-core/libmultiprocess#311)).
  - Makes `SpawnProcess` report `exec` failures back to the parent and throw, reaping the child ([#312](bitcoin-core/libmultiprocess#312)).
  - Adds support for `std::chrono::time_point` fields ([#303](bitcoin-core/libmultiprocess#303)) and for serializing lists of interface objects that need to be moved from ([#304](bitcoin-core/libmultiprocess#304)), both needed by [bitcoin/bitcoin#10102](bitcoin/bitcoin#10102).
  - Accepts container fields and parameters with any comparator, hash, and allocator types, like Bitcoin Core's `GCSFilter::ElementSet`, needed by [bitcoin/bitcoin#29409](bitcoin/bitcoin#29409) ([#379](bitcoin-core/libmultiprocess#379)).
  - Finds the `capnp` tool in vcpkg and Windows builds, needed by [bitcoin/bitcoin#32387](bitcoin/bitcoin#32387) ([#317](bitcoin-core/libmultiprocess#317)).
  - Adds a `destroy_connection` option to `ServeStream` and `ConnectStream`, lets `ServeStream` take ownership of the init object and return the new server and its connection, and adds an `EventLoop::incomingConnections()` accessor, simplifying test setup in both repositories and needed by [bitcoin/bitcoin#35932](bitcoin/bitcoin#35932) ([#365](bitcoin-core/libmultiprocess#365)).
  - Replaces `EventLoop::post()` with `sync()` taking a `kj::FunctionParam`, avoiding a heap allocation per call ([#347](bitcoin-core/libmultiprocess#347)).
  - Names threads spawned by the event loop so they can be told apart in tools and logs ([#324](bitcoin-core/libmultiprocess#324)).
  - Fixes warnings that Bitcoin Core enables or plans to enable: adds `[[noreturn]]` attributes for `-Wmissing-noreturn` ([#339](bitcoin-core/libmultiprocess#339), for [bitcoin/bitcoin#35911](bitcoin/bitcoin#35911)), and fixes `-Wunused` ([#362](bitcoin-core/libmultiprocess#362), for [bitcoin/bitcoin#36167](bitcoin/bitcoin#36167)), `-Wunused-const-variable` and `-Wundef` ([#370](bitcoin-core/libmultiprocess#370)), and `-Wmissing-prototypes` ([#386](bitcoin-core/libmultiprocess#386), for [bitcoin/bitcoin#36743](bitcoin/bitcoin#36743)) warnings.
  - Fails at compile time with a suggested workaround when Cap'n Proto misdetects exception support (`KJ_NO_EXCEPTIONS`), as happens on NetBSD ([#364](bitcoin-core/libmultiprocess#364)).
  - Build improvements: fixes stale generated code when the `mpgen` binary changes ([#316](bitcoin-core/libmultiprocess#316)), fixes `mpgen` link order for static Cap'n Proto builds ([#367](bitcoin-core/libmultiprocess#367)), links `mpgen` against `kj-async` instead of `capnp-rpc` ([#327](bitcoin-core/libmultiprocess#327)), shows Cap'n Proto `find_package` diagnostics ([#325](bitcoin-core/libmultiprocess#325)), installs `type-unordered-set.h` and `version.h` ([#350](bitcoin-core/libmultiprocess#350)), and shows include-what-you-use errors instead of failing silently ([#371](bitcoin-core/libmultiprocess#371)).
  - Test, CI, documentation, and minor code improvements: fix for a startup race in the example program ([#315](bitcoin-core/libmultiprocess#315)), new test for immediate client disconnects in `ListenConnections` ([#310](bitcoin-core/libmultiprocess#310)), `ReadList` return value check ([#338](bitcoin-core/libmultiprocess#338)), connect test race fix ([#343](bitcoin-core/libmultiprocess#343)) and cleanups ([#344](bitcoin-core/libmultiprocess#344)), `std::ranges::copy` follow-ups ([#307](bitcoin-core/libmultiprocess#307)), trailing whitespace removal ([#345](bitcoin-core/libmultiprocess#345)), Cap'n Proto version documentation fix ([#357](bitcoin-core/libmultiprocess#357)), clang-tidy updates ([#358](bitcoin-core/libmultiprocess#358), [#360](bitcoin-core/libmultiprocess#360), [#380](bitcoin-core/libmultiprocess#380), [#389](bitcoin-core/libmultiprocess#389)), new CI job testing newer cmake and Cap'n Proto versions ([#212](bitcoin-core/libmultiprocess#212), [#359](bitcoin-core/libmultiprocess#359)), CI coverage for the minimum supported g++ ([#330](bitcoin-core/libmultiprocess#330), [#366](bitcoin-core/libmultiprocess#366)), new CI warnings ([#332](bitcoin-core/libmultiprocess#332), [#341](bitcoin-core/libmultiprocess#341)), CI parallelism ([#334](bitcoin-core/libmultiprocess#334), [#356](bitcoin-core/libmultiprocess#356)), CI diagnostics ([#351](bitcoin-core/libmultiprocess#351), [#352](bitcoin-core/libmultiprocess#352)), Nix and LLVM updates ([#296](bitcoin-core/libmultiprocess#296), [#363](bitcoin-core/libmultiprocess#363)), NetBSD and OpenBSD CI fixes ([#321](bitcoin-core/libmultiprocess#321), [#340](bitcoin-core/libmultiprocess#340), [#381](bitcoin-core/libmultiprocess#381)), building Cap'n Proto with GCC in the 32-bit CI job to avoid an ABI mismatch ([#383](bitcoin-core/libmultiprocess#383)), and GitHub Actions updates ([#387](bitcoin-core/libmultiprocess#387)).

  The second commit suppresses the clang `-Wc++23-lambda-attributes` warning, which the new `[[noreturn]]` lambda attribute in `mp/proxy-types.h` triggers in C++20 builds. Since #31507 the Windows build uses clang-cl, so the same flag covers it.

  The third commit updates the minimum Cap'n Proto version in `doc/dependencies.md` to 0.9.2 (1.0 with Clang). This update raises libmultiprocess's own minimum from 0.7 to 0.9 (bitcoin-core/libmultiprocess#331), and libmultiprocess rejects 0.9.0 and 0.9.1 for CVE-2022-46149 and, with Clang 16 or newer, every version before 1.0.

ACKs for top commit:
  fanquake:
    ACK d5f7524
  willcl-ark:
    ACK d5f7524

Tree-SHA512: 4064944f4d8bb6c1665ddc7d5fae838492235d7dfdafab88b19b687ff6892460a3f450b90a145b287866330c569b862d748c941a70c65abc7f273ef13e490fd7
@DrahtBot

Copy link
Copy Markdown
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

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.

2 participants