From 65a87ccdbf0c5ffc387e711946ddcb417efb48b8 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sat, 23 Mar 2013 17:27:16 +0000 Subject: 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 --- .../function.objects/func.wrap/func.wrap.func/test_allocator.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libcxx/test/utilities/function.objects') diff --git a/libcxx/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h b/libcxx/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h index c5da7e6390d..eed33a0e3ea 100644 --- a/libcxx/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h +++ b/libcxx/test/utilities/function.objects/func.wrap/func.wrap.func/test_allocator.h @@ -48,8 +48,13 @@ public: const_pointer address(const_reference x) const {return &x;} pointer allocate(size_type n, const void* = 0) { - if (count >= throw_after) + if (count >= throw_after) { +#ifndef _LIBCPP_NO_EXCEPTIONS throw std::bad_alloc(); +#else + std::terminate(); +#endif + } ++count; return (pointer)std::malloc(n * sizeof(T)); } -- cgit v1.2.3