mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin/bitcoin#25324: refactor: add most of src/util to iwyu
07f2c25d04
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: ACK07f2c25d04
, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 07d76435c2bff1a62c4967eb0efaafe619cc3bbaf4166741d8520927b24336c01aee59822f8082ee2a01e15046a0f5d506b4b23a6e40ceb750f3226ed8167847
This commit is contained in:
commit
1d89fc695a
25 changed files with 83 additions and 30 deletions
|
@ -47,6 +47,18 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
|||
" src/rpc/fees.cpp"\
|
||||
" src/rpc/signmessage.cpp"\
|
||||
" src/test/fuzz/txorphan.cpp"\
|
||||
" src/util/bip32.cpp"\
|
||||
" src/util/bytevectorhash.cpp"\
|
||||
" src/util/error.cpp"\
|
||||
" src/util/getuniquepath.cpp"\
|
||||
" src/util/hasher.cpp"\
|
||||
" src/util/message.cpp"\
|
||||
" src/util/moneystr.cpp"\
|
||||
" src/util/serfloat.cpp"\
|
||||
" src/util/spanparsing.cpp"\
|
||||
" src/util/strencodings.cpp"\
|
||||
" src/util/syserror.cpp"\
|
||||
" src/util/url.cpp"\
|
||||
" -p . ${MAKEJOBS} -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp"
|
||||
fi
|
||||
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
#include <crypto/common.h>
|
||||
#include <fs.h>
|
||||
#include <logging.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <map>
|
||||
#include <cstdio>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/bip32.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef BITCOIN_UTIL_BIP32_H
|
||||
#define BITCOIN_UTIL_BIP32_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <random.h>
|
||||
#include <util/bytevectorhash.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
ByteVectorHash::ByteVectorHash() :
|
||||
m_k0(GetRand<uint64_t>()),
|
||||
m_k1(GetRand<uint64_t>())
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#ifndef BITCOIN_UTIL_BYTEVECTORHASH_H
|
||||
#define BITCOIN_UTIL_BYTEVECTORHASH_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#include <util/error.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
bilingual_str TransactionErrorString(const TransactionError err)
|
||||
{
|
||||
switch (err) {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <crypto/siphash.h>
|
||||
#include <random.h>
|
||||
#include <span.h>
|
||||
#include <util/hasher.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
SaltedTxidHasher::SaltedTxidHasher() : k0(GetRand<uint64_t>()), k1(GetRand<uint64_t>()) {}
|
||||
|
||||
SaltedOutpointHasher::SaltedOutpointHasher() : k0(GetRand<uint64_t>()), k1(GetRand<uint64_t>()) {}
|
||||
|
|
|
@ -5,10 +5,16 @@
|
|||
#ifndef BITCOIN_UTIL_HASHER_H
|
||||
#define BITCOIN_UTIL_HASHER_H
|
||||
|
||||
#include <crypto/common.h>
|
||||
#include <crypto/siphash.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
template <typename C> class Span;
|
||||
|
||||
class SaltedTxidHasher
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -3,16 +3,20 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <hash.h> // For CHashWriter
|
||||
#include <key.h> // For CKey
|
||||
#include <key_io.h> // For DecodeDestination()
|
||||
#include <pubkey.h> // For CPubKey
|
||||
#include <script/standard.h> // For CTxDestination, IsValidDestination(), PKHash
|
||||
#include <serialize.h> // For SER_GETHASH
|
||||
#include <hash.h>
|
||||
#include <key.h>
|
||||
#include <key_io.h>
|
||||
#include <pubkey.h>
|
||||
#include <script/standard.h>
|
||||
#include <serialize.h>
|
||||
#include <uint256.h>
|
||||
#include <util/message.h>
|
||||
#include <util/strencodings.h> // For DecodeBase64()
|
||||
#include <util/strencodings.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
#ifndef BITCOIN_UTIL_MESSAGE_H
|
||||
#define BITCOIN_UTIL_MESSAGE_H
|
||||
|
||||
#include <key.h> // For CKey
|
||||
#include <uint256.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
class CKey;
|
||||
|
||||
extern const std::string MESSAGE_MAGIC;
|
||||
|
||||
/** The result of a signed message verification.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <util/strencodings.h>
|
||||
#include <util/string.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
||||
std::string FormatMoney(const CAmount n)
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
|
||||
#include <fs.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef BITCOIN_UTIL_SERFLOAT_H
|
||||
#define BITCOIN_UTIL_SERFLOAT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
/* Encode a double using the IEEE 754 binary64 format. All NaNs are encoded as x86/ARM's
|
||||
* positive quiet NaN with payload 0. */
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
#include <span.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace spanparsing {
|
||||
|
||||
|
|
|
@ -3,17 +3,18 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <span.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/string.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
static const std::string CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
|
|
|
@ -13,11 +13,14 @@
|
|||
#include <util/string.h>
|
||||
|
||||
#include <charconv>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
/** Used by SanitizeString() */
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute)
|
||||
{
|
||||
boost::replace_all(in_out, search, substitute);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <util/syserror.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
std::string SysErrorString(int err)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <util/threadnames.h>
|
||||
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
|
||||
void util::TraceThread(const char* thread_name, std::function<void()> thread_func)
|
||||
{
|
||||
|
|
|
@ -8,16 +8,19 @@
|
|||
#endif
|
||||
|
||||
#include <compat.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <util/check.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <ctime>
|
||||
#include <thread>
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <locale>
|
||||
#include <thread>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); }
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <compat.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#define BITCOIN_UTIL_TRANSLATION_H
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* Bilingual messages:
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#include <util/url.h>
|
||||
|
||||
#include <event2/http.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
std::string urlDecode(const std::string &urlEncoded) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
/** Construct a vector with the specified elements.
|
||||
|
|
Loading…
Add table
Reference in a new issue