1
1
mirror of https://github.com/bitcoin/bitcoin.git synced 2024-05-17 23:56:39 +00:00

Merge bitcoin/bitcoin#26159: build: Remove stdlib.h from header checks

553ff452c0e95a9647d35f10f67e45f24bd2d9b7 build: remove stdlib.h from header checks (fanquake)
a63d4cb26a2830b297288aa6acf5b69108353334 refactor: use <cstdlib> over stdlib.h (fanquake)

Pull request description:

  We already use a mix of `<cstlib>` and `stdlib.h` unconditionally throughout
  the codebase.

  Us checking this header also duplicates work already done by autotools.
  Currently stdlib.h is checked for 3 times during a ./configure run, after
  this change, at least it's only twice.

  Similar to #26150.

ACKs for top commit:
  kristapsk:
    ACK 553ff452c0e95a9647d35f10f67e45f24bd2d9b7
  TheCharlatan:
    ACK 553ff452c0e95a9647d35f10f67e45f24bd2d9b7

Tree-SHA512: 0a43d39d3df180a1614dbd3a1ee1531b0969ffe4a0c09dfe9d2f3f0ec16196b5fd7523309f6722936a8c8b20908508724e1903e939dd81c3b4538d85d0f42953
This commit is contained in:
MacroFake 2022-09-25 11:45:17 +00:00
commit ec13810a00
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548
23 changed files with 24 additions and 25 deletions

View File

@ -1010,7 +1010,7 @@ if test "$TARGET_OS" = "darwin"; then
AX_CHECK_LINK_FLAG([-Wl,-bind_at_load], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"], [], [$LDFLAG_WERROR]) AX_CHECK_LINK_FLAG([-Wl,-bind_at_load], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"], [], [$LDFLAG_WERROR])
fi fi
AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdlib.h unistd.h sys/types.h sys/stat.h sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h]) AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h unistd.h sys/types.h sys/stat.h sys/select.h sys/prctl.h sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h])
AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],, AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],,
[#include <sys/types.h> [#include <sys/types.h>

View File

@ -6,7 +6,7 @@
#ifndef BITCOIN_CONSENSUS_CONSENSUS_H #ifndef BITCOIN_CONSENSUS_CONSENSUS_H
#define BITCOIN_CONSENSUS_CONSENSUS_H #define BITCOIN_CONSENSUS_CONSENSUS_H
#include <stdlib.h> #include <cstdlib>
#include <stdint.h> #include <stdint.h>
/** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */ /** The maximum allowed size for a serialized block, in bytes (only for buffer size limits) */

View File

@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_CHACHA20_H #ifndef BITCOIN_CRYPTO_CHACHA20_H
#define BITCOIN_CRYPTO_CHACHA20_H #define BITCOIN_CRYPTO_CHACHA20_H
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A class for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein /** A class for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
https://cr.yp.to/chacha/chacha-20080128.pdf */ https://cr.yp.to/chacha/chacha-20080128.pdf */

View File

@ -7,8 +7,8 @@
#include <crypto/hmac_sha256.h> #include <crypto/hmac_sha256.h>
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */ /** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
class CHKDF_HMAC_SHA256_L32 class CHKDF_HMAC_SHA256_L32

View File

@ -7,8 +7,8 @@
#include <crypto/sha256.h> #include <crypto/sha256.h>
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A hasher class for HMAC-SHA-256. */ /** A hasher class for HMAC-SHA-256. */
class CHMAC_SHA256 class CHMAC_SHA256

View File

@ -7,8 +7,8 @@
#include <crypto/sha512.h> #include <crypto/sha512.h>
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A hasher class for HMAC-SHA-512. */ /** A hasher class for HMAC-SHA-512. */
class CHMAC_SHA512 class CHMAC_SHA512

View File

@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_POLY1305_H #ifndef BITCOIN_CRYPTO_POLY1305_H
#define BITCOIN_CRYPTO_POLY1305_H #define BITCOIN_CRYPTO_POLY1305_H
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#define POLY1305_KEYLEN 32 #define POLY1305_KEYLEN 32
#define POLY1305_TAGLEN 16 #define POLY1305_TAGLEN 16

View File

@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_RIPEMD160_H #ifndef BITCOIN_CRYPTO_RIPEMD160_H
#define BITCOIN_CRYPTO_RIPEMD160_H #define BITCOIN_CRYPTO_RIPEMD160_H
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A hasher class for RIPEMD-160. */ /** A hasher class for RIPEMD-160. */
class CRIPEMD160 class CRIPEMD160

View File

@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA1_H #ifndef BITCOIN_CRYPTO_SHA1_H
#define BITCOIN_CRYPTO_SHA1_H #define BITCOIN_CRYPTO_SHA1_H
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A hasher class for SHA1. */ /** A hasher class for SHA1. */
class CSHA1 class CSHA1

View File

@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA256_H #ifndef BITCOIN_CRYPTO_SHA256_H
#define BITCOIN_CRYPTO_SHA256_H #define BITCOIN_CRYPTO_SHA256_H
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include <string> #include <string>
/** A hasher class for SHA-256. */ /** A hasher class for SHA-256. */

View File

@ -5,8 +5,8 @@
// This is a translation to GCC extended asm syntax from YASM code by Intel // This is a translation to GCC extended asm syntax from YASM code by Intel
// (available at the bottom of this file). // (available at the bottom of this file).
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#if defined(__x86_64__) || defined(__amd64__) #if defined(__x86_64__) || defined(__amd64__)

View File

@ -7,8 +7,8 @@
#include <span.h> #include <span.h>
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
//! The Keccak-f[1600] transform. //! The Keccak-f[1600] transform.
void KeccakF(uint64_t (&st)[25]); void KeccakF(uint64_t (&st)[25]);

View File

@ -5,8 +5,8 @@
#ifndef BITCOIN_CRYPTO_SHA512_H #ifndef BITCOIN_CRYPTO_SHA512_H
#define BITCOIN_CRYPTO_SHA512_H #define BITCOIN_CRYPTO_SHA512_H
#include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
/** A hasher class for SHA-512. */ /** A hasher class for SHA-512. */
class CSHA512 class CSHA512

View File

@ -22,10 +22,10 @@
#include <util/translation.h> #include <util/translation.h>
#include <cstdio> #include <cstdio>
#include <cstdlib>
#include <deque> #include <deque>
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <stdlib.h>
#include <string> #include <string>
#include <sys/types.h> #include <sys/types.h>

View File

@ -13,10 +13,10 @@
#include <util/system.h> #include <util/system.h>
#include <cstdio> #include <cstdio>
#include <cstdlib>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <unistd.h> #include <unistd.h>

View File

@ -10,10 +10,10 @@
#include <util/strencodings.h> #include <util/strencodings.h>
#include <cstdint> #include <cstdint>
#include <cstdlib>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
#include <stdexcept> #include <stdexcept>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <system_error> #include <system_error>
#include <unistd.h> #include <unistd.h>

View File

@ -8,9 +8,8 @@
#include <indirectmap.h> #include <indirectmap.h>
#include <prevector.h> #include <prevector.h>
#include <stdlib.h>
#include <cassert> #include <cassert>
#include <cstdlib>
#include <map> #include <map>
#include <memory> #include <memory>
#include <set> #include <set>

View File

@ -6,7 +6,7 @@
#define BITCOIN_PREVECTOR_H #define BITCOIN_PREVECTOR_H
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <cstdlib>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>

View File

@ -21,7 +21,7 @@
#include <util/time.h> // for GetTimeMicros() #include <util/time.h> // for GetTimeMicros()
#include <cmath> #include <cmath>
#include <stdlib.h> #include <cstdlib>
#include <thread> #include <thread>
#ifndef WIN32 #ifndef WIN32

View File

@ -13,8 +13,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <cstdlib>
#include <policy/policy.h> #include <policy/policy.h>
#include <primitives/transaction.h> #include <primitives/transaction.h>

View File

@ -6,7 +6,7 @@
#ifndef BITCOIN_SUPPORT_CLEANSE_H #ifndef BITCOIN_SUPPORT_CLEANSE_H
#define BITCOIN_SUPPORT_CLEANSE_H #define BITCOIN_SUPPORT_CLEANSE_H
#include <stdlib.h> #include <cstdlib>
/** Secure overwrite a buffer (possibly containing secret data) with zero-bytes. The write /** Secure overwrite a buffer (possibly containing secret data) with zero-bytes. The write
* operation will not be optimized out by the compiler. */ * operation will not be optimized out by the compiler. */

View File

@ -4,13 +4,13 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stdlib.h>
#include <chain.h> #include <chain.h>
#include <rpc/blockchain.h> #include <rpc/blockchain.h>
#include <test/util/setup_common.h> #include <test/util/setup_common.h>
#include <util/string.h> #include <util/string.h>
#include <cstdlib>
/* Equality between doubles is imprecise. Comparison should be done /* Equality between doubles is imprecise. Comparison should be done
* with a small threshold of tolerance, rather than exact equality. * with a small threshold of tolerance, rather than exact equality.
*/ */

View File

@ -4,8 +4,8 @@
#include <event2/event.h> #include <event2/event.h>
#include <cstdlib>
#include <map> #include <map>
#include <stdlib.h>
#include <support/events.h> #include <support/events.h>