summaryrefslogtreecommitdiff
path: root/include/exception
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:47:26 +0000
commit51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch)
tree91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /include/exception
parentbb5e33f003797b67974a8893f7f2930fc51b8210 (diff)
Notes
Diffstat (limited to 'include/exception')
-rw-r--r--include/exception19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/exception b/include/exception
index 686e4ecd0578..186d379f08f5 100644
--- a/include/exception
+++ b/include/exception
@@ -80,6 +80,10 @@ template <class E> void rethrow_if_nested(const E& e);
#include <__config>
#include <cstddef>
#include <type_traits>
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+#include <cstdio>
+#include <cstdlib>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -251,4 +255,19 @@ rethrow_if_nested(const _Ep&, typename enable_if<
} // std
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Exception>
+_LIBCPP_INLINE_VISIBILITY
+inline void __libcpp_throw(_Exception const& __e) {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw __e;
+#else
+ _VSTD::fprintf(stderr, "%s\n", __e.what());
+ _VSTD::abort();
+#endif
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
#endif // _LIBCPP_EXCEPTION