diff --git a/contrib/devtools/iwyu/bitcoin.core.imp b/contrib/devtools/iwyu/bitcoin.core.imp index c4c4ba4cebd..789abcdadb8 100644 --- a/contrib/devtools/iwyu/bitcoin.core.imp +++ b/contrib/devtools/iwyu/bitcoin.core.imp @@ -1,3 +1,11 @@ -# Nothing for now. [ + # Compiler intrinsics. + # See: https://github.com/include-what-you-use/include-what-you-use/issues/1764. + { "include": [ "", "private", "", "public" ] }, + { "include": [ "", "private", "", "public" ] }, + { "include": [ "", "private", "", "public" ] }, + + # libc symbols. + { "symbol": ["AT_HWCAP", "private", "", "public"] }, + { "symbol": ["AT_HWCAP2", "private", "", "public"] }, ] diff --git a/src/crypto/chacha20.cpp b/src/crypto/chacha20.cpp index 91064050f48..6bdffe691a6 100644 --- a/src/crypto/chacha20.cpp +++ b/src/crypto/chacha20.cpp @@ -8,11 +8,10 @@ #include #include #include -#include #include #include -#include +#include #define QUARTERROUND(a,b,c,d) \ a += b; d = std::rotl(d ^ a, 16); \ diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h index 6653c2c9733..150356213d6 100644 --- a/src/crypto/chacha20.h +++ b/src/crypto/chacha20.h @@ -5,12 +5,11 @@ #ifndef BITCOIN_CRYPTO_CHACHA20_H #define BITCOIN_CRYPTO_CHACHA20_H -#include - #include #include #include -#include +#include +#include #include // 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 a6c3a668cfd..9a863dda97b 100644 --- a/src/crypto/chacha20poly1305.h +++ b/src/crypto/chacha20poly1305.h @@ -7,10 +7,10 @@ #include #include +#include #include #include -#include /** The AEAD_CHACHA20_POLY1305 authenticated encryption algorithm from RFC8439 section 2.8. */ class AEADChaCha20Poly1305 diff --git a/src/crypto/hex_base.cpp b/src/crypto/hex_base.cpp index e2eccf5509b..7098aba7b8a 100644 --- a/src/crypto/hex_base.cpp +++ b/src/crypto/hex_base.cpp @@ -5,8 +5,10 @@ #include #include +#include #include #include +#include namespace { diff --git a/src/crypto/hex_base.h b/src/crypto/hex_base.h index 704b19f8864..9975f7f6137 100644 --- a/src/crypto/hex_base.h +++ b/src/crypto/hex_base.h @@ -9,6 +9,7 @@ #include #include +#include #include /** diff --git a/src/crypto/hkdf_sha256_32.cpp b/src/crypto/hkdf_sha256_32.cpp index e62249446a4..3cd2cf886ba 100644 --- a/src/crypto/hkdf_sha256_32.cpp +++ b/src/crypto/hkdf_sha256_32.cpp @@ -4,8 +4,9 @@ #include +#include + #include -#include 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 f9f343b4b76..7c5d5a7f859 100644 --- a/src/crypto/hkdf_sha256_32.h +++ b/src/crypto/hkdf_sha256_32.h @@ -5,10 +5,8 @@ #ifndef BITCOIN_CRYPTO_HKDF_SHA256_32_H #define BITCOIN_CRYPTO_HKDF_SHA256_32_H -#include - -#include -#include +#include +#include /** 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.cpp b/src/crypto/hmac_sha256.cpp index 034652064e5..a95ef70849b 100644 --- a/src/crypto/hmac_sha256.cpp +++ b/src/crypto/hmac_sha256.cpp @@ -4,6 +4,8 @@ #include +#include + #include CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen) diff --git a/src/crypto/hmac_sha256.h b/src/crypto/hmac_sha256.h index ea8cee88085..a26947d5e0a 100644 --- a/src/crypto/hmac_sha256.h +++ b/src/crypto/hmac_sha256.h @@ -7,8 +7,7 @@ #include -#include -#include +#include /** A hasher class for HMAC-SHA-256. */ class CHMAC_SHA256 diff --git a/src/crypto/hmac_sha512.cpp b/src/crypto/hmac_sha512.cpp index 245ed29ec19..f37e709d13c 100644 --- a/src/crypto/hmac_sha512.cpp +++ b/src/crypto/hmac_sha512.cpp @@ -4,6 +4,8 @@ #include +#include + #include CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen) diff --git a/src/crypto/hmac_sha512.h b/src/crypto/hmac_sha512.h index d6bebc093c6..dfae8d05e5a 100644 --- a/src/crypto/hmac_sha512.h +++ b/src/crypto/hmac_sha512.h @@ -7,8 +7,7 @@ #include -#include -#include +#include /** A hasher class for HMAC-SHA-512. */ class CHMAC_SHA512 diff --git a/src/crypto/muhash.cpp b/src/crypto/muhash.cpp index 02c38c44427..c04f58ec421 100644 --- a/src/crypto/muhash.cpp +++ b/src/crypto/muhash.cpp @@ -7,11 +7,12 @@ #include #include #include +#include +#include #include #include -#include -#include +#include #include namespace { diff --git a/src/crypto/muhash.h b/src/crypto/muhash.h index f3409373236..5e2be323383 100644 --- a/src/crypto/muhash.h +++ b/src/crypto/muhash.h @@ -6,9 +6,12 @@ #define BITCOIN_CRYPTO_MUHASH_H #include -#include +#include #include +#include + +class uint256; class Num3072 { diff --git a/src/crypto/poly1305.cpp b/src/crypto/poly1305.cpp index c9c066b3097..d6762a1f1d9 100644 --- a/src/crypto/poly1305.cpp +++ b/src/crypto/poly1305.cpp @@ -5,8 +5,6 @@ #include #include -#include - namespace poly1305_donna { // Based on the public domain implementation by Andrew Moon diff --git a/src/crypto/poly1305.h b/src/crypto/poly1305.h index 494f7cdd4d8..af4aede2583 100644 --- a/src/crypto/poly1305.h +++ b/src/crypto/poly1305.h @@ -8,8 +8,9 @@ #include #include +#include #include -#include +#include #define POLY1305_BLOCK_SIZE 16 diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index d75d01b6b7c..8ad9a85d56c 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -10,7 +10,7 @@ #include #if !defined(DISABLE_OPTIMIZED_SHA256) -#include +#include // IWYU pragma: keep #if defined(__linux__) && defined(ENABLE_ARM_SHANI) #include diff --git a/src/crypto/sha256_arm_shani.cpp b/src/crypto/sha256_arm_shani.cpp index 2ea1d9c2acc..a778e871a12 100644 --- a/src/crypto/sha256_arm_shani.cpp +++ b/src/crypto/sha256_arm_shani.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include namespace { diff --git a/src/crypto/sha256_sse4.cpp b/src/crypto/sha256_sse4.cpp index d0a34934d80..3de30f7408a 100644 --- a/src/crypto/sha256_sse4.cpp +++ b/src/crypto/sha256_sse4.cpp @@ -5,11 +5,11 @@ // This is a translation to GCC extended asm syntax from YASM code by Intel // (available at the bottom of this file). +#if defined(__x86_64__) || defined(__amd64__) + #include #include -#if defined(__x86_64__) || defined(__amd64__) - namespace sha256_sse4 { void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks) diff --git a/src/crypto/sha256_x86_shani.cpp b/src/crypto/sha256_x86_shani.cpp index 5ee957aaa78..daccdc51638 100644 --- a/src/crypto/sha256_x86_shani.cpp +++ b/src/crypto/sha256_x86_shani.cpp @@ -8,6 +8,7 @@ #if defined(ENABLE_SSE41) && defined(ENABLE_X86_SHANI) +#include #include #include diff --git a/src/crypto/sha3.cpp b/src/crypto/sha3.cpp index 4c61bce5f62..f6844476abe 100644 --- a/src/crypto/sha3.cpp +++ b/src/crypto/sha3.cpp @@ -9,9 +9,9 @@ #include #include -#include #include -#include +#include +#include #include void KeccakF(uint64_t (&st)[25]) diff --git a/src/crypto/sha3.h b/src/crypto/sha3.h index 7a538e4a275..91cdb5ca7ab 100644 --- a/src/crypto/sha3.h +++ b/src/crypto/sha3.h @@ -5,10 +5,9 @@ #ifndef BITCOIN_CRYPTO_SHA3_H #define BITCOIN_CRYPTO_SHA3_H -#include - #include #include +#include //! The Keccak-f[1600] transform. void KeccakF(uint64_t (&st)[25]); diff --git a/src/crypto/siphash.cpp b/src/crypto/siphash.cpp index dda28a6ced4..1a9eb771a82 100644 --- a/src/crypto/siphash.cpp +++ b/src/crypto/siphash.cpp @@ -4,7 +4,11 @@ #include +#include + #include +#include +#include #define SIPROUND do { \ v0 += v1; v1 = std::rotl(v1, 13); v1 ^= v0; \ diff --git a/src/crypto/siphash.h b/src/crypto/siphash.h index 4c6a39e0b68..8d41a083ac8 100644 --- a/src/crypto/siphash.h +++ b/src/crypto/siphash.h @@ -6,9 +6,9 @@ #define BITCOIN_CRYPTO_SIPHASH_H #include +#include -#include -#include +class uint256; /** SipHash-2-4 */ class CSipHasher