Skip to content

Commit e1f5438

Browse files
committed
build: replace header checks with __has_include
See https://en.cppreference.com/w/cpp/preprocessor/include.
1 parent 5b8046a commit e1f5438

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

cmake/bitcoin-build-config.h.in

Lines changed: 0 additions & 12 deletions
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

Lines changed: 0 additions & 6 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 3 deletions
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)