Skip to content

Commit dc90542

Browse files
committed
Merge bitcoin/bitcoin#30716: bench: [refactor] iwyu
fab0e83 bench: [refactor] iwyu (MarcoFalke) Pull request description: Missing includes are problematic, because: * Upcoming releases of a C++ standard library implementation often minimize their internal header dependencies. For example, `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` (https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html). This can lead to compile failures, which are easy to fix for developers, but may not be for users. For example, commit 138f867 had to add missing includes to accommodate GCC 15 (and the commit had to be backported). * A Bitcoin Core developer removing a feature from a module and wanting to drop the now unused includes may not be able to do so without touching other unrelated files, because those files rely on the transitive includes. Moreover, missing or extraneous includes are problematic, because they may be confusing the code reader as to what the real dependencies are. Finally, extraneous includes may slow down the build. Fix all issues in `bench`, by applying the rule include-what-you-use (iwyu). Follow-up pull requests will handle the other places. ACKs for top commit: hodlinator: ACK fab0e83 achow101: ACK fab0e83 TheCharlatan: ACK fab0e83 hebasto: ACK fab0e83. brunoerg: crACK fab0e83 stickies-v: ACK fab0e83 Tree-SHA512: f079c05d3ddebafabbd5a6c76d43d17337d1a962b97ba0ee27612f91c58491e7ce4e4229be54bd6e75a15512798c6f59925d0a076a37c050f8b9ef455ae5c9a2
2 parents 1248d0d + fab0e83 commit dc90542

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+331
-83
lines changed

src/bench/addrman.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44

55
#include <addrman.h>
66
#include <bench/bench.h>
7+
#include <compat/compat.h>
8+
#include <netaddress.h>
79
#include <netbase.h>
810
#include <netgroup.h>
11+
#include <protocol.h>
912
#include <random.h>
13+
#include <span.h>
14+
#include <uint256.h>
1015
#include <util/check.h>
1116
#include <util/time.h>
1217

18+
#include <cstring>
1319
#include <optional>
1420
#include <vector>
1521

src/bench/base58.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
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 <bench/bench.h>
6-
75
#include <base58.h>
6+
#include <bench/bench.h>
7+
#include <span.h>
88

99
#include <array>
10+
#include <cstring>
1011
#include <vector>
1112

1213

src/bench/bech32.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
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 <bench/bench.h>
6-
75
#include <bech32.h>
6+
#include <bench/bench.h>
87
#include <util/strencodings.h>
98

10-
#include <string>
119
#include <vector>
1210

1311

src/bench/bench.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@
44

55
#include <bench/bench.h>
66

7-
#include <test/util/setup_common.h>
7+
#include <test/util/setup_common.h> // IWYU pragma: keep
8+
#include <tinyformat.h>
89
#include <util/fs.h>
910
#include <util/string.h>
1011

1112
#include <chrono>
13+
#include <compare>
1214
#include <fstream>
1315
#include <functional>
1416
#include <iostream>
1517
#include <map>
18+
#include <ratio>
1619
#include <regex>
20+
#include <set>
21+
#include <stdexcept>
1722
#include <string>
1823
#include <vector>
1924

src/bench/bench.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
#ifndef BITCOIN_BENCH_BENCH_H
66
#define BITCOIN_BENCH_BENCH_H
77

8+
#include <bench/nanobench.h> // IWYU pragma: export
89
#include <util/fs.h>
910
#include <util/macros.h>
1011

1112
#include <chrono>
13+
#include <cstdint>
1214
#include <functional>
1315
#include <map>
1416
#include <string>
17+
#include <utility>
1518
#include <vector>
1619

17-
#include <bench/nanobench.h> // IWYU pragma: export
18-
1920
/*
2021
* Usage:
2122

src/bench/bench_bitcoin.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <bench/bench.h>
6-
7-
#include <clientversion.h>
86
#include <common/args.h>
97
#include <crypto/sha256.h>
8+
#include <tinyformat.h>
109
#include <util/fs.h>
11-
#include <util/strencodings.h>
10+
#include <util/string.h>
1211

1312
#include <chrono>
1413
#include <cstdint>
14+
#include <cstdlib>
15+
#include <exception>
1516
#include <iostream>
1617
#include <sstream>
1718
#include <vector>

src/bench/bip324_ecdh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <bench/bench.h>
6-
76
#include <key.h>
87
#include <pubkey.h>
98
#include <random.h>
109
#include <span.h>
1110

11+
#include <algorithm>
1212
#include <array>
1313
#include <cstddef>
1414

src/bench/block_assemble.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <bench/bench.h>
6-
#include <consensus/validation.h>
7-
#include <crypto/sha256.h>
6+
#include <consensus/consensus.h>
87
#include <node/miner.h>
8+
#include <primitives/transaction.h>
99
#include <random.h>
10+
#include <script/script.h>
11+
#include <sync.h>
1012
#include <test/util/mining.h>
1113
#include <test/util/script.h>
1214
#include <test/util/setup_common.h>
13-
#include <txmempool.h>
1415
#include <validation.h>
1516

16-
17+
#include <array>
18+
#include <cassert>
19+
#include <cstddef>
20+
#include <memory>
1721
#include <vector>
1822

1923
static void AssembleBlock(benchmark::Bench& bench)

src/bench/ccoins_caching.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44

55
#include <bench/bench.h>
66
#include <coins.h>
7+
#include <consensus/amount.h>
8+
#include <key.h>
79
#include <policy/policy.h>
10+
#include <primitives/transaction.h>
11+
#include <script/script.h>
812
#include <script/signingprovider.h>
913
#include <test/util/transaction_utils.h>
1014

15+
#include <cassert>
1116
#include <vector>
1217

1318
// Microbenchmark for simple accesses to a CCoinsViewCache database. Note from

src/bench/chacha20.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include <bench/bench.h>
77
#include <crypto/chacha20.h>
88
#include <crypto/chacha20poly1305.h>
9+
#include <span.h>
10+
11+
#include <cstddef>
12+
#include <cstdint>
13+
#include <vector>
914

1015
/* Number of bytes to process per iteration */
1116
static const uint64_t BUFFER_SIZE_TINY = 64;

0 commit comments

Comments
 (0)