Skip to content

Commit 2b3e5bf

Browse files
committed
Merge #21613: build: enable -Wdocumentation
a4e970a build: enable -Wdocumentation if suppressing external warnings (fanquake) 3b0078f doc: fixup -Wdocumentation issues (fanquake) c6edcf1 build: suppress libevent warnings if supressing external warnings (fanquake) Pull request description: Enable `-Wdocumentation` by taking advantage of our `--enable-suppress-external-warnings` flag. Most of the CIs are using this flag now, so any regressions should be caught. This also required modifying libevents flags when suppressing warnings, as depending on the version being built against, that could generate a large number of warnings. i.e: ```bash In file included from httpserver.cpp:34: In file included from ./support/events.h:12: /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:464:11: warning: parameter 'req' not found in the function declaration [-Wdocumentation] @param req a request object ^~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:465:11: warning: parameter 'databuf' not found in the function declaration [-Wdocumentation] @param databuf the data chunk to send as part of the reply. ^~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:467:11: warning: parameter 'call' not found in the function declaration [-Wdocumentation] @param call back's argument. ^~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:939:4: warning: declaration is marked with '@deprecated' command but does not have a deprecation attribute [-Wdocumentation-deprecated-sync] @deprecated This function is deprecated; you probably want to use ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:946:1: note: add a deprecation attribute to the declaration to silence this warning char *evhttp_decode_uri(const char *uri); ^ __AVAILABILITY_INTERNAL_DEPRECATED /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:979:5: warning: declaration is marked with '@deprecated' command but does not have a deprecation attribute [-Wdocumentation-deprecated-sync] @deprecated This function is deprecated as of Libevent 2.0.9. Use ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:987:1: note: add a deprecation attribute to the declaration to silence this warning int evhttp_parse_query(const char *uri, struct evkeyvalq *headers); ^ __AVAILABILITY_INTERNAL_DEPRECATED /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:1002:11: warning: parameter 'query_parse' not found in the function declaration [-Wdocumentation] @param query_parse the query portion of the URI ^~~~~~~~~~~ /usr/local/Cellar/libevent/2.1.12/include/event2/http.h:1002:11: note: did you mean 'uri'? @param query_parse the query portion of the URI ^~~~~~~~~~~ uri 69 warnings generated. ``` Note that a lot of these have already been fixed upstream. ACKs for top commit: laanwj: Concept and code review ACK a4e970a practicalswift: cr ACK a4e970a: automatic compiler feedback comes sooner and is more reliable than manual reviewer feedback jonatack: Light ACK a4e970a skimmed the changes, clang 11 build is clean with the change, verified -Wdocumentation build warnings with this change when a doc fix was reverted Tree-SHA512: 57a1e30cffcc8bcceee72d85f58ebe29eae525861c70acb237541bd480c51ede89875c033042c0af376fdbb49fb7f588ef9282a47c6e78f9d4501c41f1b21eb6
2 parents 6154291 + a4e970a commit 2b3e5bf

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

configure.ac

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ if test "x$enable_werror" = "xyes"; then
439439
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
440440
AX_CHECK_COMPILE_FLAG([-Werror=unreachable-code-loop-increment],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=unreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
441441
AX_CHECK_COMPILE_FLAG([-Werror=mismatched-tags], [ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=mismatched-tags"], [], [$CXXFLAG_WERROR])
442+
443+
if test x$suppress_external_warnings != xno ; then
444+
AX_CHECK_COMPILE_FLAG([-Werror=documentation],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=documentation"],,[[$CXXFLAG_WERROR]])
445+
fi
442446
fi
443447

444448
if test "x$CXXFLAGS_overridden" = "xno"; then
@@ -466,6 +470,10 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
466470
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
467471
AX_CHECK_COMPILE_FLAG([-Wunreachable-code-loop-increment],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code-loop-increment"],,[[$CXXFLAG_WERROR]])
468472

473+
if test x$suppress_external_warnings != xno ; then
474+
AX_CHECK_COMPILE_FLAG([-Wdocumentation],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdocumentation"],,[[$CXXFLAG_WERROR]])
475+
fi
476+
469477
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
470478
dnl unknown options if any other warning is produced. Test the -Wfoo case, and
471479
dnl set the -Wno-foo case if it works.
@@ -1485,6 +1493,10 @@ if test x$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench
14851493
if test x$TARGET_OS != xwindows; then
14861494
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.0.21],, [AC_MSG_ERROR([libevent_pthreads version 2.0.21 or greater not found.])])
14871495
fi
1496+
1497+
if test x$suppress_external_warnings != xno; then
1498+
EVENT_CFLAGS=SUPPRESS_WARNINGS($EVENT_CFLAGS)
1499+
fi
14881500
fi
14891501

14901502
dnl QR Code encoding library check

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
20622062
/**
20632063
* Reconsider orphan transactions after a parent has been accepted to the mempool.
20642064
*
2065-
* @param[in/out] orphan_work_set The set of orphan transactions to reconsider. Generally only one
2065+
* @param[in,out] orphan_work_set The set of orphan transactions to reconsider. Generally only one
20662066
* orphan will be reconsidered on each call of this function. This set
20672067
* may be added to if accepting an orphan causes its children to be
20682068
* reconsidered.

src/netbase.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ CService LookupNumeric(const std::string& name, uint16_t portDefault = 0, DNSLoo
172172
* @param strSubnet A string representation of a subnet of the form `network
173173
* address [ "/", ( CIDR-style suffix | netmask ) ]`(e.g.
174174
* `2001:db8::/32`, `192.0.2.0/255.255.255.0`, or `8.8.8.8`).
175-
* @param ret The resulting internal representation of a subnet.
176175
*
177176
* @returns Whether the operation succeeded or not.
178177
*/
@@ -235,7 +234,7 @@ void InterruptSocks5(bool interrupt);
235234
* @param port The destination port.
236235
* @param auth The credentials with which to authenticate with the specified
237236
* SOCKS5 proxy.
238-
* @param sock The SOCKS5 proxy socket.
237+
* @param socket The SOCKS5 proxy socket.
239238
*
240239
* @returns Whether or not the operation succeeded.
241240
*

src/policy/feerate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class CFeeRate
4747
*
4848
* @param[in] nFeePaid CAmount fee rate to construct with
4949
* @param[in] nBytes size_t bytes (units) to construct with
50-
* @returns fee rate
5150
*/
5251
CFeeRate(const CAmount& nFeePaid, size_t nBytes);
5352
/**

src/util/sock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class Sock
161161

162162
/**
163163
* Check if still connected.
164-
* @param[out] err The error string, if the socket has been disconnected.
164+
* @param[out] errmsg The error string, if the socket has been disconnected.
165165
* @return true if connected
166166
*/
167167
virtual bool IsConnected(std::string& errmsg) const;

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ inline bool IsBlockPruned(const CBlockIndex* pblockindex)
10291029
/**
10301030
* Return the expected assumeutxo value for a given height, if one exists.
10311031
*
1032-
* @param height[in] Get the assumeutxo value for this height.
1032+
* @param[in] height Get the assumeutxo value for this height.
10331033
*
10341034
* @returns empty if no assumeutxo configuration exists for the given height.
10351035
*/

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
12811281
/**
12821282
* List transactions based on the given criteria.
12831283
*
1284-
* @param pwallet The wallet.
1284+
* @param wallet The wallet.
12851285
* @param wtx The wallet transaction.
12861286
* @param nMinDepth The minimum confirmation depth.
12871287
* @param fLong Whether to include the JSON version of the transaction.

src/wallet/scriptpubkeyman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool HaveKeys(const std::vector<valtype>& pubkeys, const LegacyScriptPubKeyMan&
8484
//! Recursively solve script and return spendable/watchonly/invalid status.
8585
//!
8686
//! @param keystore legacy key and script store
87-
//! @param script script to solve
87+
//! @param scriptPubKey script to solve
8888
//! @param sigversion script type (top-level / redeemscript / witnessscript)
8989
//! @param recurse_scripthash whether to recurse into nested p2sh and p2wsh
9090
//! scripts or simply treat any script that has been

0 commit comments

Comments
 (0)