<div dir="ltr">Hi Aaron,<br><br>Seems this revision broke clang-native-mingw32-win7 builder:<br><a href="http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/builds/5557">http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/builds/5557</a><br>
<br>The last successful build was for revision 200765:<br><a href="http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/builds/5578">http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/builds/5578</a><br>Please have a look at it.<br>
<br>Thanks<br><br>Galina<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 4, 2014 at 6:49 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: aaronballman<br>
Date: Tue Feb  4 08:49:21 2014<br>
New Revision: 200767<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=200767&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=200767&view=rev</a><br>
Log:<br>
Implemented support for Process::GetRandomNumber on Windows.<br>
<br>
Patch thanks to Stephan Tolksdorf!<br>
<br>
Modified:<br>
    llvm/trunk/lib/Support/Process.cpp<br>
    llvm/trunk/lib/Support/Windows/Process.inc<br>
    llvm/trunk/unittests/Support/ProcessTest.cpp<br>
<br>
Modified: llvm/trunk/lib/Support/Process.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Process.cpp?rev=200767&r1=200766&r2=200767&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Process.cpp?rev=200767&r1=200766&r2=200767&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Support/Process.cpp (original)<br>
+++ llvm/trunk/lib/Support/Process.cpp Tue Feb  4 08:49:21 2014<br>
@@ -12,6 +12,11 @@<br>
 //===----------------------------------------------------------------------===//<br>
<br>
 #include "llvm/Config/config.h"<br>
+#if LLVM_ON_WIN32<br>
+  // This define makes stdlib.h declare the rand_s function.<br>
+#define _CRT_RAND_S<br>
+#include <stdlib.h><br>
+#endif<br>
 #include "llvm/Support/ErrorHandling.h"<br>
 #include "llvm/Support/Process.h"<br>
<br>
<br>
Modified: llvm/trunk/lib/Support/Windows/Process.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Process.inc?rev=200767&r1=200766&r2=200767&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Process.inc?rev=200767&r1=200766&r2=200767&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Support/Windows/Process.inc (original)<br>
+++ llvm/trunk/lib/Support/Windows/Process.inc Tue Feb  4 08:49:21 2014<br>
@@ -360,3 +360,10 @@ const char *Process::ResetColor() {<br>
   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), defaultColors());<br>
   return 0;<br>
 }<br>
+<br>
+unsigned Process::GetRandomNumber() {<br>
+  unsigned int result;<br>
+  const errno_t ec = rand_s(&result);<br>
+  assert(ec == 0 && "rand_s failed");<br>
+  return result;<br>
+}<br>
<br>
Modified: llvm/trunk/unittests/Support/ProcessTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ProcessTest.cpp?rev=200767&r1=200766&r2=200767&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ProcessTest.cpp?rev=200767&r1=200766&r2=200767&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/unittests/Support/ProcessTest.cpp (original)<br>
+++ llvm/trunk/unittests/Support/ProcessTest.cpp Tue Feb  4 08:49:21 2014<br>
@@ -39,6 +39,13 @@ TEST(ProcessTest, SelfProcess) {<br>
   EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_wall_time());<br>
 }<br>
<br>
+TEST(ProcessTest, GetRandomNumberTest) {<br>
+  const unsigned r1 = Process::GetRandomNumber();<br>
+  const unsigned r2 = Process::GetRandomNumber();<br>
+  // It should be extremely unlikely that both r1 and r2 are 0.<br>
+  EXPECT_NE((r1 | r2), 0);<br>
+}<br>
+<br>
 #ifdef _MSC_VER<br>
 #define setenv(name, var, ignore) _putenv_s(name, var)<br>
 #endif<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Thanks<br><br></div>Galina<br></div>
</div>