Skip to content

Commit 1d89fc6

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25324: refactor: add most of src/util to iwyu
07f2c25 refactor: add most of src/util to iwyu (fanquake) Pull request description: These files change infrequently, and not much header shuffling is required. We don't add everything in src/util/ yet, because IWYU makes some dubious suggestions, which I'm going to follow up with upstream. Soon we'll swap `src/util/xyz.cpp` for just `src/util/`. ACKs for top commit: hebasto: ACK 07f2c25, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 07d76435c2bff1a62c4967eb0efaafe619cc3bbaf4166741d8520927b24336c01aee59822f8082ee2a01e15046a0f5d506b4b23a6e40ceb750f3226ed8167847
2 parents 46fcb52 + 07f2c25 commit 1d89fc6

25 files changed

+82
-29
lines changed

ci/test/06_script_b.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ if [ "${RUN_TIDY}" = "true" ]; then
4747
" src/rpc/fees.cpp"\
4848
" src/rpc/signmessage.cpp"\
4949
" src/test/fuzz/txorphan.cpp"\
50+
" src/util/bip32.cpp"\
51+
" src/util/bytevectorhash.cpp"\
52+
" src/util/error.cpp"\
53+
" src/util/getuniquepath.cpp"\
54+
" src/util/hasher.cpp"\
55+
" src/util/message.cpp"\
56+
" src/util/moneystr.cpp"\
57+
" src/util/serfloat.cpp"\
58+
" src/util/spanparsing.cpp"\
59+
" src/util/strencodings.cpp"\
60+
" src/util/syserror.cpp"\
61+
" src/util/url.cpp"\
5062
" -p . ${MAKEJOBS} -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp"
5163
fi
5264

src/util/asmap.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
#include <crypto/common.h>
99
#include <fs.h>
1010
#include <logging.h>
11+
#include <serialize.h>
1112
#include <streams.h>
1213

14+
#include <algorithm>
1315
#include <cassert>
14-
#include <map>
16+
#include <cstdio>
17+
#include <utility>
1518
#include <vector>
1619

1720
namespace {

src/util/bip32.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include <sstream>
6-
#include <stdio.h>
75
#include <tinyformat.h>
86
#include <util/bip32.h>
97
#include <util/strencodings.h>
108

9+
#include <algorithm>
10+
#include <cstdint>
11+
#include <cstdio>
12+
#include <sstream>
13+
1114

1215
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
1316
{

src/util/bip32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef BITCOIN_UTIL_BIP32_H
66
#define BITCOIN_UTIL_BIP32_H
77

8+
#include <cstdint>
89
#include <string>
910
#include <vector>
1011

src/util/bytevectorhash.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <random.h>
77
#include <util/bytevectorhash.h>
88

9+
#include <vector>
10+
911
ByteVectorHash::ByteVectorHash() :
1012
m_k0(GetRand<uint64_t>()),
1113
m_k1(GetRand<uint64_t>())

src/util/bytevectorhash.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#ifndef BITCOIN_UTIL_BYTEVECTORHASH_H
66
#define BITCOIN_UTIL_BYTEVECTORHASH_H
77

8-
#include <stdint.h>
8+
#include <cstdint>
9+
#include <cstddef>
910
#include <vector>
1011

1112
/**

src/util/error.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
#include <util/error.h>
66

77
#include <tinyformat.h>
8-
#include <util/system.h>
98
#include <util/translation.h>
109

10+
#include <cassert>
11+
#include <string>
12+
1113
bilingual_str TransactionErrorString(const TransactionError err)
1214
{
1315
switch (err) {

src/util/hasher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <crypto/siphash.h>
56
#include <random.h>
7+
#include <span.h>
68
#include <util/hasher.h>
79

8-
#include <limits>
9-
1010
SaltedTxidHasher::SaltedTxidHasher() : k0(GetRand<uint64_t>()), k1(GetRand<uint64_t>()) {}
1111

1212
SaltedOutpointHasher::SaltedOutpointHasher() : k0(GetRand<uint64_t>()), k1(GetRand<uint64_t>()) {}

src/util/hasher.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
#ifndef BITCOIN_UTIL_HASHER_H
66
#define BITCOIN_UTIL_HASHER_H
77

8+
#include <crypto/common.h>
89
#include <crypto/siphash.h>
910
#include <primitives/transaction.h>
1011
#include <uint256.h>
1112

13+
#include <cstdint>
14+
#include <cstring>
15+
16+
template <typename C> class Span;
17+
1218
class SaltedTxidHasher
1319
{
1420
private:

src/util/message.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#include <hash.h> // For CHashWriter
7-
#include <key.h> // For CKey
8-
#include <key_io.h> // For DecodeDestination()
9-
#include <pubkey.h> // For CPubKey
10-
#include <script/standard.h> // For CTxDestination, IsValidDestination(), PKHash
11-
#include <serialize.h> // For SER_GETHASH
6+
#include <hash.h>
7+
#include <key.h>
8+
#include <key_io.h>
9+
#include <pubkey.h>
10+
#include <script/standard.h>
11+
#include <serialize.h>
12+
#include <uint256.h>
1213
#include <util/message.h>
13-
#include <util/strencodings.h> // For DecodeBase64()
14+
#include <util/strencodings.h>
1415

16+
#include <cassert>
17+
#include <optional>
1518
#include <string>
19+
#include <variant>
1620
#include <vector>
1721

1822
/**

0 commit comments

Comments
 (0)