[libcxx] r273374 - Placate MSVC's unchecked malloc warnings.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 21:23:55 PDT 2016
Author: ericwf
Date: Tue Jun 21 23:23:54 2016
New Revision: 273374
URL: http://llvm.org/viewvc/llvm-project?rev=273374&view=rev
Log:
Placate MSVC's unchecked malloc warnings.
Modified:
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp?rev=273374&r1=273373&r2=273374&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp Tue Jun 21 23:23:54 2016
@@ -26,7 +26,9 @@ int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- 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()
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp?rev=273374&r1=273373&r2=273374&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp Tue Jun 21 23:23:54 2016
@@ -26,7 +26,9 @@ volatile int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- 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()
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp?rev=273374&r1=273373&r2=273374&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp Tue Jun 21 23:23:54 2016
@@ -14,7 +14,6 @@
// TODO Investigate why UBSAN prevents nothrow new from calling our replacement.
// XFAIL: ubsan
-
#include <new>
#include <cstddef>
#include <cstdlib>
@@ -26,7 +25,9 @@ int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- 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()
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp?rev=273374&r1=273373&r2=273374&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp Tue Jun 21 23:23:54 2016
@@ -22,7 +22,9 @@ int new_called = 0;
void* operator new(std::size_t s) throw(std::bad_alloc)
{
++new_called;
- 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