diff --git a/libcxx/include/__format/format_error.h b/libcxx/include/__format/format_error.h --- a/libcxx/include/__format/format_error.h +++ b/libcxx/include/__format/format_error.h @@ -11,7 +11,7 @@ #define _LIBCPP___FORMAT_FORMAT_ERROR_H #include <__config> -#include +#include <__verbose_abort> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -40,8 +40,7 @@ #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw format_error(__s); #else - (void)__s; - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("format_error was thrown in -fno-exceptions mode with message \"%s\"", __s); #endif } diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include <__utility/unreachable.h> +#include <__verbose_abort> #include #include #include @@ -115,8 +116,7 @@ #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw runtime_error(msg); #else - (void)msg; - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg.c_str()); #endif } @@ -6532,8 +6532,7 @@ #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw runtime_error(msg); #else - (void)msg; - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg); #endif } diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp --- a/libcxx/src/string.cpp +++ b/libcxx/src/string.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -61,22 +60,12 @@ namespace { -template -inline void throw_helper(const string& msg) { -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS - throw T(msg); -#else - fprintf(stderr, "%s\n", msg.c_str()); - _VSTD::abort(); -#endif -} - inline void throw_from_string_out_of_range(const string& func) { - throw_helper(func + ": out of range"); + std::__throw_out_of_range((func + ": out of range").c_str()); } inline void throw_from_string_invalid_arg(const string& func) { - throw_helper(func + ": no conversion"); + std::__throw_invalid_argument((func + ": no conversion").c_str()); } // as_integer diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -12,6 +12,7 @@ #endif #include <__assert> +#include <__verbose_abort> #include #include #include @@ -289,9 +290,7 @@ #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw system_error(error_code(ev, system_category()), what_arg); #else - (void)ev; - (void)what_arg; - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("system_error was thrown in -fno-exceptions mode with error %i and message \"%s\"", ev, what_arg); #endif }