[libcxx] r273385 - Placate MSVC's unchecked malloc warning in thread tests.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 22:44:08 PDT 2016


Author: ericwf
Date: Wed Jun 22 00:44:08 2016
New Revision: 273385

URL: http://llvm.org/viewvc/llvm-project?rev=273385&view=rev
Log:
Placate MSVC's unchecked malloc warning in thread tests.

Modified:
    libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp

Modified: libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp?rev=273385&r1=273384&r2=273385&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/F.pass.cpp Wed Jun 22 00:44:08 2016
@@ -36,7 +36,9 @@ void* operator new(std::size_t s) throw(
         throw std::bad_alloc();
     --throw_one;
     ++outstanding_new;
-    return std::malloc(s);
+    void* ret = std::malloc(s);
+    if (!ret) std::abort(); // placate MSVC's unchecked malloc warning
+    return ret;
 }
 
 void  operator delete(void* p) throw()




More information about the cfe-commits mailing list