Make HAVE_DECL_ARC4RANDOM always defined. Sort the entry correctly.

llvm-svn: 282768
This commit is contained in:
Joerg Sonnenberger 2016-09-29 21:10:38 +00:00
parent 5c50539503
commit 8472f847ca
2 changed files with 6 additions and 5 deletions

View File

@ -16,9 +16,6 @@
/* Define if position independent code is enabled */ /* Define if position independent code is enabled */
#cmakedefine ENABLE_PIC #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. */ /* Define to 1 if you have the `backtrace' function. */
#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE} #cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE}
@ -34,6 +31,10 @@
/* can use __crashreporter_info__ */ /* can use __crashreporter_info__ */
#undef HAVE_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 /* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
don't. */ don't. */
#cmakedefine01 HAVE_DECL_FE_ALL_EXCEPT #cmakedefine01 HAVE_DECL_FE_ALL_EXCEPT

View File

@ -429,7 +429,7 @@ const char *Process::ResetColor() {
return "\033[0m"; return "\033[0m";
} }
#if !defined(HAVE_DECL_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM #if !HAVE_DECL_ARC4RANDOM
static unsigned GetRandomNumberSeed() { static unsigned GetRandomNumberSeed() {
// Attempt to get the initial seed from /dev/urandom, if possible. // Attempt to get the initial seed from /dev/urandom, if possible.
int urandomFD = open("/dev/urandom", O_RDONLY); int urandomFD = open("/dev/urandom", O_RDONLY);
@ -455,7 +455,7 @@ static unsigned GetRandomNumberSeed() {
#endif #endif
unsigned llvm::sys::Process::GetRandomNumber() { unsigned llvm::sys::Process::GetRandomNumber() {
#if defined(HAVE_DECL_ARC4RANDOM) && HAVE_DECL_ARC4RANDOM #if HAVE_DECL_ARC4RANDOM
return arc4random(); return arc4random();
#else #else
static int x = (static_cast<void>(::srand(GetRandomNumberSeed())), 0); static int x = (static_cast<void>(::srand(GetRandomNumberSeed())), 0);