clang-tidy: Apply modernize-deprecated-headers #32673

pull maflcko wants to merge 3 commits into bitcoin:master from maflcko:2506-cxx-headers-tidy changing 87 files +178 −173
  1. maflcko commented at 1:23 PM on June 3, 2025: member

    Bitcoin Core is written in C++, so it is confusing to sometimes use the deprecated C headers (with the .h extension). For example, it is less clear whether string.h refers to the file in this repo or the cstring stdlib header (https://github.com/bitcoin/bitcoin/pull/31308#discussion_r2121492797).

    The check is currently disabled for headers, to exclude subtree headers.

  2. clang-tidy: Apply modernize-deprecated-headers
    This can be reproduced according to the developer notes with something
    like
    
    ( cd ./src/ && ../contrib/devtools/run-clang-tidy.py -p ../bld-cmake -fix -j $(nproc) )
    
    Also, the header related changes were done manually.
    fae71d30f7
  3. scripted-diff: Bump copyright headers after include changes
    Historically, the headers have been bumped some time after a file has
    been touched. Do it now to avoid having to touch them again in the
    future for that reason.
    
    -BEGIN VERIFY SCRIPT-
     sed -i --regexp-extended 's;( 20[0-2][0-9])(-20[0-2][0-9])? The Bitcoin Core developers;\1-present The Bitcoin Core developers;g' $( git show --pretty="" --name-only HEAD~0 )
    -END VERIFY SCRIPT-
    facb152697
  4. DrahtBot commented at 1:23 PM on June 3, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK l0rinc, janb84, stickies-v, achow101

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #32729 (test,refactor: extract script template helpers & widen sigop count coverage by l0rinc)
    • #32317 (kernel: Separate UTXO set access from validation functions by TheCharlatan)
    • #31308 (ci, iwyu: Treat warnings as errors for specific directories by hebasto)
    • #29770 (index: Check all necessary block data is available before starting to sync by fjahr)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot renamed this:
    clang-tidy: Apply modernize-deprecated-headers
    clang-tidy: Apply modernize-deprecated-headers
    on Jun 3, 2025
  6. in src/bench/parse_hex.cpp:7 in facb152697 outdated
       3 | @@ -4,7 +4,7 @@
       4 |  
       5 |  #include <bench/bench.h>
       6 |  #include <random.h>
       7 | -#include <stddef.h>
       8 | +#include <cstddef>
    


    l0rinc commented at 3:09 PM on June 3, 2025:

    should we re-sort these after the change?


    maflcko commented at 6:02 PM on June 3, 2025:

    thx, pushed a commit

  7. in src/test/fuzz/addrman.cpp:17 in facb152697 outdated
      13 | @@ -14,7 +14,7 @@
      14 |  #include <test/fuzz/util.h>
      15 |  #include <test/fuzz/util/net.h>
      16 |  #include <test/util/setup_common.h>
      17 | -#include <time.h>
      18 | +#include <ctime>
    


    l0rinc commented at 3:12 PM on June 3, 2025:

    this should likely go the the bottom include stack now, right?


    maflcko commented at 6:03 PM on June 3, 2025:

    thx, sorted

  8. in src/bech32.h:17 in facb152697 outdated
      13 | @@ -14,7 +14,7 @@
      14 |  #ifndef BITCOIN_BECH32_H
      15 |  #define BITCOIN_BECH32_H
      16 |  
      17 | -#include <stdint.h>
      18 | +#include <cstdint>
    


    l0rinc commented at 3:14 PM on June 3, 2025:

    looks to me like we might as well remove this


    maflcko commented at 5:45 PM on June 3, 2025:

    It is needed, see:

    [09:40:31.692] The full include-list for /ci_container_base/src/bech32.h: [09:40:31.692] #include <cstdint> // for uint8_t

  9. in src/txgraph.h:8 in facb152697 outdated
       4 | @@ -5,7 +5,7 @@
       5 |  #include <compare>
       6 |  #include <memory>
       7 |  #include <optional>
       8 | -#include <stdint.h>
       9 | +#include <cstdint>
    


    l0rinc commented at 3:24 PM on June 3, 2025:

    Q: is there any reason the header include guard is after the includes here?


    maflcko commented at 6:02 PM on June 3, 2025:

    there are several, so maybe a separate pull request or linter could be added for this? Although, I don't see a risk here.

    src/base58.h:14:#ifndef BITCOIN_BASE58_H
    src/bech32.h:14:#ifndef BITCOIN_BECH32_H
    src/common/messages.h:11:#ifndef BITCOIN_COMMON_MESSAGES_H
    src/common/types.h:13:#ifndef BITCOIN_COMMON_TYPES_H
    src/net_permissions.h:12:#ifndef BITCOIN_NET_PERMISSIONS_H
    src/node/types.h:13:#ifndef BITCOIN_NODE_TYPES_H
    src/txgraph.h:14:#ifndef BITCOIN_TXGRAPH_H
    src/wallet/types.h:14:#ifndef BITCOIN_WALLET_TYPES_H
    ...
    
  10. l0rinc approved
  11. l0rinc commented at 3:35 PM on June 3, 2025: contributor

    ACK facb152697b8d7b75a9e6108f8896f774b06b35f

    I like that it's more consistent now, thanks for fixing it. Since a few header names have changed now, the only suggestion I have is to keep the simplest ordering that would minimize merge and review conflicts in the future, e.g. a new commit on top with alphabetical sorting (or removal) where we also usually separate internal and external dependencies:

    <details> <summary>Suggested sorting</summary>

    diff --git a/src/bech32.h b/src/bech32.h
    index ba4c79bb86..473d7702b5 100644
    --- a/src/bech32.h
    +++ b/src/bech32.h
    @@ -14,7 +14,6 @@
     #ifndef BITCOIN_BECH32_H
     #define BITCOIN_BECH32_H
     
    -#include <cstdint>
     #include <string>
     #include <vector>
     
    diff --git a/src/bench/parse_hex.cpp b/src/bench/parse_hex.cpp
    index c20e9546c3..a57323ceea 100644
    --- a/src/bench/parse_hex.cpp
    +++ b/src/bench/parse_hex.cpp
    @@ -3,12 +3,11 @@
     // file COPYING or http://www.opensource.org/licenses/mit-license.php.
     
     #include <bench/bench.h>
    -#include <random.h>
    -#include <cstddef>
    -#include <util/strencodings.h>
     #include <cassert>
    +#include <cstddef>
     #include <optional>
    -#include <vector>
    +#include <random.h>
    +#include <util/strencodings.h>
     
     std::string generateHexString(size_t length) {
         const auto hex_digits = "0123456789ABCDEF";
    diff --git a/src/bip324.cpp b/src/bip324.cpp
    index bb1fae5dee..9c5a1572bb 100644
    --- a/src/bip324.cpp
    +++ b/src/bip324.cpp
    @@ -17,8 +17,8 @@
     
     #include <algorithm>
     #include <cassert>
    -#include <cstdint>
     #include <cstddef>
    +#include <cstdint>
     #include <iterator>
     #include <string>
     
    diff --git a/src/cluster_linearize.h b/src/cluster_linearize.h
    index 2a3c649576..17b7e6b27a 100644
    --- a/src/cluster_linearize.h
    +++ b/src/cluster_linearize.h
    @@ -6,11 +6,11 @@
     #define BITCOIN_CLUSTER_LINEARIZE_H
     
     #include <algorithm>
    +#include <cstdint>
     #include <numeric>
     #include <optional>
    -#include <cstdint>
    -#include <vector>
     #include <utility>
    +#include <vector>
     
     #include <random.h>
     #include <span.h>
    diff --git a/src/coins.h b/src/coins.h
    index 6725d5a51f..f9755c846f 100644
    --- a/src/coins.h
    +++ b/src/coins.h
    @@ -18,7 +18,6 @@
     
     #include <cassert>
     #include <cstdint>
    -
     #include <functional>
     #include <unordered_map>
     
    diff --git a/src/common/args.h b/src/common/args.h
    index c35e2cb88a..6c5ac48ae3 100644
    --- a/src/common/args.h
    +++ b/src/common/args.h
    @@ -11,12 +11,12 @@
     #include <util/chaintype.h>
     #include <util/fs.h>
     
    +#include <cstdint>
     #include <iosfwd>
     #include <list>
     #include <map>
     #include <optional>
     #include <set>
    -#include <cstdint>
     #include <string>
     #include <variant>
     #include <vector>
    diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h
    index 1e5a6bc4c3..71b5fe2468 100644
    --- a/src/consensus/consensus.h
    +++ b/src/consensus/consensus.h
    @@ -6,8 +6,8 @@
     #ifndef BITCOIN_CONSENSUS_CONSENSUS_H
     #define BITCOIN_CONSENSUS_CONSENSUS_H
     
    -#include <cstdlib>
     #include <cstdint>
    +#include <cstdlib>
     
     /** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */
     static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 4000000;
    diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h
    index 8b7e6d6b38..27099a2aae 100644
    --- a/src/consensus/tx_verify.h
    +++ b/src/consensus/tx_verify.h
    @@ -7,7 +7,6 @@
     
     #include <consensus/amount.h>
     
    -#include <cstdint>
     #include <vector>
     
     class CBlockIndex;
    diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h
    index 223b317f35..6653c2c973 100644
    --- a/src/crypto/chacha20.h
    +++ b/src/crypto/chacha20.h
    @@ -9,8 +9,8 @@
     
     #include <array>
     #include <cstddef>
    -#include <cstdlib>
     #include <cstdint>
    +#include <cstdlib>
     #include <utility>
     
     // classes for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
    diff --git a/src/crypto/chacha20poly1305.h b/src/crypto/chacha20poly1305.h
    index a6c3a668cf..0512dbd665 100644
    --- a/src/crypto/chacha20poly1305.h
    +++ b/src/crypto/chacha20poly1305.h
    @@ -6,7 +6,6 @@
     #define BITCOIN_CRYPTO_CHACHA20POLY1305_H
     
     #include <cstddef>
    -#include <cstdint>
     
     #include <crypto/chacha20.h>
     #include <crypto/poly1305.h>
    diff --git a/src/crypto/hkdf_sha256_32.cpp b/src/crypto/hkdf_sha256_32.cpp
    index e62249446a..22d245326d 100644
    --- a/src/crypto/hkdf_sha256_32.cpp
    +++ b/src/crypto/hkdf_sha256_32.cpp
    @@ -5,7 +5,6 @@
     #include <crypto/hkdf_sha256_32.h>
     
     #include <cassert>
    -#include <cstring>
     
     CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const unsigned char* ikm, size_t ikmlen, const std::string& salt)
     {
    diff --git a/src/crypto/hkdf_sha256_32.h b/src/crypto/hkdf_sha256_32.h
    index 3010e678a4..415940ebd0 100644
    --- a/src/crypto/hkdf_sha256_32.h
    +++ b/src/crypto/hkdf_sha256_32.h
    @@ -7,9 +7,6 @@
     
     #include <crypto/hmac_sha256.h>
     
    -#include <cstdlib>
    -#include <cstdint>
    -
     /** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
     class CHKDF_HMAC_SHA256_L32
     {
    diff --git a/src/crypto/hmac_sha256.h b/src/crypto/hmac_sha256.h
    index 2f72970014..6b2b9364de 100644
    --- a/src/crypto/hmac_sha256.h
    +++ b/src/crypto/hmac_sha256.h
    @@ -7,9 +7,6 @@
     
     #include <crypto/sha256.h>
     
    -#include <cstdlib>
    -#include <cstdint>
    -
     /** A hasher class for HMAC-SHA-256. */
     class CHMAC_SHA256
     {
    diff --git a/src/crypto/hmac_sha512.h b/src/crypto/hmac_sha512.h
    index a25da385f4..babfbd7a3b 100644
    --- a/src/crypto/hmac_sha512.h
    +++ b/src/crypto/hmac_sha512.h
    @@ -7,9 +7,6 @@
     
     #include <crypto/sha512.h>
     
    -#include <cstdlib>
    -#include <cstdint>
    -
     /** A hasher class for HMAC-SHA-512. */
     class CHMAC_SHA512
     {
    diff --git a/src/crypto/muhash.h b/src/crypto/muhash.h
    index f340937323..aed63572b1 100644
    --- a/src/crypto/muhash.h
    +++ b/src/crypto/muhash.h
    @@ -8,8 +8,6 @@
     #include <serialize.h>
     #include <uint256.h>
     
    -#include <cstdint>
    -
     class Num3072
     {
     private:
    diff --git a/src/crypto/poly1305.h b/src/crypto/poly1305.h
    index 1b7e355fee..9944befd4a 100644
    --- a/src/crypto/poly1305.h
    +++ b/src/crypto/poly1305.h
    @@ -8,7 +8,6 @@
     #include <span.h>
     
     #include <cassert>
    -#include <cstdlib>
     #include <cstdint>
     
     #define POLY1305_BLOCK_SIZE 16
    diff --git a/src/crypto/sha1.h b/src/crypto/sha1.h
    index a22b65344e..f2f0fccf17 100644
    --- a/src/crypto/sha1.h
    +++ b/src/crypto/sha1.h
    @@ -6,7 +6,6 @@
     #define BITCOIN_CRYPTO_SHA1_H
     
     #include <cstdlib>
    -#include <cstdint>
     
     /** A hasher class for SHA1. */
     class CSHA1
    diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h
    index 460557686c..2ed98a8d5c 100644
    --- a/src/crypto/sha256.h
    +++ b/src/crypto/sha256.h
    @@ -5,8 +5,6 @@
     #ifndef BITCOIN_CRYPTO_SHA256_H
     #define BITCOIN_CRYPTO_SHA256_H
     
    -#include <cstdlib>
    -#include <cstdint>
     #include <string>
     
     /** A hasher class for SHA-256. */
    diff --git a/src/crypto/sha256_sse4.cpp b/src/crypto/sha256_sse4.cpp
    index 683d44b6b0..8c96e58312 100644
    --- a/src/crypto/sha256_sse4.cpp
    +++ b/src/crypto/sha256_sse4.cpp
    @@ -5,9 +5,6 @@
     // This is a translation to GCC extended asm syntax from YASM code by Intel
     // (available at the bottom of this file).
     
    -#include <cstdlib>
    -#include <cstdint>
    -
     #if defined(__x86_64__) || defined(__amd64__)
     
     namespace sha256_sse4
    @@ -969,27 +966,27 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
     
     /*
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    -; Copyright (c) 2012, Intel Corporation 
    -; 
    -; All rights reserved. 
    -; 
    +; Copyright (c) 2012, Intel Corporation
    +;
    +; All rights reserved.
    +;
     ; Redistribution and use in source and binary forms, with or without
     ; modification, are permitted provided that the following conditions are
    -; met: 
    -; 
    +; met:
    +;
     ; * Redistributions of source code must retain the above copyright
    -;   notice, this list of conditions and the following disclaimer.  
    -; 
    +;   notice, this list of conditions and the following disclaimer.
    +;
     ; * Redistributions in binary form must reproduce the above copyright
     ;   notice, this list of conditions and the following disclaimer in the
     ;   documentation and/or other materials provided with the
    -;   distribution. 
    -; 
    +;   distribution.
    +;
     ; * Neither the name of the Intel Corporation nor the names of its
     ;   contributors may be used to endorse or promote products derived from
    -;   this software without specific prior written permission. 
    -; 
    -; 
    +;   this software without specific prior written permission.
    +;
    +;
     ; THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY
     ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    @@ -1020,7 +1017,7 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
     ; This code schedules 1 blocks at a time, with 4 lanes per block
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    -%defineMOVDQ movdqu ;; assume buffers not aligned 
    +%defineMOVDQ movdqu ;; assume buffers not aligned
     
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Define Macros
     
    @@ -1057,7 +1054,7 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
     %define SHUF_00BAxmm10 ; shuffle xBxA -> 00BA
     %define SHUF_DC00xmm11 ; shuffle xDxC -> DC00
     %define BYTE_FLIP_MASKxmm12
    -    
    +
     %ifdef LINUX
     %define NUM_BLKS rdx; 3rd arg
     %define CTXrsi; 2nd arg
    @@ -1073,10 +1070,10 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
     %define INPrcx 	; 1st arg
     
     %define SRNDrcx; clobbers INP
    -%define c 	edi 
    -%define desi 
    +%define c 	edi
    +%define desi
     %define e 	r8d
    -    
    +
     %endif
     %define TBLrbp
     %define a eax
    @@ -1356,10 +1353,10 @@ sha256_sse4:
     
         subrsp,STACK_SIZE
     %ifndef LINUX
    -    movdqa[rsp + _XMM_SAVE + 0*16],xmm6
    +    movdqa[rsp + _XMM_SAVE + 0*16],xmm6
         movdqa[rsp + _XMM_SAVE + 1*16],xmm7
    -    movdqa[rsp + _XMM_SAVE + 2*16],xmm8
    -    movdqa[rsp + _XMM_SAVE + 3*16],xmm9
    +    movdqa[rsp + _XMM_SAVE + 2*16],xmm8
    +    movdqa[rsp + _XMM_SAVE + 3*16],xmm9
         movdqa[rsp + _XMM_SAVE + 4*16],xmm10
         movdqa[rsp + _XMM_SAVE + 5*16],xmm11
         movdqa[rsp + _XMM_SAVE + 6*16],xmm12
    @@ -1392,7 +1389,7 @@ loop0:
         COPY_XMM_AND_BSWAPX1, [INP + 1*16], BYTE_FLIP_MASK
         COPY_XMM_AND_BSWAPX2, [INP + 2*16], BYTE_FLIP_MASK
         COPY_XMM_AND_BSWAPX3, [INP + 3*16], BYTE_FLIP_MASK
    -    
    +
         mov[rsp + _INP], INP
     
         ;; schedule 48 input dwords, by doing 3 rounds of 16 each
    @@ -1482,8 +1479,8 @@ done_hash:
     %endif
         poprbx
     
    -    ret
    -    
    +    ret
    +
     
     section .data
     align 64
    diff --git a/src/crypto/sha3.h b/src/crypto/sha3.h
    index 6d114379f3..4def57d65c 100644
    --- a/src/crypto/sha3.h
    +++ b/src/crypto/sha3.h
    @@ -7,7 +7,6 @@
     
     #include <span.h>
     
    -#include <cstdlib>
     #include <cstdint>
     
     //! The Keccak-f[1600] transform.
    diff --git a/src/crypto/sha512.h b/src/crypto/sha512.h
    index 665c8b886e..102fa02a8c 100644
    --- a/src/crypto/sha512.h
    +++ b/src/crypto/sha512.h
    @@ -5,8 +5,8 @@
     #ifndef BITCOIN_CRYPTO_SHA512_H
     #define BITCOIN_CRYPTO_SHA512_H
     
    -#include <cstdlib>
     #include <cstdint>
    +#include <cstdlib>
     
     /** A hasher class for SHA-512. */
     class CSHA512
    diff --git a/src/crypto/siphash.h b/src/crypto/siphash.h
    index 4c6a39e0b6..39cddf8c8f 100644
    --- a/src/crypto/siphash.h
    +++ b/src/crypto/siphash.h
    @@ -5,8 +5,6 @@
     #ifndef BITCOIN_CRYPTO_SIPHASH_H
     #define BITCOIN_CRYPTO_SIPHASH_H
     
    -#include <cstdint>
    -
     #include <span.h>
     #include <uint256.h>
     
    diff --git a/src/interfaces/node.h b/src/interfaces/node.h
    index 2ab9f84e73..e0299047f7 100644
    --- a/src/interfaces/node.h
    +++ b/src/interfaces/node.h
    @@ -17,8 +17,6 @@
     
     #include <functional>
     #include <memory>
    -#include <cstddef>
    -#include <cstdint>
     #include <string>
     #include <tuple>
     #include <vector>
    diff --git a/src/kernel/disconnected_transactions.cpp b/src/kernel/disconnected_transactions.cpp
    index 9667642a03..3774043a43 100644
    --- a/src/kernel/disconnected_transactions.cpp
    +++ b/src/kernel/disconnected_transactions.cpp
    @@ -4,12 +4,12 @@
     
     #include <kernel/disconnected_transactions.h>
     
    -#include <cassert>
     #include <core_memusage.h>
     #include <memusage.h>
     #include <primitives/transaction.h>
     #include <util/hasher.h>
     
    +#include <cassert>
     #include <memory>
     #include <utility>
     
    diff --git a/src/kernel/mempool_entry.h b/src/kernel/mempool_entry.h
    index 531ccb76b6..73439e1944 100644
    --- a/src/kernel/mempool_entry.h
    +++ b/src/kernel/mempool_entry.h
    @@ -18,7 +18,6 @@
     #include <functional>
     #include <memory>
     #include <set>
    -#include <cstddef>
     #include <cstdint>
     
     class CBlockIndex;
    diff --git a/src/node/connection_types.h b/src/node/connection_types.h
    index 08f0882499..4bb2049a78 100644
    --- a/src/node/connection_types.h
    +++ b/src/node/connection_types.h
    @@ -6,7 +6,6 @@
     #define BITCOIN_NODE_CONNECTION_TYPES_H
     
     #include <string>
    -#include <cstdint>
     
     /** Different types of connections to a peer. This enum encapsulates the
      * information we have available at the time of opening or accepting the
    diff --git a/src/node/miner.h b/src/node/miner.h
    index 047413534b..7f4f999f56 100644
    --- a/src/node/miner.h
    +++ b/src/node/miner.h
    @@ -14,8 +14,8 @@
     #include <util/feefrac.h>
     
     #include <memory>
    -#include <optional>
     #include <cstdint>
    +#include <optional>
     
     #include <boost/multi_index/identity.hpp>
     #include <boost/multi_index/indexed_by.hpp>
    diff --git a/src/node/mini_miner.h b/src/node/mini_miner.h
    index 07e6239c37..fad70f6551 100644
    --- a/src/node/mini_miner.h
    +++ b/src/node/mini_miner.h
    @@ -13,7 +13,6 @@
     #include <memory>
     #include <optional>
     #include <set>
    -#include <cstdint>
     #include <vector>
     
     class CFeeRate;
    diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
    index dda26fa059..d06e5b9929 100644
    --- a/src/qt/clientmodel.cpp
    +++ b/src/qt/clientmodel.cpp
    @@ -23,8 +23,6 @@
     #include <util/time.h>
     #include <validation.h>
     
    -#include <cstdint>
    -
     #include <QDebug>
     #include <QMetaObject>
     #include <QThread>
    diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
    index db3c7f7417..b8f834a2ee 100644
    --- a/src/qt/transactiondesc.cpp
    +++ b/src/qt/transactiondesc.cpp
    @@ -19,7 +19,6 @@
     #include <validation.h>
     #include <wallet/types.h>
     
    -#include <cstdint>
     #include <string>
     
     #include <QLatin1String>
    diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
    index dd70c499fd..aaf11da79c 100644
    --- a/src/rpc/blockchain.cpp
    +++ b/src/rpc/blockchain.cpp
    @@ -52,9 +52,8 @@
     #include <validationinterface.h>
     #include <versionbits.h>
     
    -#include <cstdint>
    -
     #include <condition_variable>
    +#include <cstdint>
     #include <iterator>
     #include <memory>
     #include <mutex>
    diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp
    index 4c2b03bad0..a287c33603 100644
    --- a/src/rpc/client.cpp
    +++ b/src/rpc/client.cpp
    @@ -8,7 +8,6 @@
     #include <tinyformat.h>
     
     #include <set>
    -#include <cstdint>
     #include <string>
     #include <string_view>
     
    diff --git a/src/rpc/server.h b/src/rpc/server.h
    index ba9e4d7d7c..d4b48f2418 100644
    --- a/src/rpc/server.h
    +++ b/src/rpc/server.h
    @@ -9,9 +9,9 @@
     #include <rpc/request.h>
     #include <rpc/util.h>
     
    +#include <cstdint>
     #include <functional>
     #include <map>
    -#include <cstdint>
     #include <string>
     
     #include <univalue.h>
    diff --git a/src/streams.h b/src/streams.h
    index 0b3b939fab..10f99d2857 100644
    --- a/src/streams.h
    +++ b/src/streams.h
    @@ -14,12 +14,10 @@
     #include <algorithm>
     #include <cassert>
     #include <cstddef>
    -#include <cstdio>
    +#include <cstring>
     #include <ios>
     #include <limits>
     #include <optional>
    -#include <cstdint>
    -#include <cstring>
     #include <string>
     #include <utility>
     #include <vector>
    diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp
    index 962192cefd..a13945a520 100644
    --- a/src/test/fuzz/addrman.cpp
    +++ b/src/test/fuzz/addrman.cpp
    @@ -14,12 +14,12 @@
     #include <test/fuzz/util.h>
     #include <test/fuzz/util/net.h>
     #include <test/util/setup_common.h>
    -#include <ctime>
     #include <util/asmap.h>
     #include <util/chaintype.h>
     
     #include <cassert>
     #include <cstdint>
    +#include <ctime>
     #include <optional>
     #include <string>
     #include <vector>
    diff --git a/src/test/fuzz/asmap_direct.cpp b/src/test/fuzz/asmap_direct.cpp
    index 1d693e5ecf..d3c0c3b9ea 100644
    --- a/src/test/fuzz/asmap_direct.cpp
    +++ b/src/test/fuzz/asmap_direct.cpp
    @@ -6,12 +6,11 @@
     #include <util/asmap.h>
     #include <test/fuzz/fuzz.h>
     
    +#include <cassert>
     #include <cstdint>
     #include <optional>
     #include <vector>
     
    -#include <cassert>
    -
     FUZZ_TARGET(asmap_direct)
     {
         // Encoding: [asmap using 1 bit / byte] 0xFF [addr using 1 bit / byte]
    diff --git a/src/test/fuzz/coinscache_sim.cpp b/src/test/fuzz/coinscache_sim.cpp
    index 91b98292fe..46128b2c34 100644
    --- a/src/test/fuzz/coinscache_sim.cpp
    +++ b/src/test/fuzz/coinscache_sim.cpp
    @@ -10,9 +10,9 @@
     #include <test/fuzz/util.h>
     
     #include <cassert>
    -#include <optional>
    -#include <memory>
     #include <cstdint>
    +#include <memory>
    +#include <optional>
     #include <vector>
     
     namespace {
    diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp
    index 5a09963e2c..05ca62b6fd 100644
    --- a/src/test/fuzz/deserialize.cpp
    +++ b/src/test/fuzz/deserialize.cpp
    @@ -29,10 +29,10 @@
     #include <test/util/setup_common.h>
     #include <undo.h>
     
    +#include <cstdint>
     #include <exception>
     #include <optional>
     #include <stdexcept>
    -#include <cstdint>
     
     using node::SnapshotMetadata;
     
    diff --git a/src/test/fuzz/feeratediagram.cpp b/src/test/fuzz/feeratediagram.cpp
    index 6dcc63e91e..d978794a79 100644
    --- a/src/test/fuzz/feeratediagram.cpp
    +++ b/src/test/fuzz/feeratediagram.cpp
    @@ -2,9 +2,6 @@
     // Distributed under the MIT software license, see the accompanying
     // file COPYING or http://www.opensource.org/licenses/mit-license.php.
     
    -#include <cstdint>
    -
    -#include <vector>
     
     #include <util/feefrac.h>
     #include <policy/rbf.h>
    @@ -13,6 +10,8 @@
     #include <test/fuzz/util.h>
     
     #include <cassert>
    +#include <cstdint>
    +#include <vector>
     
     namespace {
     
    diff --git a/src/test/fuzz/txgraph.cpp b/src/test/fuzz/txgraph.cpp
    index 7f7a3181b1..840eca7c55 100644
    --- a/src/test/fuzz/txgraph.cpp
    +++ b/src/test/fuzz/txgraph.cpp
    @@ -11,11 +11,11 @@
     #include <util/feefrac.h>
     
     #include <algorithm>
    +#include <cstdint>
     #include <iterator>
     #include <map>
     #include <memory>
     #include <set>
    -#include <cstdint>
     #include <utility>
     
     using namespace cluster_linearize;
    diff --git a/src/test/fuzz/vecdeque.cpp b/src/test/fuzz/vecdeque.cpp
    index 13843b2c4b..30fc2da03f 100644
    --- a/src/test/fuzz/vecdeque.cpp
    +++ b/src/test/fuzz/vecdeque.cpp
    @@ -7,8 +7,8 @@
     #include <test/fuzz/util.h>
     #include <util/vecdeque.h>
     
    -#include <deque>
     #include <cstdint>
    +#include <deque>
     
     namespace {
     
    diff --git a/src/test/scriptnum10.h b/src/test/scriptnum10.h
    index 38a6fee1dc..db66f3a14c 100644
    --- a/src/test/scriptnum10.h
    +++ b/src/test/scriptnum10.h
    @@ -7,9 +7,9 @@
     #define BITCOIN_TEST_SCRIPTNUM10_H
     
     #include <cassert>
    +#include <cstdint>
     #include <limits>
     #include <stdexcept>
    -#include <cstdint>
     #include <string>
     #include <vector>
     
    diff --git a/src/test/util/coins.cpp b/src/test/util/coins.cpp
    index 2dd98ae770..27be8d0285 100644
    --- a/src/test/util/coins.cpp
    +++ b/src/test/util/coins.cpp
    @@ -10,7 +10,6 @@
     #include <test/util/random.h>
     #include <uint256.h>
     
    -#include <cstdint>
     #include <utility>
     
     COutPoint AddTestCoin(FastRandomContext& rng, CCoinsViewCache& coins_view)
    diff --git a/src/txgraph.h b/src/txgraph.h
    index 6fa035fb5b..9d7c5b3c9f 100644
    --- a/src/txgraph.h
    +++ b/src/txgraph.h
    @@ -5,7 +5,6 @@
     #include <compare>
     #include <memory>
     #include <optional>
    -#include <cstdint>
     #include <vector>
     #include <utility>
     
    diff --git a/src/txrequest.cpp b/src/txrequest.cpp
    index 03b4cd6b16..03c2ec734d 100644
    --- a/src/txrequest.cpp
    +++ b/src/txrequest.cpp
    @@ -17,12 +17,11 @@
     #include <boost/multi_index_container.hpp>
     #include <boost/tuple/tuple.hpp>
     
    +#include <cassert>
     #include <chrono>
     #include <unordered_map>
     #include <utility>
     
    -#include <cassert>
    -
     namespace {
     
     /** The various states a (txhash,peer) pair can be in.
    diff --git a/src/validation.h b/src/validation.h
    index 05a2a2df8c..87a1de7cfb 100644
    --- a/src/validation.h
    +++ b/src/validation.h
    @@ -36,12 +36,12 @@
     #include <versionbits.h>
     
     #include <atomic>
    +#include <cstdint>
     #include <map>
     #include <memory>
     #include <optional>
     #include <set>
     #include <span>
    -#include <cstdint>
     #include <string>
     #include <type_traits>
     #include <utility>
    diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
    index 8998fdb078..1b0cfe2c4f 100644
    --- a/src/wallet/test/wallet_tests.cpp
    +++ b/src/wallet/test/wallet_tests.cpp
    @@ -4,9 +4,9 @@
     
     #include <wallet/wallet.h>
     
    +#include <cstdint>
     #include <future>
     #include <memory>
    -#include <cstdint>
     #include <vector>
     
     #include <addresstype.h>
    

    </details>

  12. refactor: Sort includes of touched source files fa9ca13f35
  13. maflcko commented at 6:03 PM on June 3, 2025: member

    pushed a commit to sort

  14. l0rinc commented at 8:16 AM on June 4, 2025: contributor

    ACK fa9ca13f35be0a023aeed78775ad66f95717b28b

    The new commit is only moving includes (not deleting any) and changing one remaining copyright header.

  15. janb84 commented at 8:34 PM on June 4, 2025: contributor

    ACK fa9ca13f35be0a023aeed78775ad66f95717b28b

    PR Adds check for deprecated headers & replaces deprecated C standard library headers with the C++ equivalents. Makes the code more consistent and the added Clang-tidy check will keep it that way.

    • code review ✅
    • compile & test ✅
    • checked that re-introducing the deprecated headers will result in a clang-tidy violation. ✅
  16. maflcko requested review from hebasto on Jun 5, 2025
  17. stickies-v approved
  18. stickies-v commented at 4:06 PM on June 11, 2025: contributor

    ACK fa9ca13f35be0a023aeed78775ad66f95717b28b

    Compared the changes with my clang-tidy fixes, and couldn't find anything missing (outside of subtrees) or incorrect.

  19. achow101 commented at 9:56 PM on June 11, 2025: member

    ACK fa9ca13f35be0a023aeed78775ad66f95717b28b

  20. achow101 merged this on Jun 11, 2025
  21. achow101 closed this on Jun 11, 2025

  22. maflcko deleted the branch on Jun 12, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 09:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me