doc: fix docs and enable -Wdocumentation-pedantic #36704

Manually merged
fanquake merged 5 commits from doc_param_direction_fixes into master 2026-11-21 13:13:13 +00:00 AGit
fanquake commented 2026-10-30 11:48:26 +00:00 (Migrated from github.com)
Prompted by https://github.com/bitcoin/bitcoin/pull/36594#discussion_r4415881033.
DrahtBot commented 2026-10-30 11:48:35 +00:00 (Migrated from github.com)

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.

Type Reviewers
ACK hebasto

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36704 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36704.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36704#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [hebasto](https://github.com/bitcoin/bitcoin/pull/36704#pullrequestreview-6005363982) | 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. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts No conflicts as of last run. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

🔵 Suggestion · New Doxygen blocks describe the wrong coin-selection return value

Converting these comments to Doxygen exposes the stale claim that SelectCoinsBnB and CoinGrinder return std::nullopt, although both return util::Result<SelectionResult>.

Location: src/wallet/coinselection.cpp:111 (head).

🔵 Suggestion · The read_all parameter documentation omits its nonempty-vector requirement

The rewritten read_all documentation retains a pre-existing wrong type and omits the nonzero size requirement; an empty vector loops indefinitely, though no current caller supplying one was found.

Location: src/util/subprocess.h:449 (head).

Review coverage was incomplete.


Reviewed: e8b442c76108 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:3705f06c6a27c475c77f2533c4d016ac03c829c839b7b538bba5e4768ccf54f1:1ed10c4979af6fc548d6b8d4534d505e02e84ac4b0aa4f8633555b2ba75119e8 --> <!-- ralph-base:f5a67cf4f3d03e7f5934832b7f066ae4aecf3417 --> <!-- ralph-head:e8b442c76108bbe5e4496275c06054a7f6be4808 --> <!-- ralph-case:88e6c2bbfad925d3309a5abd6fe283f15441457d8bbcb264e4c2aa7df09036cd --> **🔵 Suggestion · New Doxygen blocks describe the wrong coin-selection return value** Converting these comments to Doxygen exposes the stale claim that `SelectCoinsBnB` and `CoinGrinder` return `std::nullopt`, although both return `util::Result<SelectionResult>`. Location: [`src/wallet/coinselection.cpp:111`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/e8b442c76108bbe5e4496275c06054a7f6be4808/src/wallet/coinselection.cpp#L111>) (head). **🔵 Suggestion · The `read_all` parameter documentation omits its nonempty-vector requirement** The rewritten `read_all` documentation retains a pre-existing wrong type and omits the nonzero size requirement; an empty vector loops indefinitely, though no current caller supplying one was found. Location: [`src/util/subprocess.h:449`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/e8b442c76108bbe5e4496275c06054a7f6be4808/src/util/subprocess.h#L449>) (head). Review coverage was incomplete. <!-- Review tier: standard --> --- Reviewed: [`e8b442c76108`](<https://git.fish.foo/bitcoin/bitcoin/commit/e8b442c76108bbe5e4496275c06054a7f6be4808>) · [Review report](<https://review.fish.foo/report/36704-e8b442c76108bbe5e4496275c06054a7f6be4808-2915-9.html>) · [Previous reports](<https://review.fish.foo/traces/36704/>) [permalink](<https://review.fish.foo/report/36704-e8b442c76108bbe5e4496275c06054a7f6be4808-2915-9.html>)
hebasto (Migrated from github.com) reviewed 2026-11-11 13:58:47 +00:00
hebasto (Migrated from github.com) left a comment

Tested 3e3ed748bf on Fedora 45 using Clang 23.

Comments in src/util/subprocess.h are still missing @param commands.

My main concern about this PR is that it introduces escaping in Doxygen comments to please the compiler. There are two issues with that::

  1. -Wdocumentation-unknown-command does not trigger on \n. So a few cases remain in the code. And it is rendered simply as a line break, which is wrong: https://doxygen.bitcoincore.org/classutil_1_1_line_reader.html#a36462c325f3e18b1ceb453e6a7282bce.
  2. Escaping may confuse anyone who reads the comments in the code. We can replace all escape sequences in the Doxygen comments with their names: "tab", "newline" etc, where possible.

The changes to the parameter direction attributes are correct. However, they are neither necessary for enabling -Wdocumentation-unknown-command nor enforced by it, which means we can't be sure that they are complete. At least some more cases were noted by Ralph.

Tested 3e3ed748bf48b4643699c56e4aedaae6fa025c5c on Fedora 45 using Clang 23. Comments in `src/util/subprocess.h` are still missing `@param` commands. My main concern about this PR is that it introduces escaping in Doxygen comments to please the compiler. There are two issues with that:: 1. `-Wdocumentation-unknown-command` does not trigger on `\n`. So a few cases remain in the code. And it is rendered simply as a line break, which is wrong: https://doxygen.bitcoincore.org/classutil_1_1_line_reader.html#a36462c325f3e18b1ceb453e6a7282bce. 2. Escaping may confuse anyone who reads the comments in the code. We can replace all escape sequences in the Doxygen comments with their names: "tab", "newline" etc, where possible. The changes to the parameter direction attributes are correct. However, they are neither necessary for enabling `-Wdocumentation-unknown-command` nor enforced by it, which means we can't be sure that they are complete. At least some more cases were noted by Ralph.
hebasto (Migrated from github.com) commented 2026-11-11 12:56:35 +00:00

A broader warning group works as well:

try_append_cxx_flags("-Wdocumentation-pedantic" TARGET warn_interface SKIP_LINK)
A broader warning group works as well: ```suggestion try_append_cxx_flags("-Wdocumentation-pedantic" TARGET warn_interface SKIP_LINK) ```
hebasto (Migrated from github.com) commented 2026-11-11 13:05:19 +00:00

Wouldn't it be better to rename the parameter in the declaration to psbtx, matching the function definition, instead?

Wouldn't it be better to rename the parameter in the declaration to `psbtx`, matching the function definition, instead?
hebasto (Migrated from github.com) commented 2026-11-11 12:58:40 +00:00

The entire comment shouldn't be a Doxygen one in the first place.

The entire comment shouldn't be a Doxygen one in the first place.
hebasto (Migrated from github.com) approved these changes 2026-11-12 12:02:14 +00:00
hebasto (Migrated from github.com) left a comment

ACK 2c21beac90.

A Doxygen rendering nit:

--- a/src/util/subprocess.h
+++ b/src/util/subprocess.h
@@ -407,6 +407,7 @@ namespace util
    * @param[in]  read_upto Max number of bytes which must be read from `fd`.
    * @return Number of bytes written to `buf` or read from `fd`
    *         OR -1 in case of error.
+   *
    *  NOTE: In case of EINTR while reading from socket, this API
    *  will retry to read from `fd`, but only till the EINTR counter
    *  reaches 50 after which it will return with whatever data it read.
ACK 2c21beac909d45d7ef8491fca3291abfd063a8e1. A Doxygen rendering nit: ```diff --- a/src/util/subprocess.h +++ b/src/util/subprocess.h @@ -407,6 +407,7 @@ namespace util * @param[in] read_upto Max number of bytes which must be read from `fd`. * @return Number of bytes written to `buf` or read from `fd` * OR -1 in case of error. + * * NOTE: In case of EINTR while reading from socket, this API * will retry to read from `fd`, but only till the EINTR counter * reaches 50 after which it will return with whatever data it read. ```
hebasto (Migrated from github.com) approved these changes 2026-11-12 12:21:51 +00:00
hebasto (Migrated from github.com) left a comment

ACK 651d4b65cd.

ACK 651d4b65cdc53c8da5983ff442ff76b8a0dc4e78.
willcl-ark (Migrated from github.com) reviewed 2026-11-12 17:29:05 +00:00
willcl-ark (Migrated from github.com) commented 2026-11-12 17:29:05 +00:00

Might this be:

 * @param[in,out]  vchDataIn  Referenced byte vector to overwrite/append

and perhaps L38 too?

Might this be: ```suggestion * @param[in,out] vchDataIn Referenced byte vector to overwrite/append ``` and perhaps L38 too?
fanquake (Migrated from github.com) reviewed 2026-11-12 19:09:29 +00:00
fanquake (Migrated from github.com) commented 2026-11-12 19:09:29 +00:00

Pushed.

Pushed.
hebasto (Migrated from github.com) approved these changes 2026-11-21 13:10:48 +00:00
hebasto (Migrated from github.com) left a comment

ACK e8b442c761.

ACK e8b442c76108bbe5e4496275c06054a7f6be4808.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36704
No description provided.