Skip to content

iwyu: Fix warnings in src/common and treat them as errors#34995

Open
hebasto wants to merge 1 commit into
bitcoin:masterfrom
hebasto:260403-iwyu-common
Open

iwyu: Fix warnings in src/common and treat them as errors#34995
hebasto wants to merge 1 commit into
bitcoin:masterfrom
hebasto:260403-iwyu-common

Conversation

@hebasto

@hebasto hebasto commented Apr 3, 2026

Copy link
Copy Markdown
Member

This PR continues the ongoing effort to enforce IWYU warnings.

See Developer Notes.

@DrahtBot

DrahtBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34995.

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Approach ACK BrandonOdiwuor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #35704 (windows: replace deprecated codecvt with fs::u8path by kevkevinpal)
  • #35675 (mining: add block template manager by ismaelsadeeq)
  • #35205 (kernel,node: add dbcache setter and clarify defaults by l0rinc)
  • #31260 (scripted-diff: Type-safe settings retrieval 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.

@hebasto hebasto marked this pull request as draft April 3, 2026 12:21
@DrahtBot

DrahtBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task 32 bit ARM: https://github.com/bitcoin/bitcoin/actions/runs/23945242931/job/69839917221
LLM reason (✨ experimental): CI failed because compilation of bitcoin-wallet.cpp errored with fatal error: univalue.h: No such file or directory (missing univalue header/dependency).

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.

@fanquake

fanquake commented Apr 3, 2026

Copy link
Copy Markdown
Member

Seems like IWYU is passing but compilation is failing?

Comment thread src/common/config.cpp
Comment thread src/common/netif.cpp Outdated
Comment thread src/common/netif.cpp Outdated

@BrandonOdiwuor BrandonOdiwuor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK

I was able to incorporate most of the iwyu suggestions except the following changes which cause compilation errors on Ubuntu 24.04

  1. bloom.h
+ #include <span>         // for span
- #include <span.h>  // lines 10-10
  1. settings.h
+ #include <univalue.h>  // for UniValue
- class UniValue;  // lines 15-15
  1. args.h
- #include <compat/compat.h>  // lines 9-9

NB: removing #include <util/syserror.h> from `src/common/netif.cpp as suggested by IWYU causes the macOS based jobs to fail

/opt/homebrew/bin/ccache /usr/bin/c++ -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -I/Users/runner/work/bitcoin/bitcoin/repo_archive/ci/scratch/build-aarch64-apple-darwin24.6.0/src -I/Users/runner/work/bitcoin/bitcoin/repo_archive/src -I/Users/runner/work/bitcoin/bitcoin/repo_archive/src/univalue/include -I/Users/runner/work/bitcoin/bitcoin/repo_archive/src/secp256k1/include -isystem /opt/homebrew/Cellar/boost/1.90.0_1/include -O2 -g -std=c++20 -arch arm64 -fPIC -fvisibility=hidden -fmacro-prefix-map=/Users/runner/work/bitcoin/bitcoin/repo_archive/src=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -mbranch-protection=bti -Wall -Wextra -Wgnu -Wcovered-switch-default -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wloop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wdocumentation -Wself-assign -Wundef -Wno-unused-parameter -Werror -MD -MT src/CMakeFiles/bitcoin_common.dir/common/netif.cpp.o -MF src/CMakeFiles/bitcoin_common.dir/common/netif.cpp.o.d -o src/CMakeFiles/bitcoin_common.dir/common/netif.cpp.o -c /Users/runner/work/bitcoin/bitcoin/repo_archive/src/common/netif.cpp 
/Users/runner/work/bitcoin/bitcoin/repo_archive/src/common/netif.cpp:249:72: error: use of undeclared identifier 'SysErrorString'
  249 |         LogError("Could not get sysctl length of routing table: %s\n", SysErrorString(errno));
      |                                                                        ^
/Users/runner/work/bitcoin/bitcoin/repo_archive/src/common/netif.cpp:254:70: error: use of undeclared identifier 'SysErrorString'
  254 |         LogError("Could not get sysctl data of routing table: %s\n", SysErrorString(errno));
Running IWYU job with check ebaled on `src/common` + run_iwyu compile_commands_iwyu_errors.json + mv /home/runner/work/_temp/build/compile_commands_iwyu_errors.json /home/runner/work/_temp/build/compile_commands.json + python3 /include-what-you-use/iwyu_tool.py -p /home/runner/work/_temp/build -j4 -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=/home/runner/work/_temp/contrib/devtools/iwyu/bitcoin.core.imp -Xiwyu --max_line_length=160 -Xiwyu '--check_also=*/primitives/*.h' + tee /tmp/iwyu_ci.out (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.cpp has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/bloom.h should add these lines: #include <cstdint> // for uint64_t #include <span> // for span /home/runner/work/_temp/src/common/bloom.h should remove these lines: - #include <span.h> // lines 9-9 The full include-list for /home/runner/work/_temp/src/common/bloom.h: #include <serialize.h> // for READWRITE, SERIALIZE_METHODS #include <cstdint> // for uint64_t #include <span> // for span #include <vector> // for vector class COutPoint; // lines 13-13 class CTransaction; // lines 14-14 --- (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/bloom.cpp should add these lines: #include <compare> // for operator<, strong_ordering /home/runner/work/_temp/src/common/bloom.cpp should remove these lines: - #include <cstdlib> // lines 19-19 - #include <limits> // lines 20-20 The full include-list for /home/runner/work/_temp/src/common/bloom.cpp: #include <common/bloom.h> #include <hash.h> // for MurmurHash3 #include <primitives/transaction.h> // for COutPoint, CTxOut, CTransaction, CTxIn, Txid #include <random.h> // for FastRandomContext #include <script/script.h> // for CScript, opcodetype #include <script/solver.h> // for TxoutType, Solver #include <span.h> // for MakeUCharSpan #include <streams.h> // for DataStream #include <util/fastrange.h> // for FastRange32 #include <util/overflow.h> // for CeilDiv #include <algorithm> // for min, fill, max #include <cmath> // for log, ceil, exp, round #include <compare> // for operator<, strong_ordering #include <vector> // for vector --- (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.cpp has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/args.h should add these lines: /home/runner/work/_temp/src/common/args.h should remove these lines: - #include <compat/compat.h> // lines 9-9 The full include-list for /home/runner/work/_temp/src/common/args.h: #include <common/settings.h> // for SettingsValue, Settings #include <sync.h> // for EXCLUSIVE_LOCKS_REQUIRED, GUARDED_BY, LOCK, Mutex, UniqueLock #include <util/chaintype.h> // for ChainType #include <util/fs.h> // for path #include <concepts> // for integral #include <cstdint> // for int64_t, uint32_t #include <iosfwd> // for istream #include <list> // for list #include <map> // for map #include <optional> // for optional #include <set> // for set #include <string> // for string, basic_string #include <variant> // for variant #include <vector> // for vector class ArgsManager; // lines 25-25 --- /home/runner/work/_temp/src/common/args.cpp should add these lines: /home/runner/work/_temp/src/common/args.cpp should remove these lines: - #include <cassert> // lines 26-26 - #include <cstdint> // lines 27-27 The full include-list for /home/runner/work/_temp/src/common/args.cpp: #include <common/args.h> #include <chainparamsbase.h> // for BaseParams, CBaseChainParams #include <common/settings.h> // for SettingsValue, Settings, SettingsSpan, GetSetting, FindKey, GetSettingsList, OnlyHasDefaultSectionSetting, ReadSettings #include <logging.h> // for LogPrintFormatInternal, LogWarning, LogInfo #include <sync.h> // for LOCK, UniqueLock, AssertLockHeld, AssertLockHeldInternal #include <tinyformat.h> // for format, strprintf, formatValue, makeFormatList, formatTruncated #include <univalue.h> // for UniValue #include <util/chaintype.h> // for ChainType, ChainTypeToString, ChainTypeFromString #include <util/check.h> // for Assert, inline_assertion_check, assert #include <util/fs.h> // for path, PathToString, PathFromString, absolute, is_directory, AbsPathJoin, create_directories, operator+, operator/ #include <util/fs_helpers.h> // for GetDefaultDataDir, RenameOver #include <util/strencodings.h> // for LocaleIndependentAtoi, FormatParagraph #include <util/string.h> // for Join #include <algorithm> // for any_of #include <cstdlib> // for size_t, getenv #include <cstring> // for strlen #include <map> // for map, operator== #include <optional> // for optional, nullopt, nullopt_t #include <stdexcept> // for runtime_error, logic_error #include <string> // for basic_string, string, allocator, char_traits, operator+, operator<=>, operator== #include <utility> // for pair, get, move #include <variant> // for variant, get, get_if --- /home/runner/work/_temp/src/common/config.cpp should add these lines: /home/runner/work/_temp/src/common/config.cpp should remove these lines: - #include <util/chaintype.h> // lines 12-12 - #include <filesystem> // lines 19-19 - #include <memory> // lines 25-25 The full include-list for /home/runner/work/_temp/src/common/config.cpp: #include <common/args.h> // for ArgsManager, SectionInfo, KeyInfo, AbsPathForConfigVal, BITCOIN_CONF_FILENAME, CheckDataDirOption, InterpretKey, Interp... #include <common/settings.h> // for SettingsSpan, Settings, FindKey, SettingsValue #include <logging.h> // for LogPrintFormatInternal, LogWarning, LogInfo #include <sync.h> // for LOCK, UniqueLock #include <tinyformat.h> // for format, formatTruncated, formatValue, makeFormatList, strprintf, tfm, vformat #include <univalue.h> // for UniValue #include <util/fs.h> // for path, PathToString, AbsPathJoin, PathFromString, is_directory #include <util/string.h> // for TrimString, TrimStringView #include <algorithm> // for max #include <cassert> // for assert #include <cstdlib> // for size_t #include <fstream> // for basic_ifstream, basic_istream, ifstream, istream, istringstream #include <iostream> // for cerr #include <list> // for list #include <map> // for map #include <optional> // for optional #include <sstream> // for basic_istringstream #include <string> // for basic_string, string, char_traits, operator+, operator==, getline, operator<<, operator<=> #include <string_view> // for string_view #include <utility> // for pair #include <vector> // for vector --- (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/common/init.h has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/init.cpp should add these lines: /home/runner/work/_temp/src/common/init.cpp should remove these lines: - #include <algorithm> // lines 13-13 The full include-list for /home/runner/work/_temp/src/common/init.cpp: #include <common/init.h> #include <chainparams.h> // for SelectParams #include <common/args.h> // for ArgsManager, BITCOIN_CONF_FILENAME, AbsPathForConfigVal, CheckDataDirOption #include <logging.h> // for LogPrintFormatInternal, LogInfo, LogWarning #include <tinyformat.h> // for format, makeFormatList, formatTruncated, formatValue, strprintf #include <util/fs.h> // for path, quoted, PathToString, exists, operator/, create_directories, equivalent #include <util/translation.h> // for TranslatedLiteral, _, BilingualFmt, Untranslated, bilingual_str #include <exception> // for exception #include <optional> // for optional --- /home/runner/work/_temp/src/common/interfaces.cpp should add these lines: #include <functional> // for function #include <string> // for basic_string, string /home/runner/work/_temp/src/common/interfaces.cpp should remove these lines: The full include-list for /home/runner/work/_temp/src/common/interfaces.cpp: #include <interfaces/echo.h> // for Echo, MakeEcho #include <interfaces/handler.h> // for Handler, MakeCleanupHandler, MakeSignalHandler #include <boost/signals2/connection.hpp> // for scoped_connection, connection #include <functional> // for function #include <memory> // for unique_ptr, make_unique #include <string> // for basic_string, string #include <utility> // for move --- /home/runner/work/_temp/src/common/messages.h should add these lines: #include <utility> // for pair /home/runner/work/_temp/src/common/messages.h should remove these lines: The full include-list for /home/runner/work/_temp/src/common/messages.h: #include <string> // for string #include <string_view> // for string_view #include <utility> // for pair enum class FeeEstimateMode; // lines 19-19 enum class FeeReason; // lines 20-20 namespace common { enum class PSBTError; } // lines 26-26 namespace node { enum class TransactionError; } // lines 22-22 struct bilingual_str; // lines 17-17 --- (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/common/messages.cpp has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/netif.h should add these lines: #include <vector> // for vector /home/runner/work/_temp/src/common/netif.h should remove these lines: The full include-list for /home/runner/work/_temp/src/common/netif.h: #include <netaddress.h> // for CNetAddr, Network #include <optional> // for optional #include <vector> // for vector --- /home/runner/work/_temp/src/common/netif.cpp should add these lines: #include <compat/compat.h> // for AF_INET, in6_addr, in_addr, AF_INET6, sa_family_t, socklen_t, AF_NETLINK, IFF_LOOPBACK, IFF_UP, SOCK_DGRAM, sockaddr #include <linux/netlink.h> // for nlmsghdr, nlattr, NLMSG_HDRLEN, NETLINK_ROUTE, NLMSG_DATA, NLMSG_DONE, NLMSG_LENGTH, NLMSG_NEXT, NLMSG_OK, NLM_F_DUMP #include <cerrno> // for errno, EAGAIN, EINTR #include <cstdint> // for int64_t #include <cstring> // for memcpy #include <functional> // for function #include <memory> // for unique_ptr #include <string> // for basic_string /home/runner/work/_temp/src/common/netif.cpp should remove these lines: - #include <util/syserror.h> // lines 13-13 The full include-list for /home/runner/work/_temp/src/common/netif.cpp: #include <common/netif.h> #include <bitcoin-build-config.h> // for HAVE_IFADDRS #include <compat/compat.h> // for AF_INET, in6_addr, in_addr, AF_INET6, sa_family_t, socklen_t, AF_NETLINK, IFF_LOOPBACK, IFF_UP, SOCK_DGRAM, sockaddr #include <ifaddrs.h> // for ifaddrs, freeifaddrs, getifaddrs #include <linux/netlink.h> // for nlmsghdr, nlattr, NLMSG_HDRLEN, NETLINK_ROUTE, NLMSG_DATA, NLMSG_DONE, NLMSG_LENGTH, NLMSG_NEXT, NLMSG_OK, NLM_F_DUMP #include <linux/rtnetlink.h> // for rtmsg, RTA_DATA, RTA_PAYLOAD, rtattr_type_t, rtattr, RTA_NEXT, RTA_OK, RTM_GETROUTE, RTM_NEWROUTE, RTM_PAYLOAD #include <logging.h> // for LogPrintFormatInternal, LogError, LogWarning #include <netbase.h> // for CreateSock #include <sys/types.h> // for ssize_t, size_t #include <util/check.h> // for Assume, inline_assertion_check #include <util/sock.h> // for NetworkErrorString, Sock #include <cerrno> // for errno, EAGAIN, EINTR #include <cstdint> // for int64_t #include <cstring> // for memcpy #include <functional> // for function #include <memory> // for unique_ptr #include <string> // for basic_string #include <type_traits> // for conditional_t, is_signed_v --- (/home/runner/work/_temp/src/common/run_command.h has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/run_command.cpp should add these lines: #include <sstream> // for basic_istringstream, istringstream #include <stdexcept> // for runtime_error #include <utility> // for get /home/runner/work/_temp/src/common/run_command.cpp should remove these lines: The full include-list for /home/runner/work/_temp/src/common/run_command.cpp: #include <common/run_command.h> #include <bitcoin-build-config.h> // for ENABLE_EXTERNAL_SIGNER #include <tinyformat.h> // for format, formatTruncated, formatValue, makeFormatList, strprintf #include <univalue.h> // for UniValue #include <util/string.h> // for Join #include <util/subprocess.h> // for Popen, IOTYPE, error, input, output #include <sstream> // for basic_istringstream, istringstream #include <stdexcept> // for runtime_error #include <utility> // for get --- /home/runner/work/_temp/src/common/pcp.h should add these lines: #include <array> // for array #include <chrono> // for milliseconds #include <cstddef> // for size_t #include <cstdint> // for uint32_t, uint8_t, uint16_t #include <string> // for string class CThreadInterrupt; /home/runner/work/_temp/src/common/pcp.h should remove these lines: - #include <util/threadinterrupt.h> // lines 9-9 The full include-list for /home/runner/work/_temp/src/common/pcp.h: #include <netaddress.h> // for CNetAddr (ptr only), CService #include <array> // for array #include <chrono> // for milliseconds #include <cstddef> // for size_t #include <cstdint> // for uint32_t, uint8_t, uint16_t #include <string> // for string #include <variant> // for variant class CThreadInterrupt; --- /home/runner/work/_temp/src/common/pcp.cpp should add these lines: #include <compat/compat.h> // for sockaddr_storage, WSAGetLastError, in_addr, socklen_t, in6_addr, sockaddr_in, AF_INET, IPPROTO_UDP, SOCK_DGRAM #include <crypto/hex_base.h> // for HexStr #include <tinyformat.h> // for format, formatValue, formatTruncated, makeFormatList, strprintf #include <util/string.h> // for HasPrefix #include <util/time.h> // for MockableSteadyClock #include <algorithm> // for __equal_fn, equal #include <compare> // for operator<, strong_ordering #include <cstring> // for memcpy #include <functional> // for function #include <map> // for map, operator== #include <memory> // for unique_ptr #include <optional> // for optional, nullopt, nullopt_t #include <span> // for span #include <utility> // for pair #include <vector> // for vector /home/runner/work/_temp/src/common/pcp.cpp should remove these lines: - #include <common/netif.h> // lines 8-8 - #include <random.h> // lines 13-13 - #include <span.h> // lines 14-14 - #include <util/readwritefile.h> // lines 16-16 - #include <util/strencodings.h> // lines 18-18 The full include-list for /home/runner/work/_temp/src/common/pcp.cpp: #include <common/pcp.h> #include <compat/compat.h> // for sockaddr_storage, WSAGetLastError, in_addr, socklen_t, in6_addr, sockaddr_in, AF_INET, IPPROTO_UDP, SOCK_DGRAM #include <crypto/common.h> // for ReadBE16, WriteBE16, ReadBE32, WriteBE32 #include <crypto/hex_base.h> // for HexStr #include <logging.h> // for LogPrintFormatInternal, LogFlags, LogWarning, LogDebug #include <netaddress.h> // for CService, CNetAddr, ADDR_IPV6_SIZE, IPV4_IN_IPV6_PREFIX, ADDR_IPV4_SIZE #include <netbase.h> // for CreateSock #include <tinyformat.h> // for format, formatValue, formatTruncated, makeFormatList, strprintf #include <util/check.h> // for inline_assertion_check, Assume #include <util/sock.h> // for NetworkErrorString, Sock #include <util/string.h> // for HasPrefix #include <util/threadinterrupt.h> // for CThreadInterrupt #include <util/time.h> // for MockableSteadyClock #include <algorithm> // for __equal_fn, equal #include <atomic> // for atomic #include <compare> // for operator<, strong_ordering #include <cstring> // for memcpy #include <functional> // for function #include <map> // for map, operator== #include <memory> // for unique_ptr #include <optional> // for optional, nullopt, nullopt_t #include <span> // for span #include <utility> // for pair #include <vector> // for vector --- /home/runner/work/_temp/src/common/settings.h should add these lines: #include <univalue.h> // for UniValue /home/runner/work/_temp/src/common/settings.h should remove these lines: - class UniValue; // lines 15-15 The full include-list for /home/runner/work/_temp/src/common/settings.h: #include <univalue.h> // for UniValue #include <util/fs.h> // for path #include <cstddef> // for size_t #include <map> // for map #include <string> // for basic_string, string #include <vector> // for vector --- /home/runner/work/_temp/src/common/settings.cpp should add these lines: /home/runner/work/_temp/src/common/settings.cpp should remove these lines: - #include <algorithm> // lines 13-13 The full include-list for /home/runner/work/_temp/src/common/settings.cpp: #include <common/settings.h> #include <bitcoin-build-config.h> // for CLIENT_NAME #include <tinyformat.h> // for format, formatValue, makeFormatList, strprintf, formatTruncated #include <univalue.h> // for UniValue #include <util/fs.h> // for PathToString, path, exists #include <fstream> // for basic_ifstream, basic_ofstream, basic_ostream, endl, ifstream, ofstream #include <iterator> // for istreambuf_iterator, operator== #include <map> // for map #include <string> // for basic_string, string, char_traits, operator<=>, operator<< #include <utility> // for pair #include <vector> // for vector --- (/home/runner/work/_temp/src/common/url.h has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/url.cpp should add these lines: #include <cstddef> // for size_t /home/runner/work/_temp/src/common/url.cpp should remove these lines: The full include-list for /home/runner/work/_temp/src/common/url.cpp: #include <common/url.h> #include <charconv> // for from_chars_result, from_chars #include <cstddef> // for size_t #include <string> // for basic_string, string #include <string_view> // for string_view #include <system_error> // for errc --- (/home/runner/work/_temp/src/common/signmessage.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) /home/runner/work/_temp/src/common/signmessage.cpp should add these lines: #include <addresstype.h> // for PKHash, CTxDestination, IsValidDestination #include <span> // for span /home/runner/work/_temp/src/common/signmessage.cpp should remove these lines: The full include-list for /home/runner/work/_temp/src/common/signmessage.cpp: #include <common/signmessage.h> #include <addresstype.h> // for PKHash, CTxDestination, IsValidDestination #include <hash.h> // for HashWriter #include <key.h> // for CKey #include <key_io.h> // for DecodeDestination #include <pubkey.h> // for CPubKey #include <uint256.h> // for uint256 #include <util/strencodings.h> // for DecodeBase64, EncodeBase64 #include <cassert> // for assert #include <optional> // for optional #include <span> // for span #include <string> // for basic_string, string #include <variant> // for get_if #include <vector> // for vector --- /home/runner/work/_temp/src/common/system.h should add these lines: #include <cstddef> // for size_t /home/runner/work/_temp/src/common/system.h should remove these lines: - #include <chrono> // lines 12-12 - #include <cstdint> // lines 13-13 The full include-list for /home/runner/work/_temp/src/common/system.h: #include <bitcoin-build-config.h> // for HAVE_SYSTEM #include <util/time.h> // for SteadyClock #include <cstddef> // for size_t #include <optional> // for optional #include <string> // for string --- /home/runner/work/_temp/src/common/system.cpp should add these lines: #include <sys/types.h> // for mode_t #include <limits> // for numeric_limits /home/runner/work/_temp/src/common/system.cpp should remove these lines: The full include-list for /home/runner/work/_temp/src/common/system.cpp: #include <common/system.h> #include <bitcoin-build-config.h> // for HAVE_MALLOPT_ARENA_MAX, HAVE_SYSTEM #include <logging.h> // for LogPrintFormatInternal, LogWarning #include <malloc.h> // for M_ARENA_MAX, mallopt #include <sys/stat.h> // for umask #include <sys/types.h> // for mode_t #include <unistd.h> // for sysconf, _SC_PAGESIZE, _SC_PHYS_PAGES #include <util/string.h> // for ReplaceAll #include <util/time.h> // for SteadyClock, operator- #include <algorithm> // for min #include <cstddef> // for size_t #include <cstdint> // for uint64_t #include <cstdlib> // for setenv, system #include <limits> // for numeric_limits #include <locale> // for locale #include <optional> // for optional, nullopt, nullopt_t #include <stdexcept> // for runtime_error #include <string> // for allocator, basic_string, char_traits, string, operator+ #include <thread> // for thread --- (/home/runner/work/_temp/src/core_io.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/core_io.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chainparams.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chainparams.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/base.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/base.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/blockfilterindex.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/blockfilterindex.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/coinstatsindex.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/coinstatsindex.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/txindex.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/txindex.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chain.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chain.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/checks.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/checks.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/cs_main.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/cs_main.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/txospenderindex.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/index/txospenderindex.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/context.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/context.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/mempool_removal_reason.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/mempool_removal_reason.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/disconnected_transactions.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/disconnected_transactions.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/coinstats.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/coinstats.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/include/univalue.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/lib/univalue.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/signet.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/signet.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/lib/univalue_read.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/lib/univalue_get.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/lib/univalue_write.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/utxo_snapshot.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/utxo_snapshot.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/test/unitester.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/univalue/test/object.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/aes.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/aes.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/chacha20.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/chacha20.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/chacha20poly1305.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/chacha20poly1305.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hkdf_sha256_32.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hkdf_sha256_32.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hex_base.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hex_base.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hmac_sha512.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hmac_sha512.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hmac_sha256.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/hmac_sha256.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/ripemd160.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/ripemd160.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/poly1305.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/poly1305.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/blockstorage.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/blockstorage.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha256_sse4.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha1.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha1.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha512.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha512.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha3.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha3.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha256.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha256.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/muhash.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/muhash.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/siphash.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/siphash.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha256_sse41.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha256_avx2.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/crypto/sha256_x86_shani.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqabstractnotifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqabstractnotifier.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqutil.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqutil.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqnotificationinterface.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqnotificationinterface.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqpublishnotifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqpublishnotifier.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqrpc.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/zmq/zmqrpc.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/checks.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/checks.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chain.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chain.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/context.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/context.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chainparams.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/chainparams.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/cs_main.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/cs_main.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/bitcoinkernel.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/bitcoinkernel.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/mempool_removal_reason.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/mempool_removal_reason.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/disconnected_transactions.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/disconnected_transactions.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/coinstats.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/kernel/coinstats.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/utxo_snapshot.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/utxo_snapshot.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/blockstorage.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/node/blockstorage.cpp has correct #includes/fwd-decls) (/home/runner/work/_temp/src/signet.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/block.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/primitives/transaction_identifier.h has correct #includes/fwd-decls) (/home/runner/work/_temp/src/signet.cpp has correct #includes/fwd-decls) + python3 /include-what-you-use/fix_includes.py --nosafe_headers (skipping /home/runner/work/_temp/src/primitives/transaction.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/primitives/transaction_identifier.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/primitives/transaction.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/primitives/block.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/primitives/block.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/common/init.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/common/messages.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/common/run_command.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/common/url.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/common/signmessage.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/core_io.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/core_io.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/chainparams.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/chainparams.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/base.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/base.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/blockfilterindex.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/blockfilterindex.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/coinstatsindex.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/coinstatsindex.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/txindex.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/txindex.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/chain.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/chain.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/checks.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/checks.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/cs_main.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/cs_main.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/txospenderindex.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/index/txospenderindex.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/context.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/context.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/mempool_removal_reason.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/mempool_removal_reason.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/disconnected_transactions.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/disconnected_transactions.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/coinstats.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/coinstats.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/include/univalue.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/lib/univalue.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/signet.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/signet.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/lib/univalue_read.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/lib/univalue_get.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/lib/univalue_write.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/node/utxo_snapshot.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/node/utxo_snapshot.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/test/unitester.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/univalue/test/object.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/aes.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/aes.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/chacha20.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/chacha20.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/chacha20poly1305.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/chacha20poly1305.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hkdf_sha256_32.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hkdf_sha256_32.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hex_base.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hex_base.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hmac_sha512.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hmac_sha512.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hmac_sha256.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/hmac_sha256.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/ripemd160.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/ripemd160.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/poly1305.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/poly1305.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/node/blockstorage.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/node/blockstorage.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha256_sse4.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha1.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha1.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha512.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha512.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha3.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha3.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha256.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha256.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/muhash.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/muhash.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/siphash.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/siphash.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha256_sse41.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha256_avx2.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/crypto/sha256_x86_shani.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqabstractnotifier.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqabstractnotifier.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqutil.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqutil.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqnotificationinterface.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqnotificationinterface.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqpublishnotifier.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqpublishnotifier.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqrpc.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/zmq/zmqrpc.cpp: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/bitcoinkernel.h: iwyu reports no contentful changes) (skipping /home/runner/work/_temp/src/kernel/bitcoinkernel.cpp: iwyu reports no contentful changes) >>> Fixing #includes in '/home/runner/work/_temp/src/common/bloom.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/bloom.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/args.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/args.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/config.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/init.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/interfaces.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/messages.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/netif.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/netif.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/run_command.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/pcp.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/pcp.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/settings.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/settings.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/url.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/signmessage.cpp' >>> Fixing #includes in '/home/runner/work/_temp/src/common/system.h' >>> Fixing #includes in '/home/runner/work/_temp/src/common/system.cpp' IWYU edited 19 files on your behalf. + git diff -U1 + ./contrib/devtools/clang-format-diff.py -binary=clang-format-22 -p1 -i -v Formatting src/common/args.cpp Formatting src/common/args.h Formatting src/common/bloom.cpp Formatting src/common/bloom.h Formatting src/common/config.cpp Formatting src/common/init.cpp Formatting src/common/interfaces.cpp Formatting src/common/messages.h Formatting src/common/netif.cpp Formatting src/common/netif.h Formatting src/common/pcp.cpp Formatting src/common/pcp.h Formatting src/common/run_command.cpp Formatting src/common/settings.cpp Formatting src/common/settings.h Formatting src/common/signmessage.cpp Formatting src/common/system.cpp Formatting src/common/system.h Formatting src/common/url.cpp + git --no-pager diff --exit-code diff --git a/src/common/args.cpp b/src/common/args.cpp index 12e0f26..101b4b7 100644 --- a/src/common/args.cpp +++ b/src/common/args.cpp @@ -23,8 +23,6 @@ #endif #include <algorithm> -#include <cassert> -#include <cstdint> #include <cstdlib> #include <cstring> #include <map> diff --git a/src/common/args.h b/src/common/args.h index de323d3..26ea241 100644 --- a/src/common/args.h +++ b/src/common/args.h @@ -6,7 +6,6 @@ #define BITCOIN_COMMON_ARGS_H #include <common/settings.h> -#include <compat/compat.h> #include <sync.h> #include <util/chaintype.h> #include <util/fs.h> diff --git a/src/common/bloom.cpp b/src/common/bloom.cpp index 3ee7899..c15c8f7 100644 --- a/src/common/bloom.cpp +++ b/src/common/bloom.cpp @@ -16,8 +16,7 @@ #include <algorithm> #include <cmath> -#include <cstdlib> -#include <limits> +#include <compare> #include <vector> static constexpr double LN2SQUARED = 0.4804530139182014246671025263266649717305529515945455; diff --git a/src/common/bloom.h b/src/common/bloom.h index 97007e1..c9ed89f 100644 --- a/src/common/bloom.h +++ b/src/common/bloom.h @@ -6,8 +6,9 @@ #define BITCOIN_COMMON_BLOOM_H #include <serialize.h> -#include <span.h> +#include <cstdint> +#include <span> #include <vector> class COutPoint; diff --git a/src/common/config.cpp b/src/common/config.cpp index a05c20d..3c88e3a 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -3,27 +3,23 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <common/args.h> - #include <common/settings.h> #include <logging.h> #include <sync.h> #include <tinyformat.h> #include <univalue.h> -#include <util/chaintype.h> #include <util/fs.h> #include <util/string.h> #include <algorithm> #include <cassert> #include <cstdlib> -#include <filesystem> #include <fstream> #include <iostream> -#include <sstream> #include <list> #include <map> -#include <memory> #include <optional> +#include <sstream> #include <string> #include <string_view> #include <utility> diff --git a/src/common/init.cpp b/src/common/init.cpp index 7a1d664..e6f49c3 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -2,15 +2,15 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include <common/init.h> + #include <chainparams.h> #include <common/args.h> -#include <common/init.h> #include <logging.h> #include <tinyformat.h> #include <util/fs.h> #include <util/translation.h> -#include <algorithm> #include <exception> #include <optional> diff --git a/src/common/interfaces.cpp b/src/common/interfaces.cpp index ffd85e6..be97653 100644 --- a/src/common/interfaces.cpp +++ b/src/common/interfaces.cpp @@ -6,7 +6,10 @@ #include <interfaces/handler.h> #include <boost/signals2/connection.hpp> + +#include <functional> #include <memory> +#include <string> #include <utility> namespace common { diff --git a/src/common/messages.h b/src/common/messages.h index 60fdaa1..6dc3212 100644 --- a/src/common/messages.h +++ b/src/common/messages.h @@ -13,17 +13,19 @@ #include <string> #include <string_view> +#include <utility> struct bilingual_str; - enum class FeeEstimateMode; enum class FeeReason; + namespace node { enum class TransactionError; } // namespace node namespace common { enum class PSBTError; + bool FeeModeFromString(std::string_view mode_string, FeeEstimateMode& fee_estimate_mode); std::string StringForFeeReason(FeeReason reason); std::string FeeModes(const std::string& delimiter); diff --git a/src/common/netif.cpp b/src/common/netif.cpp index 8c0c4fa..6d6a6e0 100644 --- a/src/common/netif.cpp +++ b/src/common/netif.cpp @@ -6,11 +6,12 @@ #include <common/netif.h> +#include <compat/compat.h> +#include <linux/netlink.h> #include <logging.h> #include <netbase.h> #include <util/check.h> #include <util/sock.h> -#include <util/syserror.h> #if defined(__linux__) #include <linux/rtnetlink.h> @@ -34,6 +35,12 @@ #include <ifaddrs.h> #endif +#include <cerrno> + echo '^^^ ⚠️ Failure generated from IWYU' + false +#include <cstdint> +#include <cstring> +#include <functional> +#include <memory> +#include <string> #include <type_traits> namespace { diff --git a/src/common/netif.h b/src/common/netif.h index 769bcbc..84df00a 100644 --- a/src/common/netif.h +++ b/src/common/netif.h @@ -8,6 +8,7 @@ #include <netaddress.h> #include <optional> +#include <vector> //! Query the OS for the default gateway for `network`. This only makes sense for NET_IPV4 and NET_IPV6. //! Returns std::nullopt if it cannot be found, or there is no support for this OS. diff --git a/src/common/pcp.cpp b/src/common/pcp.cpp index a640b82..5fcbec4 100644 --- a/src/common/pcp.cpp +++ b/src/common/pcp.cpp @@ -4,19 +4,30 @@ #include <common/pcp.h> -#include <atomic> -#include <common/netif.h> +#include <compat/compat.h> #include <crypto/common.h> +#include <crypto/hex_base.h> #include <logging.h> #include <netaddress.h> #include <netbase.h> -#include <random.h> -#include <span.h> +#include <tinyformat.h> #include <util/check.h> -#include <util/readwritefile.h> #include <util/sock.h> -#include <util/strencodings.h> +#include <util/string.h> #include <util/threadinterrupt.h> +#include <util/time.h> + +#include <algorithm> +#include <atomic> +#include <compare> +#include <cstring> +#include <functional> +#include <map> +#include <memory> +#include <optional> +#include <span> +#include <utility> +#include <vector> namespace { diff --git a/src/common/pcp.h b/src/common/pcp.h index 121349b..b703ccd 100644 --- a/src/common/pcp.h +++ b/src/common/pcp.h @@ -6,10 +6,16 @@ #define BITCOIN_COMMON_PCP_H #include <netaddress.h> -#include <util/threadinterrupt.h> +#include <array> +#include <chrono> +#include <cstddef> +#include <cstdint> +#include <string> #include <variant> +class CThreadInterrupt; + // RFC6886 NAT-PMP and RFC6887 Port Control Protocol (PCP) implementation. // NAT-PMP and PCP use network byte order (big-endian). diff --git a/src/common/run_command.cpp b/src/common/run_command.cpp index 86f89e1..026e1ef 100644 --- a/src/common/run_command.cpp +++ b/src/common/run_command.cpp @@ -10,6 +10,10 @@ #include <univalue.h> #include <util/string.h> +#include <sstream> +#include <stdexcept> +#include <utility> + #ifdef ENABLE_EXTERNAL_SIGNER #include <util/subprocess.h> #endif // ENABLE_EXTERNAL_SIGNER diff --git a/src/common/settings.cpp b/src/common/settings.cpp index e9b9297..d8c627a 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -2,15 +2,14 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <common/settings.h> - #include <bitcoin-build-config.h> // IWYU pragma: keep +#include <common/settings.h> + #include <tinyformat.h> #include <univalue.h> #include <util/fs.h> -#include <algorithm> #include <fstream> #include <iterator> #include <map> diff --git a/src/common/settings.h b/src/common/settings.h index bc7b89a..b326df7 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_COMMON_SETTINGS_H #define BITCOIN_COMMON_SETTINGS_H +#include <univalue.h> #include <util/fs.h> #include <cstddef> @@ -12,8 +13,6 @@ #include <string> #include <vector> -class UniValue; - namespace common { //! Settings value type (string/integer/boolean/null variant). diff --git a/src/common/signmessage.cpp b/src/common/signmessage.cpp index 0f9e1f5..cae76ba 100644 --- a/src/common/signmessage.cpp +++ b/src/common/signmessage.cpp @@ -4,6 +4,8 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <common/signmessage.h> + +#include <addresstype.h> #include <hash.h> #include <key.h> #include <key_io.h> @@ -13,6 +15,7 @@ #include <cassert> #include <optional> +#include <span> #include <string> #include <variant> #include <vector> diff --git a/src/common/system.cpp b/src/common/system.cpp index 08c0c69..1d5396e 100644 --- a/src/common/system.cpp +++ b/src/common/system.cpp @@ -8,14 +8,16 @@ #include <common/system.h> #include <logging.h> +#include <sys/types.h> #include <util/string.h> #include <util/time.h> #ifdef WIN32 -#include <cassert> -#include <codecvt> #include <compat/compat.h> #include <windows.h> + +#include <cassert> +#include <codecvt> #else #include <sys/stat.h> #include <unistd.h> @@ -29,6 +31,7 @@ #include <cstddef> #include <cstdint> #include <cstdlib> +#include <limits> #include <locale> #include <optional> #include <stdexcept> diff --git a/src/common/system.h b/src/common/system.h index a3100fe..6fa6bd4 100644 --- a/src/common/system.h +++ b/src/common/system.h @@ -7,10 +7,10 @@ #define BITCOIN_COMMON_SYSTEM_H #include <bitcoin-build-config.h> // IWYU pragma: keep + #include <util/time.h> -#include <chrono> -#include <cstdint> +#include <cstddef> #include <optional> #include <string> diff --git a/src/common/url.cpp b/src/common/url.cpp index 30ac26a..adb5220 100644 --- a/src/common/url.cpp +++ b/src/common/url.cpp @@ -5,6 +5,7 @@ #include <common/url.h> #include <charconv> +#include <cstddef> #include <string> #include <string_view> #include <system_error> ^^^ ⚠️ Failure generated from IWYU

Comment thread src/CMakeLists.txt Outdated
$<$<NOT:$<TARGET_EXISTS:bitcoin_wallet>>:dummywallet.cpp>
)
target_link_libraries(bitcoin_node
PUBLIC

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want these PUBLIC? (I also don't think IWYU should be driving build system changes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated in the commit message, std::map does not allow incomplete types. settings.h therefore requires univalue.h to be included. That is a PUBLIC dependency by definition.

At the moment, this dependency is not expressed explicitly. The consequence is that all clients that include settings.h also have to include univalue.h and link bitcoin_common. IWYU does not introduce a new dependency, it just makes it explicit that the dependency exists already.

Expressing the actual architecture explicitly should be seen as a good thing and we can expect to see more of that in the future. FILE_SET will make it explicit which target a header file belongs to, which is also something that is not expressed in the buildsystem at the moment. Chances are, that we realize that the actual architecture does not match our expectations. We should not blame the tools for this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings.h therefore requires univalue.h to be included. That is a PUBLIC dependency by definition.

I don't follow this -- settings.cpp is in bitcoin_common not bitcoin_node, so if the settings to univalue dependency did mean univalue should be publicly exposed, that would only affect bitcoin_common, not bitcoin_node. But just because univalue is used as the internal implementation for settings, and header information needs to be available to everyone using settings, that doesn't mean the implementation logic needs to be a PUBLIC export even for bitcoin_common, as far as I can see.

If I'm missing something, can you spell out the logic here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hebasto / @purpleKarrot can either of you follow up here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do want to make this change (including univalue.h properly in that header, satisfying IWYU and making the header easier to use), then I think the PUBLIC approach is the way to go, rather than adding PRIVATE univalue links to every user of common that doesn't already have it.

It's not clear to me whether that's a good or a bad idea (does it add univalue code to libs/executables where it's not needed?). IWYU is "correct" in the sense that as-is the dependencies are a code-smell -- if you include this header and try to use it, without also including univalue.h you'll get a bug (and you also can't include univalue.h without adding at least a PRIVATE dep on univalue for the module). So if we don't want to add univalue to every thing that uses common, we should at least add a pragma to document that this isn't ideal code, perhaps something like:

// Users of this header need to explicitly #include <univalue.h>
class Univalue; // IWYU pragma: keep

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit "Include <univalue.h> instead of forward declaring UniValue" (b1c654b)

I have the same question as AJ. I don't see why bitcoin_node needs to change here. The bitcoin_common change above should already propagate the univalue dependency to consumers of bitcoin_common.

Changing bitcoin_common from a PRIVATE to PUBLIC dependency of bitcoin_node seems like a separate interface change, only needed if bitcoin_node public headers expose bitcoin_common headers/types. Is there a specific header requiring this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like there's been a response to the questions in this thread. Even if this was discussed offline, or similar, given that multiple reviewers have all asked the same question, it seems like there should be a response here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow this -- settings.cpp is in bitcoin_common not bitcoin_node, so if the settings to univalue dependency did mean univalue should be publicly exposed, that would only affect bitcoin_common, not bitcoin_node. But just because univalue is used as the internal implementation for settings, and header information needs to be available to everyone using settings, that doesn't mean the implementation logic needs to be a PUBLIC export even for bitcoin_common, as far as I can see.

I agree. The changes to the univalue dependency do not imply promoting bitcoin_common from PRIVATE to PUBLIC in bitcoin_node.

Let's take a step back, and look at the bitcoin_node's consumers. Skipping GUI and tests, there are two of them: bitcoind and bitcoin-node. Both share the same source file src/bitcoind.cpp. Looking at its included headers, one can clearly see that it directly uses symbols from four static libraries: bitcoin_clientversion, bitcoin_common, bitcoin_node and bitcoin_util. So they are part of bitcoind's build specification.

This can be achieved either (1) by explicitly specifying those libraries in target_link_libraries(bitcoind ...) or (2) by propagating them as usage requirements in target_link_libraries(bitcoin_node PUBLIC ...).

Also note that these dependencies are not reflected in our design documentation (also see #35167 (comment)).

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review 28712de. Changes overall seem reasonable but I had two questions (below).

I also talked with @hebasto about avoiding the need for ArgsManager callers to all include univalue.h. It might be good to avoid this dependency with a change like:

-    common::Settings m_settings GUARDED_BY(cs_args);
+    std::unique_ptr<Settings> m_settings GUARDED_BY(cs_args);

But current approach also seems reasonable to me

Comment thread src/CMakeLists.txt Outdated
$<$<NOT:$<TARGET_EXISTS:bitcoin_wallet>>:dummywallet.cpp>
)
target_link_libraries(bitcoin_node
PUBLIC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit "Include <univalue.h> instead of forward declaring UniValue" (b1c654b)

I have the same question as AJ. I don't see why bitcoin_node needs to change here. The bitcoin_common change above should already propagate the univalue dependency to consumers of bitcoin_common.

Changing bitcoin_common from a PRIVATE to PUBLIC dependency of bitcoin_node seems like a separate interface change, only needed if bitcoin_node public headers expose bitcoin_common headers/types. Is there a specific header requiring this?

Comment thread src/common/system.cpp
#include <cassert>
#include <codecvt>
#include <compat/compat.h>
#include <util/check.h>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In commit "ci, iwyu: Fix warnings in src/common and treat them as errors" (28712de)

Is is right that util/check.h is needed on win32? I don't see Assume/Assert being used in this file, but I do see assert being used. Also it looks like includes are out of order here and I'd be surprised if IWYU was suggesting changes for win32 in any case, so something seems odd here. Would be good to mention in commit message if any changes not suggested by IWYU are being made here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is right that util/check.h is needed on win32? I don't see Assume/Assert being used in this file, but I do see assert being used... Would be good to mention in commit message if any changes not suggested by IWYU are being made here.

Yes, we use <util/check.h> as a drop-in replacement for <cassert>. I've updated the commit message to explicitly mention these manual header replacements:

ci, iwyu: Enforce warning-free `src/common`

Fix all IWYU warnings in `src/common` and treat them as errors in the
CI.

Additionally, ensure that our drop-in header replacements are used
instead of system headers:
- `<util/check.h>` instead of `<cassert>`
- `<util/time.h>` instead of `<chrono>`

Also it looks like includes are out of order here...

The headers here:

#ifdef WIN32
#include <compat/compat.h>
#include <util/check.h>
#include <codecvt>
#include <windows.h>
#else

are sorted by groups first: project headers, system headers, and then platform headers. They are sorted lexicographically within each group. The same approach is used across the entire codebase.

@fanquake fanquake changed the title ci, iwyu: Fix warnings in src/common and treat them as errors iwyu: Fix warnings in src/common and treat them as errors May 29, 2026
@fanquake

fanquake commented Jul 3, 2026

Copy link
Copy Markdown
Member

What is the status of this?

@maflcko

maflcko commented Jul 4, 2026

Copy link
Copy Markdown
Member

If this is stuck, maybe a different folder can be picked? I'd say any folder is relevant, other than the boost unit tests (due to boost include handling), or the gui (which will be removed soon anyway)?

@hebasto

hebasto commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

What is the status of this?

A couple of PRs (not directly related to IWYU) have been split out and are ready for review: #35658 and #35667.

sedited added a commit that referenced this pull request Jul 6, 2026
…`<ifaddrs.h>`

22c328d refactor: Drop unneeded `<sys/types.h>` include before `<ifaddrs.h>` (Hennadii Stepanov)

Pull request description:

  Pure `getifaddrs()`/`freeifaddrs()` calls do not need any type definitions beyond those provided by `<ifaddrs.h>` itself.

  The subsequent `struct ifaddrs` processing in `netif.cpp` does not involve any symbols from `<sys/types.h>`.

  Platform-specific manual pages for reviewers' convenience:
  - https://www.man7.org/linux/man-pages/man3/getifaddrs.3.html
  - https://man.freebsd.org/cgi/man.cgi?query=getifaddrs
  - https://man.netbsd.org/getifaddrs.3
  - https://man.openbsd.org/getifaddrs.3
  - https://www.illumos.org/man/3SOCKET/getifaddrs

  Related to #34995.

ACKs for top commit:
  maflcko:
    lgtm ACK 22c328d
  sedited:
    ACK 22c328d

Tree-SHA512: e1d0627d12feb0f52ff45e93fa9deb3d5636e398128acb45d42c4a1779ecafcf3d98cbbf1dd7159247fdf679f15375bea919b7c63d4063c6e9e5c0255130626b
@hebasto hebasto force-pushed the 260403-iwyu-common branch 2 times, most recently from c5ea671 to 7e31906 Compare July 6, 2026 13:19
@hebasto

hebasto commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

I also talked with @hebasto about avoiding the need for ArgsManager callers to all include univalue.h. It might be good to avoid this dependency with a change like:

-    common::Settings m_settings GUARDED_BY(cs_args);
+    std::unique_ptr<Settings> m_settings GUARDED_BY(cs_args);

I've played a bit with this approach. It would need common::SettingsValue forward declarations in many headers.

For now, I'm going to move forward with the approach suggested by @ajtowns, leaving <univalue.h>-related issues for follow-ups.

@hebasto hebasto force-pushed the 260403-iwyu-common branch from 7e31906 to 50b9f20 Compare July 6, 2026 16:00
@hebasto hebasto marked this pull request as ready for review July 6, 2026 16:00
fanquake added a commit that referenced this pull request Jul 7, 2026
…etif.cpp`

eccb04a refactor: Use `NetworkErrorString` for macOS code in `netif.cpp` (Hennadii Stepanov)

Pull request description:

  Although these `sysctl` calls report generic system errors rather than network errors, `NetworkErrorString()` is identical to `SysErrorString()` on POSIX systems, so this does not change behavior. It allows removing `#include <util/syserror.h>`, which was only needed by `__APPLE__` code and would otherwise require an `#ifdef` guard to silence an IWYU unused-include warning on other platforms.

  Related to #34995.

ACKs for top commit:
  sedited:
    ACK eccb04a

Tree-SHA512: 25838dcf206f728fb0968a9ff336863870b69f857436a47b9916269e624d0f157bd566b461911dfea69716de482bbde6903d51bb97e6f70631dfcd274390ac3d
@hebasto hebasto force-pushed the 260403-iwyu-common branch from 50b9f20 to 0d14b72 Compare July 7, 2026 10:21
@hebasto

hebasto commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

If this is stuck...

I believe all feedback has been addressed, and this PR is ready for another review round.

Kino1994 pushed a commit to Kino1994/bitcoin-full-history that referenced this pull request Jul 10, 2026
…include before `<ifaddrs.h>`

0e76328 refactor: Drop unneeded `<sys/types.h>` include before `<ifaddrs.h>` (Hennadii Stepanov)

Pull request description:

  Pure `getifaddrs()`/`freeifaddrs()` calls do not need any type definitions beyond those provided by `<ifaddrs.h>` itself.

  The subsequent `struct ifaddrs` processing in `netif.cpp` does not involve any symbols from `<sys/types.h>`.

  Platform-specific manual pages for reviewers' convenience:
  - https://www.man7.org/linux/man-pages/man3/getifaddrs.3.html
  - https://man.freebsd.org/cgi/man.cgi?query=getifaddrs
  - https://man.netbsd.org/getifaddrs.3
  - https://man.openbsd.org/getifaddrs.3
  - https://www.illumos.org/man/3SOCKET/getifaddrs

  Related to bitcoin/bitcoin#34995.

ACKs for top commit:
  maflcko:
    lgtm ACK 0e76328
  sedited:
    ACK 0e76328

Tree-SHA512: e1d0627d12feb0f52ff45e93fa9deb3d5636e398128acb45d42c4a1779ecafcf3d98cbbf1dd7159247fdf679f15375bea919b7c63d4063c6e9e5c0255130626b
Kino1994 pushed a commit to Kino1994/bitcoin-full-history that referenced this pull request Jul 10, 2026
…acOS code in `netif.cpp`

9770a1e refactor: Use `NetworkErrorString` for macOS code in `netif.cpp` (Hennadii Stepanov)

Pull request description:

  Although these `sysctl` calls report generic system errors rather than network errors, `NetworkErrorString()` is identical to `SysErrorString()` on POSIX systems, so this does not change behavior. It allows removing `#include <util/syserror.h>`, which was only needed by `__APPLE__` code and would otherwise require an `#ifdef` guard to silence an IWYU unused-include warning on other platforms.

  Related to bitcoin/bitcoin#34995.

ACKs for top commit:
  sedited:
    ACK 9770a1e

Tree-SHA512: 25838dcf206f728fb0968a9ff336863870b69f857436a47b9916269e624d0f157bd566b461911dfea69716de482bbde6903d51bb97e6f70631dfcd274390ac3d
Fix all IWYU warnings in `src/common` and treat them as errors in CI.

Additionally, ensure that our drop-in header replacements are used
instead of system headers:
- `<util/check.h>` instead of `<cassert>`
- `<util/time.h>` instead of `<chrono>`
@hebasto hebasto force-pushed the 260403-iwyu-common branch from 0d14b72 to ddf44c3 Compare July 14, 2026 14:28
@hebasto

hebasto commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Rebased to refresh the CI.

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.

9 participants