Index: libcxx/src/any.cpp =================================================================== --- libcxx/src/any.cpp +++ libcxx/src/any.cpp @@ -7,13 +7,11 @@ //===----------------------------------------------------------------------===// #include +#include "include/error_message.h" namespace std { -const char* bad_any_cast::what() const noexcept { - return "bad any cast"; +const char* bad_any_cast::what() const noexcept { return getRuntimeErrorString(RM_BAD_ANY_CAST); } } -} - #include @@ -27,8 +25,6 @@ virtual const char* what() const noexcept; }; -const char* bad_any_cast::what() const noexcept { - return "bad any cast"; -} +const char* bad_any_cast::what() const noexcept { return getRuntimeErrorString(RM_BAD_ANY_CAST); } _LIBCPP_END_NAMESPACE_LFTS Index: libcxx/src/functional.cpp =================================================================== --- libcxx/src/functional.cpp +++ libcxx/src/functional.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include +#include "include/error_message.h" _LIBCPP_BEGIN_NAMESPACE_STD @@ -20,7 +21,7 @@ const char* bad_function_call::what() const noexcept { - return "std::bad_function_call"; + return getRuntimeErrorString(RM_BAD_FUNCTION_CALL); } #endif Index: libcxx/src/future.cpp =================================================================== --- libcxx/src/future.cpp +++ libcxx/src/future.cpp @@ -12,6 +12,7 @@ #include #include +#include "include/error_message.h" _LIBCPP_BEGIN_NAMESPACE_STD @@ -40,18 +41,15 @@ { case future_errc(0): // For backwards compatibility with C++11 (LWG 2056) case future_errc::broken_promise: - return string("The associated promise has been destructed prior " - "to the associated state becoming ready."); + return string(getRuntimeErrorString(RM_BROKEN_PROMISE)); case future_errc::future_already_retrieved: - return string("The future has already been retrieved from " - "the promise or packaged_task."); + return string(getRuntimeErrorString(RM_FUTURE_ALREADY_RETRIEVED)); case future_errc::promise_already_satisfied: - return string("The state of the promise has already been set."); + return string(getRuntimeErrorString(RM_PROMISE_ALREADY_SATISFIED)); case future_errc::no_state: - return string("Operation not permitted on an object without " - "an associated state."); + return string(getRuntimeErrorString(RM_NO_STATE)); } - return string("unspecified future_errc value\n"); + return string(getRuntimeErrorString(RM_UNSPECIFIED_FEV)); } _LIBCPP_DIAGNOSTIC_POP Index: libcxx/src/include/error_message.h =================================================================== --- /dev/null +++ libcxx/src/include/error_message.h @@ -0,0 +1,94 @@ +//===----------------------------------------------------------------------===//// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===//// + +#ifndef ERROR_MESSAGE_H +#define ERROR_MESSAGE_H + +#ifdef __MVS__ +# define _AE_BIMODAL 1 +# include <_Nascii.h> +#endif + +#include "__config" + +#define ErrorList \ + ErrMsg(RM_BROKEN_PROMISE, \ + "The associated promise has been destructed prior to the associated state becoming ready."), \ + ErrMsg(RM_FUTURE_ALREADY_RETRIEVED, "The future has already been retrieved from the promise or packaged_task."), \ + ErrMsg(RM_PROMISE_ALREADY_SATISFIED, "The state of the promise has already been set."), \ + ErrMsg(RM_NO_STATE, "Operation not permitted on an object without an associated state."), \ + ErrMsg(RM_UNSPECIFIED_FEV, "unspecified future_errc value\n"), \ + ErrMsg(RM_PURE_VIRTUAL_FUNCTION, "Pure virtual function called!"), \ + ErrMsg(RM_DELETED_VIRTUAL_FUNCTION, "Deleted virtual function called!"), \ + ErrMsg(RM_WHAT_BAD_OPTIONAL, "bad_optional_access"), \ + ErrMsg(RM_LIBCXXABI, "libc++abi: "), \ + ErrMsg(RM_NL, "\n"), \ + ErrMsg(RM_UNSPECIFIED_ICE, "unspecified iostream_category error"), \ + ErrMsg(RM_STRERROR_MSG, "unexpected error from ::strerror_r"), \ + ErrMsg(RM_UNKNOWN_ERROR, "Unknown error %d"), \ + ErrMsg(RM_UNSPECIFIED_GCE, "unspecified generic_category error"), \ + ErrMsg(RM_UNSPECIFIED_SCE, "unspecified system_category error"), \ + ErrMsg(RM_BAD_ANY_CAST, "bad any cast"), \ + ErrMsg(RM_BAD_FUNCTION_CALL, "std::bad_function_call"), \ + ErrMsg(RM_BAD_WEAK_PTR, "bad_weak_ptr"), \ + ErrMsg(RM_BAD_VARIANT_ACS, "bad_variant_access"), \ + ErrMsg(RM_TERMINATE_EXCEPT_WHAT, "terminating with %s exception of type %s: %s"), \ + ErrMsg(RM_TERMINATE_EXCEPT, "terminating with %s exception of type %s"), \ + ErrMsg(RM_TERMINATE, "terminating"), \ + ErrMsg(RM_FOREIGN_EXCEPTION, "terminating with %s foreign exception"), \ + ErrMsg(RM_TERMINATE_CAUSE_UNCAUGHT, "uncaught"), \ + ErrMsg(RM_TERMINATE_CAUSE_UNEXPECTED, "unexpected"), \ + ErrMsg(RM_CANNOT_ZERO_TLS, "cannot zero out thread value for __cxa_get_globals()"), \ + ErrMsg(RM_CANNOT_CREATE_TLS_KEY, "cannot create thread specific key for __cxa_get_globals()"), \ + ErrMsg(RM_CANNOT_ALLOC_EH_GLOBALS, "cannot allocate __cxa_eh_globals"), \ + ErrMsg(RM_TLS_SET_EH_GLOBALS, "std::__libcpp_tls_set failure in __cxa_get_globals()"), \ + ErrMsg(RM_THREAD_EXIT_TLS_CREATE, "std::__libcpp_tls_create() failed in __cxa_thread_atexit()"), \ + ErrMsg(RM_EH_GLOBALS_FAST_EXECUTE_ONCE, "execute once failure in __cxa_get_globals_fast()"), \ + ErrMsg(RM_VECTOR_ALLOC, "__cxa_vec_new failed to allocate memory"), \ + ErrMsg(RM_RETURNED_FROM_UNEXPECTED_HANDLER, "unexpected_handler unexpectedly returned"), \ + ErrMsg(RM_RETURNED_FROM_TERMINATE_HANDLER, "terminate_handler unexpectedly returned"), \ + ErrMsg(RM_THROW_INSIDE_TERMINATE_HANDLER, "terminate_handler unexpectedly threw an exception"), \ + ErrMsg(RM_CXA_GUARD_ACQUIRE, "__cxa_guard_acquire"), \ + ErrMsg(RM_CXA_GUARD_ACQUIRE_RECURSIVE, "__cxa_guard_acquire detected recursive initialization"), \ + ErrMsg(RM_CXA_GUARD_RELEASE_BROADCAST, "__cxa_guard_release failed to broadcast"), \ + ErrMsg(RM_CXA_GUARD_ABORT_BROADCAST, "__cxa_guard_abort failed to broadcast"), \ + ErrMsg(RM_CXA_GUARD_RELEASE, "__cxa_guard_release"), \ + ErrMsg(RM_CXA_GUARD_ABORT, "__cxa_guard_abort"), \ + ErrMsg(RM_MUTEX_ACQUIRE, "%s failed to acquire mutex"), \ + ErrMsg(RM_MUTEX_RELEASE, "%s failed to release mutex"), \ + ErrMsg(RM_FUTEX, "Futex selected but not supported"), \ + + +#define ErrMsg(N, D) N +enum Errs { ErrorList }; +#undef ErrMsg + +#define ErrMsg(N, D) D +#ifdef __MVS__ +# pragma convert("IBM-1047") +static constexpr const char* const ErrTextEBCDIC[] = {ErrorList}; +# pragma convert(pop) +# pragma convert("ISO8859-1") +static constexpr const char* const ErrTextASCII[] = {ErrorList}; +# pragma convert(pop) +#endif +static constexpr const char* const ErrText[] = {ErrorList}; + +#undef ErrMsg + +#ifdef __MVS__ +_LIBCPP_INLINE_VISIBILITY +inline const char* getRuntimeErrorString(int error) _NOEXCEPT { + return (__isASCII() ? ErrTextASCII[error] : ErrTextEBCDIC[error]); +} +#else +_LIBCPP_INLINE_VISIBILITY +inline constexpr const char* getRuntimeErrorString(int error) _NOEXCEPT { return ErrText[error]; } +#endif + +#endif // ERROR_MESSAGE_H Index: libcxx/src/ios.cpp =================================================================== --- libcxx/src/ios.cpp +++ libcxx/src/ios.cpp @@ -17,6 +17,7 @@ #include #include "include/config_elast.h" +#include "include/error_message.h" _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -46,7 +47,7 @@ #endif // _LIBCPP_ELAST ) return __do_message::message(ev); - return string("unspecified iostream_category error"); + return string(getRuntimeErrorString(RM_UNSPECIFIED_ICE)); } const error_category& Index: libcxx/src/memory.cpp =================================================================== --- libcxx/src/memory.cpp +++ libcxx/src/memory.cpp @@ -17,6 +17,7 @@ #endif #include "include/atomic_support.h" +#include "include/error_message.h" _LIBCPP_BEGIN_NAMESPACE_STD @@ -24,11 +25,7 @@ bad_weak_ptr::~bad_weak_ptr() noexcept {} -const char* -bad_weak_ptr::what() const noexcept -{ - return "bad_weak_ptr"; -} +const char* bad_weak_ptr::what() const noexcept { return getRuntimeErrorString(RM_BAD_WEAK_PTR); } __shared_count::~__shared_count() { Index: libcxx/src/optional.cpp =================================================================== --- libcxx/src/optional.cpp +++ libcxx/src/optional.cpp @@ -8,15 +8,14 @@ #include <__availability> #include +#include "include/error_message.h" namespace std { bad_optional_access::~bad_optional_access() noexcept = default; -const char* bad_optional_access::what() const noexcept { - return "bad_optional_access"; - } +const char* bad_optional_access::what() const noexcept { return getRuntimeErrorString(RM_WHAT_BAD_OPTIONAL); } } // std Index: libcxx/src/system_error.cpp =================================================================== --- libcxx/src/system_error.cpp +++ libcxx/src/system_error.cpp @@ -17,6 +17,7 @@ #include #include "include/config_elast.h" +#include "include/error_message.h" #if defined(__ANDROID__) #include @@ -99,7 +100,8 @@ if (new_errno == EINVAL) return ""; - _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerror_r"); + _LIBCPP_ASSERT(new_errno == ERANGE, getRuntimeErrorString(RM_STRERROR_MSG)); + // FIXME maybe? 'strerror_buff_size' is likely to exceed the // maximum error size so ERANGE shouldn't be returned. std::abort(); @@ -116,7 +118,14 @@ ::strerror_r(ev, buffer, strerror_buff_size), buffer); // If we didn't get any message, print one now. if (!error_message[0]) { - std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev); +#if defined(__MVS__) + if (__isASCII()) + __snprintf_a(buffer, strerror_buff_size, getRuntimeErrorString(RM_UNKNOWN_ERROR), ev); + else + __snprintf_e(buffer, strerror_buff_size, getRuntimeErrorString(RM_UNKNOWN_ERROR), ev); +#else + std::snprintf(buffer, strerror_buff_size, getRuntimeErrorString(RM_UNKNOWN_ERROR), ev); +#endif error_message = buffer; } errno = old_errno; @@ -154,9 +163,9 @@ __generic_error_category::message(int ev) const { #ifdef _LIBCPP_ELAST - if (ev > _LIBCPP_ELAST) - return string("unspecified generic_category error"); -#endif // _LIBCPP_ELAST + if (ev > _LIBCPP_ELAST) + return string(getRuntimeErrorString(RM_UNSPECIFIED_GCE)); +#endif // _LIBCPP_ELAST return __do_message::message(ev); } @@ -186,9 +195,9 @@ __system_error_category::message(int ev) const { #ifdef _LIBCPP_ELAST - if (ev > _LIBCPP_ELAST) - return string("unspecified system_category error"); -#endif // _LIBCPP_ELAST + if (ev > _LIBCPP_ELAST) + return string(getRuntimeErrorString(RM_UNSPECIFIED_SCE)); +#endif // _LIBCPP_ELAST return __do_message::message(ev); } Index: libcxx/src/variant.cpp =================================================================== --- libcxx/src/variant.cpp +++ libcxx/src/variant.cpp @@ -7,11 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include "include/error_message.h" namespace std { -const char* bad_variant_access::what() const noexcept { - return "bad_variant_access"; -} +const char* bad_variant_access::what() const noexcept { return getRuntimeErrorString(RM_BAD_VARIANT_ACS); } } // namespace std Index: libcxxabi/src/abort_message.h =================================================================== --- libcxxabi/src/abort_message.h +++ libcxxabi/src/abort_message.h @@ -9,9 +9,12 @@ #ifndef __ABORT_MESSAGE_H_ #define __ABORT_MESSAGE_H_ +#include #include "cxxabi.h" extern "C" _LIBCXXABI_HIDDEN _LIBCXXABI_NORETURN void -abort_message(const char *format, ...) __attribute__((format(printf, 1, 2))); +abort_message_check(Errs, const char*, ...) __attribute__((format(printf, 2, 0))); + +#define abort_message(m, ...) abort_message_check(m, ErrText[m] __VA_OPT__(,) __VA_ARGS__) #endif Index: libcxxabi/src/abort_message.cpp =================================================================== --- libcxxabi/src/abort_message.cpp +++ libcxxabi/src/abort_message.cpp @@ -5,11 +5,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// - +#include "abort_message.h" #include #include #include -#include "abort_message.h" #ifdef __BIONIC__ # include @@ -26,19 +25,37 @@ # define _LIBCXXABI_USE_CRASHREPORTER_CLIENT #endif -void abort_message(const char* format, ...) +void abort_message_check(Errs m, const char* _format, ...) { // Write message to stderr. We do this before formatting into a // variable-size buffer so that we still get some information if // formatting into the variable-sized buffer fails. #if !defined(NDEBUG) || !defined(LIBCXXABI_BAREMETAL) { - fprintf(stderr, "libc++abi: "); - va_list list; - va_start(list, format); - vfprintf(stderr, format, list); - va_end(list); - fprintf(stderr, "\n"); +#if defined(__MVS__) + if (__isASCII()) + __fprintf_a(stderr, getRuntimeErrorString(RM_LIBCXXABI)); + else + __fprintf_e(stderr, getRuntimeErrorString(RM_LIBCXXABI)); + va_list list; + va_start(list, _format); + if (__isASCII()) + __vfprintf_a(stderr, getRuntimeErrorString(m), list); + else + __vfprintf_e(stderr, getRuntimeErrorString(m), list); + va_end(list); + if (__isASCII()) + __fprintf_a(stderr, getRuntimeErrorString(RM_NL)); + else + __fprintf_e(stderr, getRuntimeErrorString(RM_NL)); +#else + fprintf(stderr, getRuntimeErrorString(RM_LIBCXXABI)); + va_list list; + va_start(list, _format); + vfprintf(stderr, getRuntimeErrorString(m), list); + va_end(list); + fprintf(stderr, getRuntimeErrorString(RM_NL)); +#endif } #endif @@ -47,16 +64,16 @@ #if defined(_LIBCXXABI_USE_CRASHREPORTER_CLIENT) char* buffer; va_list list; - va_start(list, format); - vasprintf(&buffer, format, list); + va_start(list, _format); + vasprintf(&buffer, getRuntimeErrorString(m), list); va_end(list); CRSetCrashLogMessage(buffer); #elif defined(__BIONIC__) char* buffer; va_list list; - va_start(list, format); - vasprintf(&buffer, format, list); + va_start(list, _format); + vasprintf(&buffer, getRuntimeErrorString(m), list); va_end(list); # if __ANDROID_API__ >= 21 Index: libcxxabi/src/cxa_default_handlers.cpp =================================================================== --- libcxxabi/src/cxa_default_handlers.cpp +++ libcxxabi/src/cxa_default_handlers.cpp @@ -20,7 +20,7 @@ #if !defined(LIBCXXABI_SILENT_TERMINATE) -static constinit const char* cause = "uncaught"; +static Errs cause = RM_TERMINATE_CAUSE_UNCAUGHT; __attribute__((noreturn)) static void demangling_terminate_handler() @@ -63,28 +63,28 @@ { // Include the what() message from the exception const std::exception* e = static_cast(thrown_object); - abort_message("terminating with %s exception of type %s: %s", - cause, name, e->what()); + abort_message(RM_TERMINATE_EXCEPT_WHAT, + getRuntimeErrorString(cause), name, e->what()); } else // Else just note that we're terminating with an exception - abort_message("terminating with %s exception of type %s", - cause, name); + abort_message(RM_TERMINATE_EXCEPT, + getRuntimeErrorString(cause), name); } else // Else we're terminating with a foreign exception - abort_message("terminating with %s foreign exception", cause); + abort_message(RM_FOREIGN_EXCEPTION, getRuntimeErrorString(cause)); } } #endif // Else just note that we're terminating - abort_message("terminating"); + abort_message(RM_TERMINATE); } __attribute__((noreturn)) static void demangling_unexpected_handler() { - cause = "unexpected"; + cause = RM_TERMINATE_CAUSE_UNEXPECTED; std::terminate(); } Index: libcxxabi/src/cxa_exception_storage.cpp =================================================================== --- libcxxabi/src/cxa_exception_storage.cpp +++ libcxxabi/src/cxa_exception_storage.cpp @@ -61,12 +61,12 @@ void _LIBCPP_TLS_DESTRUCTOR_CC destruct_(void *p) { __free_with_fallback(p); if (0 != std::__libcpp_tls_set(key_, NULL)) - abort_message("cannot zero out thread value for __cxa_get_globals()"); + abort_message(RM_CANNOT_ZERO_TLS); } void construct_() { if (0 != std::__libcpp_tls_create(&key_, destruct_)) - abort_message("cannot create thread specific key for __cxa_get_globals()"); + abort_message(RM_CANNOT_CREATE_TLS_KEY); } } // namespace @@ -80,9 +80,9 @@ retVal = static_cast<__cxa_eh_globals*>( __calloc_with_fallback(1, sizeof(__cxa_eh_globals))); if (NULL == retVal) - abort_message("cannot allocate __cxa_eh_globals"); + abort_message(RM_CANNOT_ALLOC_EH_GLOBALS); if (0 != std::__libcpp_tls_set(key_, retVal)) - abort_message("std::__libcpp_tls_set failure in __cxa_get_globals()"); + abort_message(RM_TLS_SET_EH_GLOBALS); } return retVal; } @@ -94,7 +94,7 @@ __cxa_eh_globals *__cxa_get_globals_fast() { // First time through, create the key. if (0 != std::__libcpp_execute_once(&flag_, construct_)) - abort_message("execute once failure in __cxa_get_globals_fast()"); + abort_message(RM_EH_GLOBALS_FAST_EXECUTE_ONCE); return static_cast<__cxa_eh_globals*>(std::__libcpp_tls_get(key_)); } } // extern "C" Index: libcxxabi/src/cxa_guard_impl.h =================================================================== --- libcxxabi/src/cxa_guard_impl.h +++ libcxxabi/src/cxa_guard_impl.h @@ -45,6 +45,7 @@ #include "__cxxabi_config.h" #include "include/atomic_support.h" // from libc++ +#include #if defined(__has_include) # if __has_include() # include @@ -251,7 +252,7 @@ if (*init_byte_address == COMPLETE_BIT) return true; if (*init_byte_address & PENDING_BIT) - ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization"); + ABORT_WITH_MESSAGE(RM_CXA_GUARD_ACQUIRE_RECURSIVE); *init_byte_address = PENDING_BIT; return false; } @@ -317,11 +318,11 @@ /// The init byte portion of cxa_guard_acquire. Returns true if /// initialization has already been completed. bool acquire() { - LockGuard g("__cxa_guard_acquire"); + LockGuard g(RM_CXA_GUARD_ACQUIRE); // Check for possible recursive initialization. if (has_thread_id_support && (*init_byte_address & PENDING_BIT)) { if (*thread_id_address == current_thread_id.get()) - ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization"); + ABORT_WITH_MESSAGE(RM_CXA_GUARD_ACQUIRE_RECURSIVE); } // Wait until the pending bit is not set. @@ -344,13 +345,13 @@ void release() { bool has_waiting; { - LockGuard g("__cxa_guard_release"); + LockGuard g(RM_CXA_GUARD_RELEASE); has_waiting = *init_byte_address & WAITING_BIT; *init_byte_address = COMPLETE_BIT; } if (has_waiting) { if (global_cond.broadcast()) { - ABORT_WITH_MESSAGE("%s failed to broadcast", "__cxa_guard_release"); + ABORT_WITH_MESSAGE(RM_CXA_GUARD_RELEASE_BROADCAST); } } } @@ -359,7 +360,7 @@ void abort() { bool has_waiting; { - LockGuard g("__cxa_guard_abort"); + LockGuard g(RM_CXA_GUARD_ABORT); if (has_thread_id_support) *thread_id_address = 0; has_waiting = *init_byte_address & WAITING_BIT; @@ -367,7 +368,7 @@ } if (has_waiting) { if (global_cond.broadcast()) { - ABORT_WITH_MESSAGE("%s failed to broadcast", "__cxa_guard_abort"); + ABORT_WITH_MESSAGE(RM_CXA_GUARD_ABORT_BROADCAST); } } } @@ -388,18 +389,18 @@ LockGuard(LockGuard const&) = delete; LockGuard& operator=(LockGuard const&) = delete; - explicit LockGuard(const char* calling_func) : calling_func_(calling_func) { + explicit LockGuard(Errs calling_func) : calling_func_(calling_func) { if (global_mutex.lock()) - ABORT_WITH_MESSAGE("%s failed to acquire mutex", calling_func_); + ABORT_WITH_MESSAGE(RM_MUTEX_ACQUIRE, getRuntimeErrorString(calling_func_)); } ~LockGuard() { if (global_mutex.unlock()) - ABORT_WITH_MESSAGE("%s failed to release mutex", calling_func_); + ABORT_WITH_MESSAGE(RM_MUTEX_RELEASE, getRuntimeErrorString(calling_func_)); } private: - const char* const calling_func_; + Errs calling_func_; }; }; @@ -456,7 +457,7 @@ // Check for recursive initialization if (has_thread_id_support && thread_id.load(std::_AO_Relaxed) == current_thread_id.get()) { - ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization"); + ABORT_WITH_MESSAGE(RM_CXA_GUARD_ACQUIRE_RECURSIVE); } if ((last_val & WAITING_BIT) == 0) { Index: libcxxabi/src/cxa_handlers.cpp =================================================================== --- libcxxabi/src/cxa_handlers.cpp +++ libcxxabi/src/cxa_handlers.cpp @@ -33,7 +33,7 @@ { func(); // unexpected handler should not return - abort_message("unexpected_handler unexpectedly returned"); + abort_message(RM_RETURNED_FROM_UNEXPECTED_HANDLER); } __attribute__((noreturn)) @@ -58,13 +58,13 @@ #endif // _LIBCXXABI_NO_EXCEPTIONS func(); // handler should not return - abort_message("terminate_handler unexpectedly returned"); + abort_message(RM_RETURNED_FROM_TERMINATE_HANDLER); #ifndef _LIBCXXABI_NO_EXCEPTIONS } catch (...) { // handler should not throw exception - abort_message("terminate_handler unexpectedly threw an exception"); + abort_message(RM_THROW_INSIDE_TERMINATE_HANDLER); } #endif // _LIBCXXABI_NO_EXCEPTIONS } Index: libcxxabi/src/cxa_thread_atexit.cpp =================================================================== --- libcxxabi/src/cxa_thread_atexit.cpp +++ libcxxabi/src/cxa_thread_atexit.cpp @@ -89,7 +89,7 @@ // __cxa_thread_atexit() may be called arbitrarily late (for example, from // global destructors or atexit() handlers). if (std::__libcpp_tls_create(&dtors_key, run_dtors) != 0) { - abort_message("std::__libcpp_tls_create() failed in __cxa_thread_atexit()"); + abort_message(RM_THREAD_EXIT_TLS_CREATE); } } Index: libcxxabi/src/cxa_vector.cpp =================================================================== --- libcxxabi/src/cxa_vector.cpp +++ libcxxabi/src/cxa_vector.cpp @@ -121,7 +121,7 @@ #ifndef _LIBCXXABI_NO_EXCEPTIONS throw std::bad_array_new_length(); #else - abort_message("__cxa_vec_new failed to allocate memory"); + abort_message(RM_VECTOR_ALLOC); #endif } Index: libcxxabi/src/cxa_virtual.cpp =================================================================== --- libcxxabi/src/cxa_virtual.cpp +++ libcxxabi/src/cxa_virtual.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include #include "cxxabi.h" #include "abort_message.h" @@ -13,12 +14,12 @@ extern "C" { _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_pure_virtual(void) { - abort_message("Pure virtual function called!"); + abort_message(RM_PURE_VIRTUAL_FUNCTION); } _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_deleted_virtual(void) { - abort_message("Deleted virtual function called!"); + abort_message(RM_DELETED_VIRTUAL_FUNCTION); } } // extern "C" } // abi