diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include <__utility/unreachable.h> -#include <__verbose_abort> #include #include #include @@ -111,15 +110,6 @@ return static_cast(end - begin); } -_LIBCPP_NORETURN static void __throw_runtime_error(const string &msg) -{ -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS - throw runtime_error(msg); -#else - _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg.c_str()); -#endif -} - } string @@ -739,8 +729,8 @@ __l_(newlocale(LC_ALL_MASK, n, 0)) { if (__l_ == 0) - __throw_runtime_error("collate_byname::collate_byname" - " failed to construct for " + string(n)); + __throw_runtime_error(("collate_byname::collate_byname" + " failed to construct for " + string(n)).c_str()); } collate_byname::collate_byname(const string& name, size_t refs) @@ -748,8 +738,8 @@ __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error("collate_byname::collate_byname" - " failed to construct for " + name); + __throw_runtime_error(("collate_byname::collate_byname" + " failed to construct for " + name).c_str()); } collate_byname::~collate_byname() @@ -788,8 +778,8 @@ __l_(newlocale(LC_ALL_MASK, n, 0)) { if (__l_ == 0) - __throw_runtime_error("collate_byname::collate_byname(size_t refs)" - " failed to construct for " + string(n)); + __throw_runtime_error(("collate_byname::collate_byname(size_t refs)" + " failed to construct for " + string(n)).c_str()); } collate_byname::collate_byname(const string& name, size_t refs) @@ -797,8 +787,8 @@ __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error("collate_byname::collate_byname(size_t refs)" - " failed to construct for " + name); + __throw_runtime_error(("collate_byname::collate_byname(size_t refs)" + " failed to construct for " + name).c_str()); } collate_byname::~collate_byname() @@ -1284,8 +1274,8 @@ __l_(newlocale(LC_ALL_MASK, name, 0)) { if (__l_ == 0) - __throw_runtime_error("ctype_byname::ctype_byname" - " failed to construct for " + string(name)); + __throw_runtime_error(("ctype_byname::ctype_byname" + " failed to construct for " + string(name)).c_str()); } ctype_byname::ctype_byname(const string& name, size_t refs) @@ -1293,8 +1283,8 @@ __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error("ctype_byname::ctype_byname" - " failed to construct for " + name); + __throw_runtime_error(("ctype_byname::ctype_byname" + " failed to construct for " + name).c_str()); } ctype_byname::~ctype_byname() @@ -1338,8 +1328,8 @@ __l_(newlocale(LC_ALL_MASK, name, 0)) { if (__l_ == 0) - __throw_runtime_error("ctype_byname::ctype_byname" - " failed to construct for " + string(name)); + __throw_runtime_error(("ctype_byname::ctype_byname" + " failed to construct for " + string(name)).c_str()); } ctype_byname::ctype_byname(const string& name, size_t refs) @@ -1347,8 +1337,8 @@ __l_(newlocale(LC_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error("ctype_byname::ctype_byname" - " failed to construct for " + name); + __throw_runtime_error(("ctype_byname::ctype_byname" + " failed to construct for " + name).c_str()); } ctype_byname::~ctype_byname() @@ -1609,8 +1599,8 @@ __l_(newlocale(LC_ALL_MASK, nm, 0)) { if (__l_ == 0) - __throw_runtime_error("codecvt_byname::codecvt_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("codecvt_byname::codecvt_byname" + " failed to construct for " + string(nm)).c_str()); } codecvt::~codecvt() @@ -4720,8 +4710,8 @@ { __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error("numpunct_byname::numpunct_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("numpunct_byname::numpunct_byname" + " failed to construct for " + string(nm)).c_str()); lconv* lc = __libcpp_localeconv_l(loc.get()); if (!checked_string_to_char_convert(__decimal_point_, lc->decimal_point, @@ -4761,8 +4751,8 @@ { __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error("numpunct_byname::numpunct_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("numpunct_byname::numpunct_byname" + " failed to construct for " + string(nm)).c_str()); lconv* lc = __libcpp_localeconv_l(loc.get()); checked_string_to_wchar_convert(__decimal_point_, lc->decimal_point, @@ -5193,16 +5183,14 @@ : __loc_(newlocale(LC_ALL_MASK, nm, 0)) { if (__loc_ == 0) - __throw_runtime_error("time_get_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str()); } __time_get::__time_get(const string& nm) : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0)) { if (__loc_ == 0) - __throw_runtime_error("time_get_byname" - " failed to construct for " + nm); + __throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str()); } __time_get::~__time_get() @@ -5851,16 +5839,14 @@ : __loc_(newlocale(LC_ALL_MASK, nm, 0)) { if (__loc_ == 0) - __throw_runtime_error("time_put_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str()); } __time_put::__time_put(const string& nm) : __loc_(newlocale(LC_ALL_MASK, nm.c_str(), 0)) { if (__loc_ == 0) - __throw_runtime_error("time_put_byname" - " failed to construct for " + nm); + __throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str()); } __time_put::~__time_put() @@ -6278,8 +6264,7 @@ typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error("moneypunct_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); lconv* lc = __libcpp_localeconv_l(loc.get()); if (!checked_string_to_char_convert(__decimal_point_, @@ -6322,8 +6307,7 @@ typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error("moneypunct_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); lconv* lc = __libcpp_localeconv_l(loc.get()); if (!checked_string_to_char_convert(__decimal_point_, @@ -6383,8 +6367,7 @@ typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error("moneypunct_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); lconv* lc = __libcpp_localeconv_l(loc.get()); if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, @@ -6448,8 +6431,7 @@ typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error("moneypunct_byname" - " failed to construct for " + string(nm)); + __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); lconv* lc = __libcpp_localeconv_l(loc.get()); if (!checked_string_to_wchar_convert(__decimal_point_, @@ -6527,15 +6509,6 @@ void __do_nothing(void*) {} -void __throw_runtime_error(const char* msg) -{ -#ifndef _LIBCPP_HAS_NO_EXCEPTIONS - throw runtime_error(msg); -#else - _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg); -#endif -} - template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate; _LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate;) diff --git a/libcxx/src/stdexcept.cpp b/libcxx/src/stdexcept.cpp --- a/libcxx/src/stdexcept.cpp +++ b/libcxx/src/stdexcept.cpp @@ -6,12 +6,25 @@ // //===----------------------------------------------------------------------===// +#include <__verbose_abort> #include #include #include #ifdef _LIBCPP_ABI_VCRUNTIME -#include "support/runtime/stdexcept_vcruntime.ipp" +# include "support/runtime/stdexcept_vcruntime.ipp" #else -#include "support/runtime/stdexcept_default.ipp" +# include "support/runtime/stdexcept_default.ipp" #endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +_LIBCPP_NORETURN void __throw_runtime_error(const char* msg) { +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS + throw runtime_error(msg); +#else + _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg); +#endif +} + +_LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -556,7 +556,6 @@ libcxx/src/random.cpp libcxx/src/random_shuffle.cpp libcxx/src/regex.cpp -libcxx/src/stdexcept.cpp libcxx/src/std_stream.h libcxx/src/string.cpp libcxx/src/strstream.cpp