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

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

    Code Coverage & Benchmarks

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

    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.

    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.

  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 // 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.

    0src/base58.h:14:#ifndef BITCOIN_BASE58_H
    1src/bech32.h:14:#ifndef BITCOIN_BECH32_H
    2src/common/messages.h:11:#ifndef BITCOIN_COMMON_MESSAGES_H
    3src/common/types.h:13:#ifndef BITCOIN_COMMON_TYPES_H
    4src/net_permissions.h:12:#ifndef BITCOIN_NET_PERMISSIONS_H
    5src/node/types.h:13:#ifndef BITCOIN_NODE_TYPES_H
    6src/txgraph.h:14:#ifndef BITCOIN_TXGRAPH_H
    7src/wallet/types.h:14:#ifndef BITCOIN_WALLET_TYPES_H
    8...
    
  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:

      0diff --git a/src/bech32.h b/src/bech32.h
      1index ba4c79bb86..473d7702b5 100644
      2--- a/src/bech32.h
      3+++ b/src/bech32.h
      4@@ -14,7 +14,6 @@
      5 #ifndef BITCOIN_BECH32_H
      6 #define BITCOIN_BECH32_H
      7 
      8-#include <cstdint>
      9 #include <string>
     10 #include <vector>
     11 
     12diff --git a/src/bench/parse_hex.cpp b/src/bench/parse_hex.cpp
     13index c20e9546c3..a57323ceea 100644
     14--- a/src/bench/parse_hex.cpp
     15+++ b/src/bench/parse_hex.cpp
     16@@ -3,12 +3,11 @@
     17 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
     18 
     19 #include <bench/bench.h>
     20-#include <random.h>
     21-#include <cstddef>
     22-#include <util/strencodings.h>
     23 #include <cassert>
     24+#include <cstddef>
     25 #include <optional>
     26-#include <vector>
     27+#include <random.h>
     28+#include <util/strencodings.h>
     29 
     30 std::string generateHexString(size_t length) {
     31     const auto hex_digits = "0123456789ABCDEF";
     32diff --git a/src/bip324.cpp b/src/bip324.cpp
     33index bb1fae5dee..9c5a1572bb 100644
     34--- a/src/bip324.cpp
     35+++ b/src/bip324.cpp
     36@@ -17,8 +17,8 @@
     37 
     38 #include <algorithm>
     39 #include <cassert>
     40-#include <cstdint>
     41 #include <cstddef>
     42+#include <cstdint>
     43 #include <iterator>
     44 #include <string>
     45 
     46diff --git a/src/cluster_linearize.h b/src/cluster_linearize.h
     47index 2a3c649576..17b7e6b27a 100644
     48--- a/src/cluster_linearize.h
     49+++ b/src/cluster_linearize.h
     50@@ -6,11 +6,11 @@
     51 #define BITCOIN_CLUSTER_LINEARIZE_H
     52 
     53 #include <algorithm>
     54+#include <cstdint>
     55 #include <numeric>
     56 #include <optional>
     57-#include <cstdint>
     58-#include <vector>
     59 #include <utility>
     60+#include <vector>
     61 
     62 #include <random.h>
     63 #include <span.h>
     64diff --git a/src/coins.h b/src/coins.h
     65index 6725d5a51f..f9755c846f 100644
     66--- a/src/coins.h
     67+++ b/src/coins.h
     68@@ -18,7 +18,6 @@
     69 
     70 #include <cassert>
     71 #include <cstdint>
     72-
     73 #include <functional>
     74 #include <unordered_map>
     75 
     76diff --git a/src/common/args.h b/src/common/args.h
     77index c35e2cb88a..6c5ac48ae3 100644
     78--- a/src/common/args.h
     79+++ b/src/common/args.h
     80@@ -11,12 +11,12 @@
     81 #include <util/chaintype.h>
     82 #include <util/fs.h>
     83 
     84+#include <cstdint>
     85 #include <iosfwd>
     86 #include <list>
     87 #include <map>
     88 #include <optional>
     89 #include <set>
     90-#include <cstdint>
     91 #include <string>
     92 #include <variant>
     93 #include <vector>
     94diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h
     95index 1e5a6bc4c3..71b5fe2468 100644
     96--- a/src/consensus/consensus.h
     97+++ b/src/consensus/consensus.h
     98@@ -6,8 +6,8 @@
     99 #ifndef BITCOIN_CONSENSUS_CONSENSUS_H
    100 #define BITCOIN_CONSENSUS_CONSENSUS_H
    101 
    102-#include <cstdlib>
    103 #include <cstdint>
    104+#include <cstdlib>
    105 
    106 /** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */
    107 static const unsigned int MAX_BLOCK_SERIALIZED_SIZE = 4000000;
    108diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h
    109index 8b7e6d6b38..27099a2aae 100644
    110--- a/src/consensus/tx_verify.h
    111+++ b/src/consensus/tx_verify.h
    112@@ -7,7 +7,6 @@
    113 
    114 #include <consensus/amount.h>
    115 
    116-#include <cstdint>
    117 #include <vector>
    118 
    119 class CBlockIndex;
    120diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h
    121index 223b317f35..6653c2c973 100644
    122--- a/src/crypto/chacha20.h
    123+++ b/src/crypto/chacha20.h
    124@@ -9,8 +9,8 @@
    125 
    126 #include <array>
    127 #include <cstddef>
    128-#include <cstdlib>
    129 #include <cstdint>
    130+#include <cstdlib>
    131 #include <utility>
    132 
    133 // classes for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
    134diff --git a/src/crypto/chacha20poly1305.h b/src/crypto/chacha20poly1305.h
    135index a6c3a668cf..0512dbd665 100644
    136--- a/src/crypto/chacha20poly1305.h
    137+++ b/src/crypto/chacha20poly1305.h
    138@@ -6,7 +6,6 @@
    139 #define BITCOIN_CRYPTO_CHACHA20POLY1305_H
    140 
    141 #include <cstddef>
    142-#include <cstdint>
    143 
    144 #include <crypto/chacha20.h>
    145 #include <crypto/poly1305.h>
    146diff --git a/src/crypto/hkdf_sha256_32.cpp b/src/crypto/hkdf_sha256_32.cpp
    147index e62249446a..22d245326d 100644
    148--- a/src/crypto/hkdf_sha256_32.cpp
    149+++ b/src/crypto/hkdf_sha256_32.cpp
    150@@ -5,7 +5,6 @@
    151 #include <crypto/hkdf_sha256_32.h>
    152 
    153 #include <cassert>
    154-#include <cstring>
    155 
    156 CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const unsigned char* ikm, size_t ikmlen, const std::string& salt)
    157 {
    158diff --git a/src/crypto/hkdf_sha256_32.h b/src/crypto/hkdf_sha256_32.h
    159index 3010e678a4..415940ebd0 100644
    160--- a/src/crypto/hkdf_sha256_32.h
    161+++ b/src/crypto/hkdf_sha256_32.h
    162@@ -7,9 +7,6 @@
    163 
    164 #include <crypto/hmac_sha256.h>
    165 
    166-#include <cstdlib>
    167-#include <cstdint>
    168-
    169 /** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
    170 class CHKDF_HMAC_SHA256_L32
    171 {
    172diff --git a/src/crypto/hmac_sha256.h b/src/crypto/hmac_sha256.h
    173index 2f72970014..6b2b9364de 100644
    174--- a/src/crypto/hmac_sha256.h
    175+++ b/src/crypto/hmac_sha256.h
    176@@ -7,9 +7,6 @@
    177 
    178 #include <crypto/sha256.h>
    179 
    180-#include <cstdlib>
    181-#include <cstdint>
    182-
    183 /** A hasher class for HMAC-SHA-256. */
    184 class CHMAC_SHA256
    185 {
    186diff --git a/src/crypto/hmac_sha512.h b/src/crypto/hmac_sha512.h
    187index a25da385f4..babfbd7a3b 100644
    188--- a/src/crypto/hmac_sha512.h
    189+++ b/src/crypto/hmac_sha512.h
    190@@ -7,9 +7,6 @@
    191 
    192 #include <crypto/sha512.h>
    193 
    194-#include <cstdlib>
    195-#include <cstdint>
    196-
    197 /** A hasher class for HMAC-SHA-512. */
    198 class CHMAC_SHA512
    199 {
    200diff --git a/src/crypto/muhash.h b/src/crypto/muhash.h
    201index f340937323..aed63572b1 100644
    202--- a/src/crypto/muhash.h
    203+++ b/src/crypto/muhash.h
    204@@ -8,8 +8,6 @@
    205 #include <serialize.h>
    206 #include <uint256.h>
    207 
    208-#include <cstdint>
    209-
    210 class Num3072
    211 {
    212 private:
    213diff --git a/src/crypto/poly1305.h b/src/crypto/poly1305.h
    214index 1b7e355fee..9944befd4a 100644
    215--- a/src/crypto/poly1305.h
    216+++ b/src/crypto/poly1305.h
    217@@ -8,7 +8,6 @@
    218 #include <span.h>
    219 
    220 #include <cassert>
    221-#include <cstdlib>
    222 #include <cstdint>
    223 
    224 #define POLY1305_BLOCK_SIZE 16
    225diff --git a/src/crypto/sha1.h b/src/crypto/sha1.h
    226index a22b65344e..f2f0fccf17 100644
    227--- a/src/crypto/sha1.h
    228+++ b/src/crypto/sha1.h
    229@@ -6,7 +6,6 @@
    230 #define BITCOIN_CRYPTO_SHA1_H
    231 
    232 #include <cstdlib>
    233-#include <cstdint>
    234 
    235 /** A hasher class for SHA1. */
    236 class CSHA1
    237diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h
    238index 460557686c..2ed98a8d5c 100644
    239--- a/src/crypto/sha256.h
    240+++ b/src/crypto/sha256.h
    241@@ -5,8 +5,6 @@
    242 #ifndef BITCOIN_CRYPTO_SHA256_H
    243 #define BITCOIN_CRYPTO_SHA256_H
    244 
    245-#include <cstdlib>
    246-#include <cstdint>
    247 #include <string>
    248 
    249 /** A hasher class for SHA-256. */
    250diff --git a/src/crypto/sha256_sse4.cpp b/src/crypto/sha256_sse4.cpp
    251index 683d44b6b0..8c96e58312 100644
    252--- a/src/crypto/sha256_sse4.cpp
    253+++ b/src/crypto/sha256_sse4.cpp
    254@@ -5,9 +5,6 @@
    255 // This is a translation to GCC extended asm syntax from YASM code by Intel
    256 // (available at the bottom of this file).
    257 
    258-#include <cstdlib>
    259-#include <cstdint>
    260-
    261 #if defined(__x86_64__) || defined(__amd64__)
    262 
    263 namespace sha256_sse4
    264@@ -969,27 +966,27 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
    265 
    266 /*
    267 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    268-; Copyright (c) 2012, Intel Corporation 
    269-; 
    270-; All rights reserved. 
    271-; 
    272+; Copyright (c) 2012, Intel Corporation
    273+;
    274+; All rights reserved.
    275+;
    276 ; Redistribution and use in source and binary forms, with or without
    277 ; modification, are permitted provided that the following conditions are
    278-; met: 
    279-; 
    280+; met:
    281+;
    282 ; * Redistributions of source code must retain the above copyright
    283-;   notice, this list of conditions and the following disclaimer.  
    284-; 
    285+;   notice, this list of conditions and the following disclaimer.
    286+;
    287 ; * Redistributions in binary form must reproduce the above copyright
    288 ;   notice, this list of conditions and the following disclaimer in the
    289 ;   documentation and/or other materials provided with the
    290-;   distribution. 
    291-; 
    292+;   distribution.
    293+;
    294 ; * Neither the name of the Intel Corporation nor the names of its
    295 ;   contributors may be used to endorse or promote products derived from
    296-;   this software without specific prior written permission. 
    297-; 
    298-; 
    299+;   this software without specific prior written permission.
    300+;
    301+;
    302 ; THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY
    303 ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    304 ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    305@@ -1020,7 +1017,7 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
    306 ; This code schedules 1 blocks at a time, with 4 lanes per block
    307 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    308 
    309-%defineMOVDQ movdqu ;; assume buffers not aligned 
    310+%defineMOVDQ movdqu ;; assume buffers not aligned
    311 
    312 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Define Macros
    313 
    314@@ -1057,7 +1054,7 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
    315 %define SHUF_00BAxmm10 ; shuffle xBxA -> 00BA
    316 %define SHUF_DC00xmm11 ; shuffle xDxC -> DC00
    317 %define BYTE_FLIP_MASKxmm12
    318-    
    319+
    320 %ifdef LINUX
    321 %define NUM_BLKS rdx; 3rd arg
    322 %define CTXrsi; 2nd arg
    323@@ -1073,10 +1070,10 @@ void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
    324 %define INPrcx 	; 1st arg
    325 
    326 %define SRNDrcx; clobbers INP
    327-%define c 	edi 
    328-%define desi 
    329+%define c 	edi
    330+%define desi
    331 %define e 	r8d
    332-    
    333+
    334 %endif
    335 %define TBLrbp
    336 %define a eax
    337@@ -1356,10 +1353,10 @@ sha256_sse4:
    338 
    339     subrsp,STACK_SIZE
    340 %ifndef LINUX
    341-    movdqa[rsp + _XMM_SAVE + 0*16],xmm6
    342+    movdqa[rsp + _XMM_SAVE + 0*16],xmm6
    343     movdqa[rsp + _XMM_SAVE + 1*16],xmm7
    344-    movdqa[rsp + _XMM_SAVE + 2*16],xmm8
    345-    movdqa[rsp + _XMM_SAVE + 3*16],xmm9
    346+    movdqa[rsp + _XMM_SAVE + 2*16],xmm8
    347+    movdqa[rsp + _XMM_SAVE + 3*16],xmm9
    348     movdqa[rsp + _XMM_SAVE + 4*16],xmm10
    349     movdqa[rsp + _XMM_SAVE + 5*16],xmm11
    350     movdqa[rsp + _XMM_SAVE + 6*16],xmm12
    351@@ -1392,7 +1389,7 @@ loop0:
    352     COPY_XMM_AND_BSWAPX1, [INP + 1*16], BYTE_FLIP_MASK
    353     COPY_XMM_AND_BSWAPX2, [INP + 2*16], BYTE_FLIP_MASK
    354     COPY_XMM_AND_BSWAPX3, [INP + 3*16], BYTE_FLIP_MASK
    355-    
    356+
    357     mov[rsp + _INP], INP
    358 
    359     ;; schedule 48 input dwords, by doing 3 rounds of 16 each
    360@@ -1482,8 +1479,8 @@ done_hash:
    361 %endif
    362     poprbx
    363 
    364-    ret
    365-    
    366+    ret
    367+
    368 
    369 section .data
    370 align 64
    371diff --git a/src/crypto/sha3.h b/src/crypto/sha3.h
    372index 6d114379f3..4def57d65c 100644
    373--- a/src/crypto/sha3.h
    374+++ b/src/crypto/sha3.h
    375@@ -7,7 +7,6 @@
    376 
    377 #include <span.h>
    378 
    379-#include <cstdlib>
    380 #include <cstdint>
    381 
    382 //! The Keccak-f[1600] transform.
    383diff --git a/src/crypto/sha512.h b/src/crypto/sha512.h
    384index 665c8b886e..102fa02a8c 100644
    385--- a/src/crypto/sha512.h
    386+++ b/src/crypto/sha512.h
    387@@ -5,8 +5,8 @@
    388 #ifndef BITCOIN_CRYPTO_SHA512_H
    389 #define BITCOIN_CRYPTO_SHA512_H
    390 
    391-#include <cstdlib>
    392 #include <cstdint>
    393+#include <cstdlib>
    394 
    395 /** A hasher class for SHA-512. */
    396 class CSHA512
    397diff --git a/src/crypto/siphash.h b/src/crypto/siphash.h
    398index 4c6a39e0b6..39cddf8c8f 100644
    399--- a/src/crypto/siphash.h
    400+++ b/src/crypto/siphash.h
    401@@ -5,8 +5,6 @@
    402 #ifndef BITCOIN_CRYPTO_SIPHASH_H
    403 #define BITCOIN_CRYPTO_SIPHASH_H
    404 
    405-#include <cstdint>
    406-
    407 #include <span.h>
    408 #include <uint256.h>
    409 
    410diff --git a/src/interfaces/node.h b/src/interfaces/node.h
    411index 2ab9f84e73..e0299047f7 100644
    412--- a/src/interfaces/node.h
    413+++ b/src/interfaces/node.h
    414@@ -17,8 +17,6 @@
    415 
    416 #include <functional>
    417 #include <memory>
    418-#include <cstddef>
    419-#include <cstdint>
    420 #include <string>
    421 #include <tuple>
    422 #include <vector>
    423diff --git a/src/kernel/disconnected_transactions.cpp b/src/kernel/disconnected_transactions.cpp
    424index 9667642a03..3774043a43 100644
    425--- a/src/kernel/disconnected_transactions.cpp
    426+++ b/src/kernel/disconnected_transactions.cpp
    427@@ -4,12 +4,12 @@
    428 
    429 #include <kernel/disconnected_transactions.h>
    430 
    431-#include <cassert>
    432 #include <core_memusage.h>
    433 #include <memusage.h>
    434 #include <primitives/transaction.h>
    435 #include <util/hasher.h>
    436 
    437+#include <cassert>
    438 #include <memory>
    439 #include <utility>
    440 
    441diff --git a/src/kernel/mempool_entry.h b/src/kernel/mempool_entry.h
    442index 531ccb76b6..73439e1944 100644
    443--- a/src/kernel/mempool_entry.h
    444+++ b/src/kernel/mempool_entry.h
    445@@ -18,7 +18,6 @@
    446 #include <functional>
    447 #include <memory>
    448 #include <set>
    449-#include <cstddef>
    450 #include <cstdint>
    451 
    452 class CBlockIndex;
    453diff --git a/src/node/connection_types.h b/src/node/connection_types.h
    454index 08f0882499..4bb2049a78 100644
    455--- a/src/node/connection_types.h
    456+++ b/src/node/connection_types.h
    457@@ -6,7 +6,6 @@
    458 #define BITCOIN_NODE_CONNECTION_TYPES_H
    459 
    460 #include <string>
    461-#include <cstdint>
    462 
    463 /** Different types of connections to a peer. This enum encapsulates the
    464  * information we have available at the time of opening or accepting the
    465diff --git a/src/node/miner.h b/src/node/miner.h
    466index 047413534b..7f4f999f56 100644
    467--- a/src/node/miner.h
    468+++ b/src/node/miner.h
    469@@ -14,8 +14,8 @@
    470 #include <util/feefrac.h>
    471 
    472 #include <memory>
    473-#include <optional>
    474 #include <cstdint>
    475+#include <optional>
    476 
    477 #include <boost/multi_index/identity.hpp>
    478 #include <boost/multi_index/indexed_by.hpp>
    479diff --git a/src/node/mini_miner.h b/src/node/mini_miner.h
    480index 07e6239c37..fad70f6551 100644
    481--- a/src/node/mini_miner.h
    482+++ b/src/node/mini_miner.h
    483@@ -13,7 +13,6 @@
    484 #include <memory>
    485 #include <optional>
    486 #include <set>
    487-#include <cstdint>
    488 #include <vector>
    489 
    490 class CFeeRate;
    491diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
    492index dda26fa059..d06e5b9929 100644
    493--- a/src/qt/clientmodel.cpp
    494+++ b/src/qt/clientmodel.cpp
    495@@ -23,8 +23,6 @@
    496 #include <util/time.h>
    497 #include <validation.h>
    498 
    499-#include <cstdint>
    500-
    501 #include <QDebug>
    502 #include <QMetaObject>
    503 #include <QThread>
    504diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
    505index db3c7f7417..b8f834a2ee 100644
    506--- a/src/qt/transactiondesc.cpp
    507+++ b/src/qt/transactiondesc.cpp
    508@@ -19,7 +19,6 @@
    509 #include <validation.h>
    510 #include <wallet/types.h>
    511 
    512-#include <cstdint>
    513 #include <string>
    514 
    515 #include <QLatin1String>
    516diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
    517index dd70c499fd..aaf11da79c 100644
    518--- a/src/rpc/blockchain.cpp
    519+++ b/src/rpc/blockchain.cpp
    520@@ -52,9 +52,8 @@
    521 #include <validationinterface.h>
    522 #include <versionbits.h>
    523 
    524-#include <cstdint>
    525-
    526 #include <condition_variable>
    527+#include <cstdint>
    528 #include <iterator>
    529 #include <memory>
    530 #include <mutex>
    531diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp
    532index 4c2b03bad0..a287c33603 100644
    533--- a/src/rpc/client.cpp
    534+++ b/src/rpc/client.cpp
    535@@ -8,7 +8,6 @@
    536 #include <tinyformat.h>
    537 
    538 #include <set>
    539-#include <cstdint>
    540 #include <string>
    541 #include <string_view>
    542 
    543diff --git a/src/rpc/server.h b/src/rpc/server.h
    544index ba9e4d7d7c..d4b48f2418 100644
    545--- a/src/rpc/server.h
    546+++ b/src/rpc/server.h
    547@@ -9,9 +9,9 @@
    548 #include <rpc/request.h>
    549 #include <rpc/util.h>
    550 
    551+#include <cstdint>
    552 #include <functional>
    553 #include <map>
    554-#include <cstdint>
    555 #include <string>
    556 
    557 #include <univalue.h>
    558diff --git a/src/streams.h b/src/streams.h
    559index 0b3b939fab..10f99d2857 100644
    560--- a/src/streams.h
    561+++ b/src/streams.h
    562@@ -14,12 +14,10 @@
    563 #include <algorithm>
    564 #include <cassert>
    565 #include <cstddef>
    566-#include <cstdio>
    567+#include <cstring>
    568 #include <ios>
    569 #include <limits>
    570 #include <optional>
    571-#include <cstdint>
    572-#include <cstring>
    573 #include <string>
    574 #include <utility>
    575 #include <vector>
    576diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp
    577index 962192cefd..a13945a520 100644
    578--- a/src/test/fuzz/addrman.cpp
    579+++ b/src/test/fuzz/addrman.cpp
    580@@ -14,12 +14,12 @@
    581 #include <test/fuzz/util.h>
    582 #include <test/fuzz/util/net.h>
    583 #include <test/util/setup_common.h>
    584-#include <ctime>
    585 #include <util/asmap.h>
    586 #include <util/chaintype.h>
    587 
    588 #include <cassert>
    589 #include <cstdint>
    590+#include <ctime>
    591 #include <optional>
    592 #include <string>
    593 #include <vector>
    594diff --git a/src/test/fuzz/asmap_direct.cpp b/src/test/fuzz/asmap_direct.cpp
    595index 1d693e5ecf..d3c0c3b9ea 100644
    596--- a/src/test/fuzz/asmap_direct.cpp
    597+++ b/src/test/fuzz/asmap_direct.cpp
    598@@ -6,12 +6,11 @@
    599 #include <util/asmap.h>
    600 #include <test/fuzz/fuzz.h>
    601 
    602+#include <cassert>
    603 #include <cstdint>
    604 #include <optional>
    605 #include <vector>
    606 
    607-#include <cassert>
    608-
    609 FUZZ_TARGET(asmap_direct)
    610 {
    611     // Encoding: [asmap using 1 bit / byte] 0xFF [addr using 1 bit / byte]
    612diff --git a/src/test/fuzz/coinscache_sim.cpp b/src/test/fuzz/coinscache_sim.cpp
    613index 91b98292fe..46128b2c34 100644
    614--- a/src/test/fuzz/coinscache_sim.cpp
    615+++ b/src/test/fuzz/coinscache_sim.cpp
    616@@ -10,9 +10,9 @@
    617 #include <test/fuzz/util.h>
    618 
    619 #include <cassert>
    620-#include <optional>
    621-#include <memory>
    622 #include <cstdint>
    623+#include <memory>
    624+#include <optional>
    625 #include <vector>
    626 
    627 namespace {
    628diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp
    629index 5a09963e2c..05ca62b6fd 100644
    630--- a/src/test/fuzz/deserialize.cpp
    631+++ b/src/test/fuzz/deserialize.cpp
    632@@ -29,10 +29,10 @@
    633 #include <test/util/setup_common.h>
    634 #include <undo.h>
    635 
    636+#include <cstdint>
    637 #include <exception>
    638 #include <optional>
    639 #include <stdexcept>
    640-#include <cstdint>
    641 
    642 using node::SnapshotMetadata;
    643 
    644diff --git a/src/test/fuzz/feeratediagram.cpp b/src/test/fuzz/feeratediagram.cpp
    645index 6dcc63e91e..d978794a79 100644
    646--- a/src/test/fuzz/feeratediagram.cpp
    647+++ b/src/test/fuzz/feeratediagram.cpp
    648@@ -2,9 +2,6 @@
    649 // Distributed under the MIT software license, see the accompanying
    650 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
    651 
    652-#include <cstdint>
    653-
    654-#include <vector>
    655 
    656 #include <util/feefrac.h>
    657 #include <policy/rbf.h>
    658@@ -13,6 +10,8 @@
    659 #include <test/fuzz/util.h>
    660 
    661 #include <cassert>
    662+#include <cstdint>
    663+#include <vector>
    664 
    665 namespace {
    666 
    667diff --git a/src/test/fuzz/txgraph.cpp b/src/test/fuzz/txgraph.cpp
    668index 7f7a3181b1..840eca7c55 100644
    669--- a/src/test/fuzz/txgraph.cpp
    670+++ b/src/test/fuzz/txgraph.cpp
    671@@ -11,11 +11,11 @@
    672 #include <util/feefrac.h>
    673 
    674 #include <algorithm>
    675+#include <cstdint>
    676 #include <iterator>
    677 #include <map>
    678 #include <memory>
    679 #include <set>
    680-#include <cstdint>
    681 #include <utility>
    682 
    683 using namespace cluster_linearize;
    684diff --git a/src/test/fuzz/vecdeque.cpp b/src/test/fuzz/vecdeque.cpp
    685index 13843b2c4b..30fc2da03f 100644
    686--- a/src/test/fuzz/vecdeque.cpp
    687+++ b/src/test/fuzz/vecdeque.cpp
    688@@ -7,8 +7,8 @@
    689 #include <test/fuzz/util.h>
    690 #include <util/vecdeque.h>
    691 
    692-#include <deque>
    693 #include <cstdint>
    694+#include <deque>
    695 
    696 namespace {
    697 
    698diff --git a/src/test/scriptnum10.h b/src/test/scriptnum10.h
    699index 38a6fee1dc..db66f3a14c 100644
    700--- a/src/test/scriptnum10.h
    701+++ b/src/test/scriptnum10.h
    702@@ -7,9 +7,9 @@
    703 #define BITCOIN_TEST_SCRIPTNUM10_H
    704 
    705 #include <cassert>
    706+#include <cstdint>
    707 #include <limits>
    708 #include <stdexcept>
    709-#include <cstdint>
    710 #include <string>
    711 #include <vector>
    712 
    713diff --git a/src/test/util/coins.cpp b/src/test/util/coins.cpp
    714index 2dd98ae770..27be8d0285 100644
    715--- a/src/test/util/coins.cpp
    716+++ b/src/test/util/coins.cpp
    717@@ -10,7 +10,6 @@
    718 #include <test/util/random.h>
    719 #include <uint256.h>
    720 
    721-#include <cstdint>
    722 #include <utility>
    723 
    724 COutPoint AddTestCoin(FastRandomContext& rng, CCoinsViewCache& coins_view)
    725diff --git a/src/txgraph.h b/src/txgraph.h
    726index 6fa035fb5b..9d7c5b3c9f 100644
    727--- a/src/txgraph.h
    728+++ b/src/txgraph.h
    729@@ -5,7 +5,6 @@
    730 #include <compare>
    731 #include <memory>
    732 #include <optional>
    733-#include <cstdint>
    734 #include <vector>
    735 #include <utility>
    736 
    737diff --git a/src/txrequest.cpp b/src/txrequest.cpp
    738index 03b4cd6b16..03c2ec734d 100644
    739--- a/src/txrequest.cpp
    740+++ b/src/txrequest.cpp
    741@@ -17,12 +17,11 @@
    742 #include <boost/multi_index_container.hpp>
    743 #include <boost/tuple/tuple.hpp>
    744 
    745+#include <cassert>
    746 #include <chrono>
    747 #include <unordered_map>
    748 #include <utility>
    749 
    750-#include <cassert>
    751-
    752 namespace {
    753 
    754 /** The various states a (txhash,peer) pair can be in.
    755diff --git a/src/validation.h b/src/validation.h
    756index 05a2a2df8c..87a1de7cfb 100644
    757--- a/src/validation.h
    758+++ b/src/validation.h
    759@@ -36,12 +36,12 @@
    760 #include <versionbits.h>
    761 
    762 #include <atomic>
    763+#include <cstdint>
    764 #include <map>
    765 #include <memory>
    766 #include <optional>
    767 #include <set>
    768 #include <span>
    769-#include <cstdint>
    770 #include <string>
    771 #include <type_traits>
    772 #include <utility>
    773diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
    774index 8998fdb078..1b0cfe2c4f 100644
    775--- a/src/wallet/test/wallet_tests.cpp
    776+++ b/src/wallet/test/wallet_tests.cpp
    777@@ -4,9 +4,9 @@
    778 
    779 #include <wallet/wallet.h>
    780 
    781+#include <cstdint>
    782 #include <future>
    783 #include <memory>
    784-#include <cstdint>
    785 #include <vector>
    786 
    787 #include <addresstype.h>
    
  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: 2025-06-15 06:13 UTC

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