Skip to content

Commit 40cd758

Browse files
committed
randomenv: use ifdef over if
randomenv.cpp:48:5: warning: 'HAVE_VM_VM_PARAM_H' is not defined, evaluates to 0 [-Wundef] randomenv.cpp:51:5: warning: 'HAVE_SYS_RESOURCES_H' is not defined, evaluates to 0 [-Wundef] randomenv.cpp:424:5: error: 'HAVE_SYSCTL' is not defined, evaluates to 0 [-Werror,-Wundef]
1 parent 7839503 commit 40cd758

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/randomenv.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
#if HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS
4343
#include <ifaddrs.h>
4444
#endif
45-
#if HAVE_SYSCTL
45+
#ifdef HAVE_SYSCTL
4646
#include <sys/sysctl.h>
47-
#if HAVE_VM_VM_PARAM_H
47+
#ifdef HAVE_VM_VM_PARAM_H
4848
#include <vm/vm_param.h>
4949
#endif
50-
#if HAVE_SYS_RESOURCES_H
50+
#ifdef HAVE_SYS_RESOURCES_H
5151
#include <sys/resources.h>
5252
#endif
53-
#if HAVE_SYS_VMMETER_H
53+
#ifdef HAVE_SYS_VMMETER_H
5454
#include <sys/vmmeter.h>
5555
#endif
5656
#endif
@@ -162,7 +162,7 @@ void AddPath(CSHA512& hasher, const char *path)
162162
}
163163
#endif
164164

165-
#if HAVE_SYSCTL
165+
#ifdef HAVE_SYSCTL
166166
template<int... S>
167167
void AddSysctl(CSHA512& hasher)
168168
{
@@ -274,7 +274,7 @@ void RandAddDynamicEnv(CSHA512& hasher)
274274
AddFile(hasher, "/proc/self/status");
275275
#endif
276276

277-
#if HAVE_SYSCTL
277+
#ifdef HAVE_SYSCTL
278278
# ifdef CTL_KERN
279279
# if defined(KERN_PROC) && defined(KERN_PROC_ALL)
280280
AddSysctl<CTL_KERN, KERN_PROC, KERN_PROC_ALL>(hasher);
@@ -419,7 +419,7 @@ void RandAddStaticEnv(CSHA512& hasher)
419419

420420
// For MacOS/BSDs, gather data through sysctl instead of /proc. Not all of these
421421
// will exist on every system.
422-
#if HAVE_SYSCTL
422+
#ifdef HAVE_SYSCTL
423423
# ifdef CTL_HW
424424
# ifdef HW_MACHINE
425425
AddSysctl<CTL_HW, HW_MACHINE>(hasher);

0 commit comments

Comments
 (0)