summaryrefslogtreecommitdiff
path: root/include/exception
diff options
context:
space:
mode:
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 686e4ecd05783..186d379f08f5f 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