diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-03-23 17:27:16 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-03-23 17:27:16 +0000 |
commit | 65a87ccdbf0c5ffc387e711946ddcb417efb48b8 (patch) | |
tree | a10d0696bf2ab6a31c22035a22e2c4bb9e8cca3f /libcxx/test/utilities/memory/util.smartptr | |
parent | 794e05b03b394038490043d80647c97f96cca5eb (diff) | |
download | bcm5719-llvm-65a87ccdbf0c5ffc387e711946ddcb417efb48b8.tar.gz bcm5719-llvm-65a87ccdbf0c5ffc387e711946ddcb417efb48b8.zip |
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.
llvm-svn: 177824
Diffstat (limited to 'libcxx/test/utilities/memory/util.smartptr')
-rw-r--r-- | libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h b/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h index 795f6e1f77e..d9b72bce49e 100644 --- a/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h +++ b/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/test_allocator.h @@ -54,8 +54,13 @@ public: pointer allocate(size_type n, const void* = 0) { assert(data_ >= 0); - if (time_to_throw >= throw_after) + if (time_to_throw >= throw_after) { +#ifndef _LIBCPP_NO_EXCEPTIONS throw std::bad_alloc(); +#else + std::terminate(); +#endif + } ++time_to_throw; ++alloc_count; return (pointer)std::malloc(n * sizeof(T)); |