This provides better error messages when the program terminates due to
an exception being thrown in -fno-exceptions mode. Those seem to have
been missed in https://reviews.llvm.org/D141222.
Details
- Reviewers
philnik Mordante - Group Reviewers
Restricted Project - Commits
- rGc9c3cddb5e99: [libc++] Use _LIBCPP_VERBOSE_ABORT in a few remaining __throw_FOO functions
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
libcxx/src/system_error.cpp | ||
---|---|---|
288 | Maybe we should add an overload for std::error_code and replace uses, so we can use error_code::message() for a nicer error message. |
LGTM modulo one nit.
libcxx/include/__format/format_error.h | ||
---|---|---|
15 | I assume this header is no longer needed. At least for format and the dylib we can remove them unconditionally. |
libcxx/src/system_error.cpp | ||
---|---|---|
288 | Would you put that into the dylib? So you'd do this from uses: if (__m_ == nullptr) __throw_system_error(std::make_error_code(std::errc::operation_not_permitted), "unique_lock::lock: references null mutex"); // instead of if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); and then the overload would look like this? _LIBCPP_NORETURN void __throw_system_error(error_code const& __code, char const* __what_arg) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw system_error(__code, what_arg); #else _LIBCPP_VERBOSE_ABORT("system_error was thrown in -fno-exceptions mode with error_code \"%s\" and message \"%s\"", __code.message(), what_arg); #endif } |
libcxx/src/system_error.cpp | ||
---|---|---|
288 | Yeah, something like that. I wouldn't bother putting it in the dylib though. I don't even know why the have __throw_system_error in the dylib. |
I assume this header is no longer needed. At least for format and the dylib we can remove them unconditionally.