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
diff --git a/libcxx/test/containers/stack_allocator.h b/libcxx/test/containers/stack_allocator.h
index 30f5871..e6af473 100644
--- a/libcxx/test/containers/stack_allocator.h
+++ b/libcxx/test/containers/stack_allocator.h
@@ -29,8 +29,13 @@
 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;