From 5a47084235c004a21328c7348a68401c944aa81d Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Thu, 29 Sep 2016 21:10:38 +0000 Subject: [PATCH] Make HAVE_DECL_ARC4RANDOM always defined. Sort the entry correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282768 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Config/config.h.cmake | 7 ++++--- lib/Support/Unix/Process.inc | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index f6fd4e5977f..143e1dcf3c7 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -16,9 +16,6 @@ /* Define if position independent code is enabled */ #cmakedefine ENABLE_PIC -/* Define to 1 if you have the `arc4random' function. */ -#cmakedefine HAVE_DECL_ARC4RANDOM ${HAVE_DECL_ARC4RANDOM} - /* Define to 1 if you have the `backtrace' function. */ #cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE} @@ -34,6 +31,10 @@ /* can use __crashreporter_info__ */ #undef HAVE_CRASHREPORTER_INFO +/* Define to 1 if you have the declaration of `arc4random', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_ARC4RANDOM + /* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you don't. */ #cmakedefine01 HAVE_DECL_FE_ALL_EXCEPT diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index d81836b92da..d4c4b86d498 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -429,7 +429,7 @@ const char *Process::ResetColor() { return "\033[0m"; } -#if !defined(HAVE_DECL_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM +#if !HAVE_DECL_ARC4RANDOM static unsigned GetRandomNumberSeed() { // Attempt to get the initial seed from /dev/urandom, if possible. int urandomFD = open("/dev/urandom", O_RDONLY); @@ -455,7 +455,7 @@ static unsigned GetRandomNumberSeed() { #endif unsigned llvm::sys::Process::GetRandomNumber() { -#if defined(HAVE_DECL_ARC4RANDOM) && HAVE_DECL_ARC4RANDOM +#if HAVE_DECL_ARC4RANDOM return arc4random(); #else static int x = (static_cast(::srand(GetRandomNumberSeed())), 0); -- 2.50.1