From 280d68e7f808af74ca48cfeb849e6ac910f96e5c Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 11 Jul 2023 14:55:26 -0400 Subject: [libc++] Clean up mess around __throw_runtime_error We were defining the function in locale.cpp, and we actually had two overloads for it. This is pretty confusing given that one was static and not exported from the dylib, and the other one was. Instead, use the vanilla __throw_runtime_error function everywhere even though that adds a tiny bit of code duplication. Differential Revision: https://reviews.llvm.org/D155008 --- libcxx/src/stdexcept.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'libcxx/src/stdexcept.cpp') 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 #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 -- cgit v1.1