[llvm] r282768 - Make HAVE_DECL_ARC4RANDOM always defined. Sort the entry correctly.
Joerg Sonnenberger via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 29 14:10:38 PDT 2016
Author: joerg
Date: Thu Sep 29 16:10:38 2016
New Revision: 282768
URL: http://llvm.org/viewvc/llvm-project?rev=282768&view=rev
Log:
Make HAVE_DECL_ARC4RANDOM always defined. Sort the entry correctly.
Modified:
llvm/trunk/include/llvm/Config/config.h.cmake
llvm/trunk/lib/Support/Unix/Process.inc
Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=282768&r1=282767&r2=282768&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Thu Sep 29 16:10:38 2016
@@ -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
Modified: llvm/trunk/lib/Support/Unix/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Process.inc?rev=282768&r1=282767&r2=282768&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Process.inc (original)
+++ llvm/trunk/lib/Support/Unix/Process.inc Thu Sep 29 16:10:38 2016
@@ -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<void>(::srand(GetRandomNumberSeed())), 0);
More information about the llvm-commits
mailing list