Skip to content

Commit baa848b

Browse files
committed
Merge bitcoin#32405: build: replace header checks with __has_include
e1f5438 build: replace header checks with __has_include (fanquake) Pull request description: Replace the checks in CMake, with the equivalent functionality provided by the standard library (since C++17). See https://en.cppreference.com/w/cpp/preprocessor/include. Guix Build: ```bash 66d71c866bd111ffe65bc03b9e1653a95eb678f0b04451759c56af868bfc03d5 guix-build-e1f543823b30/output/aarch64-linux-gnu/SHA256SUMS.part 1a4130d801620a63d86c3069b1fbca39ebc963e610101451d3f48b1c191ca4b3 guix-build-e1f543823b30/output/aarch64-linux-gnu/bitcoin-e1f543823b30-aarch64-linux-gnu-debug.tar.gz 745adbc7767344a8cd0ebe1e7592239614d89f949558c9b6a2ae58f7b2602a32 guix-build-e1f543823b30/output/aarch64-linux-gnu/bitcoin-e1f543823b30-aarch64-linux-gnu.tar.gz cb69d205a20715ee58a324cc2b8475c2bae0443a062f5de2820baa45f822292c guix-build-e1f543823b30/output/arm-linux-gnueabihf/SHA256SUMS.part 081774dd903256dafa187ee47a569cd44b01eb16adc9dbfeb54b721abc39e944 guix-build-e1f543823b30/output/arm-linux-gnueabihf/bitcoin-e1f543823b30-arm-linux-gnueabihf-debug.tar.gz 1dd857fe6b9e75fae746e73fbfc6b77302b4dbb13685baebb10e9686da7bad01 guix-build-e1f543823b30/output/arm-linux-gnueabihf/bitcoin-e1f543823b30-arm-linux-gnueabihf.tar.gz e035ba959da69263de2f29282328d4e5b455f94a800a15891801f26ba3b8b325 guix-build-e1f543823b30/output/arm64-apple-darwin/SHA256SUMS.part ebf973e0e44be688ea5e1ebae804dfce6e71b7ca8aaca5d8249a14d130f37c3f guix-build-e1f543823b30/output/arm64-apple-darwin/bitcoin-e1f543823b30-arm64-apple-darwin-codesigning.tar.gz 3ea687b53032b30d7c4a0760f8a35d19e2f60a8cb3f1f5e2c5cba05897f04e43 guix-build-e1f543823b30/output/arm64-apple-darwin/bitcoin-e1f543823b30-arm64-apple-darwin-unsigned.tar.gz ebb6a935f2fbc75167f5e61a039d13f231621f7eb0cbd1292616425f7677739c guix-build-e1f543823b30/output/arm64-apple-darwin/bitcoin-e1f543823b30-arm64-apple-darwin-unsigned.zip 9e77422977506f0c3f0373ee19d24c3ad86cbaf3a97cfcf5db202d4fff9c3ae4 guix-build-e1f543823b30/output/dist-archive/bitcoin-e1f543823b30.tar.gz 62d7c8f63a3702b066f88498f829b2c371baa06c596b71b6d8969f638cc2d356 guix-build-e1f543823b30/output/powerpc64-linux-gnu/SHA256SUMS.part 60c00fc85dea24548c212330e5fa097020f17bb74f511e7e764b8b33224afce0 guix-build-e1f543823b30/output/powerpc64-linux-gnu/bitcoin-e1f543823b30-powerpc64-linux-gnu-debug.tar.gz 97b1aa4dc967c9a3767476a262a503900ea77e15b4b292928c6cdddf306cafc9 guix-build-e1f543823b30/output/powerpc64-linux-gnu/bitcoin-e1f543823b30-powerpc64-linux-gnu.tar.gz ed67fbb0768ce7b1d4d053de2ba0ea3b2798d01a276adf6430c4a2a413461ee2 guix-build-e1f543823b30/output/riscv64-linux-gnu/SHA256SUMS.part 83f7b4e6c244d97caa2eb41b67cdef2bfa71f2f3ef1cfa378fae32db18fc8e25 guix-build-e1f543823b30/output/riscv64-linux-gnu/bitcoin-e1f543823b30-riscv64-linux-gnu-debug.tar.gz c8ca7793fdfac2346a21d5fc8f6e00f1feb6556d048896fef8148ac614921050 guix-build-e1f543823b30/output/riscv64-linux-gnu/bitcoin-e1f543823b30-riscv64-linux-gnu.tar.gz a3e99dd3369aa97cad2437fc1b29f84a8950327fd0f0a1c0a8a3e7ce49369f1a guix-build-e1f543823b30/output/x86_64-apple-darwin/SHA256SUMS.part 1c22d2967c72a5b901d54b9914d243aaf8f52216e48399f09bf17f34455369ec guix-build-e1f543823b30/output/x86_64-apple-darwin/bitcoin-e1f543823b30-x86_64-apple-darwin-codesigning.tar.gz 28c731d91d84f41a0b94cfb420474f150edd2bd33db1e9c38d52c9452e44b3f1 guix-build-e1f543823b30/output/x86_64-apple-darwin/bitcoin-e1f543823b30-x86_64-apple-darwin-unsigned.tar.gz f6b74d1756af4de4a7e250c11f0a48a93fafc67139951afc4a55888ce24dc01a guix-build-e1f543823b30/output/x86_64-apple-darwin/bitcoin-e1f543823b30-x86_64-apple-darwin-unsigned.zip 16d7a33003e89f53b3d8ce31a121250a4f836c83482f39b0c40721a2dd32faca guix-build-e1f543823b30/output/x86_64-linux-gnu/SHA256SUMS.part d17606b3fec3c045d84dadff4b107186cc6e51daa80a16588de4e213585a98cd guix-build-e1f543823b30/output/x86_64-linux-gnu/bitcoin-e1f543823b30-x86_64-linux-gnu-debug.tar.gz 52ee77c9ff6bbe6965100165847d107c4e3ddcf8c2a960746f663ade074295a5 guix-build-e1f543823b30/output/x86_64-linux-gnu/bitcoin-e1f543823b30-x86_64-linux-gnu.tar.gz daeba27cb9ce21e3a6a01b9487ef81738eec0c84ad80ca0ba1287412c0d4eeda guix-build-e1f543823b30/output/x86_64-w64-mingw32/SHA256SUMS.part 38ccc35fe32895688f4fc0f22ed8a03233d06636a487b49de74a215fc6b67002 guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-codesigning.tar.gz 22863abb1a4d1fed1e4753e602f33a743296caf297bdc7ed9330010f5d3f79f3 guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-debug.zip 1cbc8ae43899d96664e75fa2c3fce2efbb2cfac34b279fe1e240a616646cb3e9 guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-setup-unsigned.exe b6d22f62c083aca24dc788df1676bfc2ce0abc85a796a4823e5802d71482082c guix-build-e1f543823b30/output/x86_64-w64-mingw32/bitcoin-e1f543823b30-win64-unsigned.zip ``` ACKs for top commit: shahsb: ACK bitcoin@e1f5438 purpleKarrot: ACK e1f5438 TheCharlatan: ACK e1f5438 hebasto: ACK e1f5438, I have reviewed the code and it looks OK. Tree-SHA512: d4bcbc37d431113f0e6367e8f61e71ab9d9ef8a08c38a2db961d9f9cc8473636124f5f2bd4d66cbb3e5032f9d5f978d7d286033d80f7e148f9d571ff09f005ff
2 parents 53ccb75 + e1f5438 commit baa848b

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

cmake/bitcoin-build-config.h.in

-12
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,6 @@
108108
/* Define to 1 if std::system or ::wsystem is available. */
109109
#cmakedefine HAVE_SYSTEM 1
110110

111-
/* Define to 1 if you have the <sys/prctl.h> header file. */
112-
#cmakedefine HAVE_SYS_PRCTL_H 1
113-
114-
/* Define to 1 if you have the <sys/resources.h> header file. */
115-
#cmakedefine HAVE_SYS_RESOURCES_H 1
116-
117-
/* Define to 1 if you have the <sys/vmmeter.h> header file. */
118-
#cmakedefine HAVE_SYS_VMMETER_H 1
119-
120-
/* Define to 1 if you have the <vm/vm_param.h> header file. */
121-
#cmakedefine HAVE_VM_VM_PARAM_H 1
122-
123111
/* Define to the address where bug reports for this package should be sent. */
124112
#define CLIENT_BUGREPORT "@CLIENT_BUGREPORT@"
125113

cmake/introspection.cmake

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ include(CheckCXXSourceCompiles)
66
include(CheckCXXSymbolExists)
77
include(CheckIncludeFileCXX)
88

9-
# The following HAVE_{HEADER}_H variables go to the bitcoin-build-config.h header.
10-
check_include_file_cxx(sys/prctl.h HAVE_SYS_PRCTL_H)
11-
check_include_file_cxx(sys/resources.h HAVE_SYS_RESOURCES_H)
12-
check_include_file_cxx(sys/vmmeter.h HAVE_SYS_VMMETER_H)
13-
check_include_file_cxx(vm/vm_param.h HAVE_VM_VM_PARAM_H)
14-
159
check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC)
1610
check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
1711
check_cxx_symbol_exists(fork "unistd.h" HAVE_DECL_FORK)

src/randomenv.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
#endif
4444
#ifdef HAVE_SYSCTL
4545
#include <sys/sysctl.h>
46-
#ifdef HAVE_VM_VM_PARAM_H
46+
#if __has_include(<vm/vm_param.h>)
4747
#include <vm/vm_param.h>
4848
#endif
49-
#ifdef HAVE_SYS_RESOURCES_H
49+
#if __has_include(<sys/resources.h>)
5050
#include <sys/resources.h>
5151
#endif
52-
#ifdef HAVE_SYS_VMMETER_H
52+
#if __has_include(<sys/vmmeter.h>)
5353
#include <sys/vmmeter.h>
5454
#endif
5555
#endif

src/util/threadnames.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include <bitcoin-build-config.h> // IWYU pragma: keep
6-
75
#include <cstring>
86
#include <string>
97
#include <thread>
@@ -16,7 +14,7 @@
1614

1715
#include <util/threadnames.h>
1816

19-
#ifdef HAVE_SYS_PRCTL_H
17+
#if __has_include(<sys/prctl.h>)
2018
#include <sys/prctl.h>
2119
#endif
2220

0 commit comments

Comments
 (0)