mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-05 21:27:33 +02:00
ci, iwyu: Fix warnings in src/util and treat them as errors
This commit is contained in:
@@ -209,7 +209,7 @@ fi
|
||||
|
||||
if [[ "${RUN_IWYU}" == true ]]; then
|
||||
# TODO: Consider enforcing IWYU across the entire codebase.
|
||||
FILES_WITH_ENFORCED_IWYU="/src/(((crypto|index|kernel|primitives|univalue/(lib|test)|zmq)/.*|common/license_info|node/blockstorage|node/utxo_snapshot|clientversion|core_io|signet)\\.cpp)"
|
||||
FILES_WITH_ENFORCED_IWYU="/src/(((crypto|index|kernel|primitives|univalue/(lib|test)|util|zmq)/.*|common/license_info|node/blockstorage|node/utxo_snapshot|clientversion|core_io|signet)\\.cpp)"
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json"
|
||||
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json"
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <bench/bench.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <crypto/hex_base.h>
|
||||
#include <random.h>
|
||||
#include <span.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <crypto/siphash.h>
|
||||
#include <logging/categories.h> // IWYU pragma: export
|
||||
#include <span.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/log.h> // IWYU pragma: export
|
||||
#include <util/stdmutex.h>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define BITCOIN_UINT256_H
|
||||
|
||||
#include <crypto/common.h>
|
||||
#include <crypto/hex_base.h>
|
||||
#include <span.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/string.h>
|
||||
|
||||
@@ -4,20 +4,18 @@
|
||||
|
||||
#include <util/asmap.h>
|
||||
|
||||
#include <clientversion.h>
|
||||
#include <hash.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <uint256.h>
|
||||
#include <util/check.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/log.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <util/bip32.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
|
||||
bool ParseHDKeypath(const std::string& keypath_str, std::vector<uint32_t>& keypath)
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
// 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 <util/bytevectorhash.h>
|
||||
|
||||
#include <crypto/siphash.h>
|
||||
#include <random.h>
|
||||
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
ByteVectorHash::ByteVectorHash() :
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
#include <util/chaintype.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <util/check.h>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
enum class ChainType {
|
||||
MAIN,
|
||||
|
||||
@@ -8,11 +8,14 @@
|
||||
#include <attributes.h>
|
||||
|
||||
#include <atomic>
|
||||
// We use `util/check.h` to provide the `assert()` macro
|
||||
// to ensure that `NDEBUG` is not defined.
|
||||
#include <cassert> // IWYU pragma: export
|
||||
#include <source_location>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
constexpr bool G_FUZZING_BUILD{
|
||||
|
||||
@@ -5,12 +5,17 @@
|
||||
#include <util/exec.h>
|
||||
|
||||
#include <util/fs.h>
|
||||
#ifdef WIN32
|
||||
#include <util/subprocess.h>
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <system_error>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
#include <process.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <attributes.h>
|
||||
#include <util/check.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <util/feefrac.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include <util/check.h>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
|
||||
std::partial_ordering CompareChunks(std::span<const FeeFrac> chunks0, std::span<const FeeFrac> chunks1)
|
||||
{
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
#ifndef BITCOIN_UTIL_FEEFRAC_H
|
||||
#define BITCOIN_UTIL_FEEFRAC_H
|
||||
|
||||
#include <span.h>
|
||||
#include <util/check.h>
|
||||
#include <util/overflow.h>
|
||||
|
||||
#include <compare>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
|
||||
/** Data structure storing a fee and size, ordered by increasing fee/size.
|
||||
*
|
||||
|
||||
@@ -3,23 +3,21 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <util/fs.h>
|
||||
|
||||
#include <util/check.h>
|
||||
#include <util/syserror.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <limits>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <cerrno>
|
||||
#include <string>
|
||||
|
||||
namespace fsbridge {
|
||||
|
||||
FILE *fopen(const fs::path& p, const char *mode)
|
||||
|
||||
@@ -5,17 +5,18 @@
|
||||
#ifndef BITCOIN_UTIL_FS_H
|
||||
#define BITCOIN_UTIL_FS_H
|
||||
|
||||
#include <tinyformat.h>
|
||||
// IWYU incorrectly suggests removing this header.
|
||||
// See https://github.com/include-what-you-use/include-what-you-use/issues/1931.
|
||||
#include <tinyformat.h> // IWYU pragma: keep
|
||||
|
||||
#include <cstdio>
|
||||
// The `util/fs.h` header is designed to be a drop-in replacement for `filesystem`.
|
||||
#include <filesystem> // IWYU pragma: export
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#ifndef WIN32
|
||||
#include <fcntl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <iosfwd>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#ifdef __APPLE__
|
||||
enum class FSType {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <util/hasher.h>
|
||||
|
||||
#include <crypto/siphash.h>
|
||||
#include <random.h>
|
||||
#include <span.h>
|
||||
#include <util/hasher.h>
|
||||
|
||||
SaltedUint256Hasher::SaltedUint256Hasher() : m_hasher{
|
||||
FastRandomContext().rand64(),
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
#include <crypto/common.h>
|
||||
#include <crypto/siphash.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <span.h>
|
||||
#include <uint256.h>
|
||||
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <span>
|
||||
|
||||
class SaltedUint256Hasher
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef BITCOIN_UTIL_OBFUSCATION_H
|
||||
#define BITCOIN_UTIL_OBFUSCATION_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <crypto/hex_base.h>
|
||||
#include <span.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/strencodings.h>
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <ios>
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#ifndef BITCOIN_UTIL_OVERFLOW_H
|
||||
#define BITCOIN_UTIL_OVERFLOW_H
|
||||
|
||||
#include <cassert>
|
||||
#include <util/check.h>
|
||||
|
||||
#include <climits>
|
||||
#include <concepts>
|
||||
#include <limits>
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <primitives/transaction.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
bool SignalsOptInRBF(const CTransaction &tx)
|
||||
{
|
||||
for (const CTxIn &txin : tx.vin) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <util/fs.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace util {
|
||||
/**
|
||||
|
||||
@@ -4,18 +4,23 @@
|
||||
|
||||
#include <util/sock.h>
|
||||
|
||||
#include <common/system.h>
|
||||
#include <compat/compat.h>
|
||||
#include <span.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/check.h>
|
||||
#include <util/log.h>
|
||||
#include <util/syserror.h>
|
||||
#include <util/threadinterrupt.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <compare>
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifdef USE_POLL
|
||||
#include <poll.h>
|
||||
|
||||
@@ -6,15 +6,17 @@
|
||||
#define BITCOIN_UTIL_SOCK_H
|
||||
|
||||
#include <compat/compat.h>
|
||||
#include <util/threadinterrupt.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
class CThreadInterrupt;
|
||||
|
||||
/**
|
||||
* Maximum time to wait for I/O readiness.
|
||||
* It will take up until this time to break off in case of an interruption.
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
|
||||
#include <crypto/hex_base.h>
|
||||
#include <span.h>
|
||||
#include <util/check.h>
|
||||
#include <util/overflow.h>
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <compare>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
#ifndef BITCOIN_UTIL_STRENCODINGS_H
|
||||
#define BITCOIN_UTIL_STRENCODINGS_H
|
||||
|
||||
#include <crypto/hex_base.h>
|
||||
#include <span.h>
|
||||
#include <util/string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <charconv>
|
||||
@@ -21,6 +19,7 @@
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
|
||||
#include <util/string.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <regex>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace util {
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
#ifndef BITCOIN_UTIL_STRING_H
|
||||
#define BITCOIN_UTIL_STRING_H
|
||||
|
||||
#include <span.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <initializer_list>
|
||||
#include <locale>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -36,10 +36,10 @@ Documentation for C++ subprocessing library.
|
||||
#ifndef BITCOIN_UTIL_SUBPROCESS_H
|
||||
#define BITCOIN_UTIL_SUBPROCESS_H
|
||||
|
||||
#include <util/check.h>
|
||||
#include <util/syserror.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <csignal>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
#include <bitcoin-build-config.h> // IWYU pragma: keep
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <util/syserror.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
void util::TraceThread(std::string_view thread_name, std::function<void()> thread_func)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define BITCOIN_UTIL_THREAD_H
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace util {
|
||||
/**
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#define BITCOIN_UTIL_THREADINTERRUPT_H
|
||||
|
||||
#include <sync.h>
|
||||
#include <util/time.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,18 +2,17 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <util/threadnames.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
#include <util/threadnames.h>
|
||||
|
||||
#if __has_include(<sys/prctl.h>)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <util/time.h>
|
||||
|
||||
#include <compat/compat.h>
|
||||
#include <tinyformat.h>
|
||||
#include <util/check.h>
|
||||
#include <util/strencodings.h>
|
||||
@@ -13,11 +12,18 @@
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <compare>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
static constexpr std::array<std::string_view, 7> weekdays{"Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed"}; // 1970-01-01 was a Thursday.
|
||||
static constexpr std::array<std::string_view, 12> months{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
|
||||
|
||||
@@ -9,10 +9,17 @@
|
||||
// The `util/time.h` header is designed to be a drop-in replacement for `chrono`.
|
||||
#include <chrono> // IWYU pragma: export
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/// Version of the system clock that is mockable in the context of tests (via
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
// Copyright (c) 2021-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#include <util/tokenpipe.h>
|
||||
|
||||
#include <bitcoin-build-config.h> // IWYU pragma: keep
|
||||
|
||||
#include <util/tokenpipe.h>
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
#include <cerrno>
|
||||
#include <fcntl.h>
|
||||
#include <optional>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
TokenPipeEnd TokenPipe::TakeReadEnd()
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#define BITCOIN_UTIL_TRANSLATION_H
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <util/check.h>
|
||||
#include <util/string.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user