aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/locale.cpp87
-rw-r--r--libcxx/src/stdexcept.cpp17
2 files changed, 45 insertions, 59 deletions
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index bd70a27..3922bd8 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include <__utility/unreachable.h>
-#include <__verbose_abort>
#include <algorithm>
#include <clocale>
#include <codecvt>
@@ -111,15 +110,6 @@ countof(const T * const begin, const T * const end)
return static_cast<size_t>(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 @@ collate_byname<char>::collate_byname(const char* n, size_t refs)
__l_(newlocale(LC_ALL_MASK, n, 0))
{
if (__l_ == 0)
- __throw_runtime_error("collate_byname<char>::collate_byname"
- " failed to construct for " + string(n));
+ __throw_runtime_error(("collate_byname<char>::collate_byname"
+ " failed to construct for " + string(n)).c_str());
}
collate_byname<char>::collate_byname(const string& name, size_t refs)
@@ -748,8 +738,8 @@ collate_byname<char>::collate_byname(const string& name, size_t refs)
__l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
{
if (__l_ == 0)
- __throw_runtime_error("collate_byname<char>::collate_byname"
- " failed to construct for " + name);
+ __throw_runtime_error(("collate_byname<char>::collate_byname"
+ " failed to construct for " + name).c_str());
}
collate_byname<char>::~collate_byname()
@@ -788,8 +778,8 @@ collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
__l_(newlocale(LC_ALL_MASK, n, 0))
{
if (__l_ == 0)
- __throw_runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
- " failed to construct for " + string(n));
+ __throw_runtime_error(("collate_byname<wchar_t>::collate_byname(size_t refs)"
+ " failed to construct for " + string(n)).c_str());
}
collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
@@ -797,8 +787,8 @@ collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
__l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
{
if (__l_ == 0)
- __throw_runtime_error("collate_byname<wchar_t>::collate_byname(size_t refs)"
- " failed to construct for " + name);
+ __throw_runtime_error(("collate_byname<wchar_t>::collate_byname(size_t refs)"
+ " failed to construct for " + name).c_str());
}
collate_byname<wchar_t>::~collate_byname()
@@ -1284,8 +1274,8 @@ ctype_byname<char>::ctype_byname(const char* name, size_t refs)
__l_(newlocale(LC_ALL_MASK, name, 0))
{
if (__l_ == 0)
- __throw_runtime_error("ctype_byname<char>::ctype_byname"
- " failed to construct for " + string(name));
+ __throw_runtime_error(("ctype_byname<char>::ctype_byname"
+ " failed to construct for " + string(name)).c_str());
}
ctype_byname<char>::ctype_byname(const string& name, size_t refs)
@@ -1293,8 +1283,8 @@ ctype_byname<char>::ctype_byname(const string& name, size_t refs)
__l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
{
if (__l_ == 0)
- __throw_runtime_error("ctype_byname<char>::ctype_byname"
- " failed to construct for " + name);
+ __throw_runtime_error(("ctype_byname<char>::ctype_byname"
+ " failed to construct for " + name).c_str());
}
ctype_byname<char>::~ctype_byname()
@@ -1338,8 +1328,8 @@ ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
__l_(newlocale(LC_ALL_MASK, name, 0))
{
if (__l_ == 0)
- __throw_runtime_error("ctype_byname<wchar_t>::ctype_byname"
- " failed to construct for " + string(name));
+ __throw_runtime_error(("ctype_byname<wchar_t>::ctype_byname"
+ " failed to construct for " + string(name)).c_str());
}
ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
@@ -1347,8 +1337,8 @@ ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
__l_(newlocale(LC_ALL_MASK, name.c_str(), 0))
{
if (__l_ == 0)
- __throw_runtime_error("ctype_byname<wchar_t>::ctype_byname"
- " failed to construct for " + name);
+ __throw_runtime_error(("ctype_byname<wchar_t>::ctype_byname"
+ " failed to construct for " + name).c_str());
}
ctype_byname<wchar_t>::~ctype_byname()
@@ -1609,8 +1599,8 @@ codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs)
__l_(newlocale(LC_ALL_MASK, nm, 0))
{
if (__l_ == 0)
- __throw_runtime_error("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
- " failed to construct for " + string(nm));
+ __throw_runtime_error(("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
+ " failed to construct for " + string(nm)).c_str());
}
codecvt<wchar_t, char, mbstate_t>::~codecvt()
@@ -4720,8 +4710,8 @@ numpunct_byname<char>::__init(const char* nm)
{
__libcpp_unique_locale loc(nm);
if (!loc)
- __throw_runtime_error("numpunct_byname<char>::numpunct_byname"
- " failed to construct for " + string(nm));
+ __throw_runtime_error(("numpunct_byname<char>::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 @@ numpunct_byname<wchar_t>::__init(const char* nm)
{
__libcpp_unique_locale loc(nm);
if (!loc)
- __throw_runtime_error("numpunct_byname<wchar_t>::numpunct_byname"
- " failed to construct for " + string(nm));
+ __throw_runtime_error(("numpunct_byname<wchar_t>::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 @@ __time_get::__time_get(const char* nm)
: __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 @@ __time_put::__time_put(const char* nm)
: __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 @@ moneypunct_byname<char, false>::init(const char* nm)
typedef moneypunct<char, false> 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 @@ moneypunct_byname<char, true>::init(const char* nm)
typedef moneypunct<char, true> 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 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
typedef moneypunct<wchar_t, false> 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 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
typedef moneypunct<wchar_t, true> 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 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
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<char>;
_LIBCPP_IF_WIDE_CHARACTERS(template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<wchar_t>;)
diff --git a/libcxx/src/stdexcept.cpp b/libcxx/src/stdexcept.cpp
index d5c9173..bc25c0f 100644
--- a/libcxx/src/stdexcept.cpp
+++ b/libcxx/src/stdexcept.cpp
@@ -6,12 +6,25 @@
//
//===----------------------------------------------------------------------===//
+#include <__verbose_abort>
#include <new>
#include <stdexcept>
#include <string>
#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