This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177824 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,8 +29,13 @@ private:
|
||||
public:
|
||||
pointer allocate(size_type n, const void* = 0)
|
||||
{
|
||||
if (n > N - (ptr_ - buf_) / sizeof(value_type))
|
||||
if (n > N - (ptr_ - buf_) / sizeof(value_type)) {
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw std::bad_alloc();
|
||||
#else
|
||||
std::terminate();
|
||||
#endif
|
||||
}
|
||||
pointer r = (T*)ptr_;
|
||||
ptr_ += n * sizeof(T);
|
||||
return r;
|
||||
|
Reference in New Issue
Block a user