This results in proper error messages instead of just an abort.
Reviewed By: ldionne, Mordante, #libc
Spies: #libc_vendors, smeenai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D141222
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__utility/swap.h>
+#include <__verbose_abort>
#include <cstdlib> // for std::abort
#include <initializer_list>
throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
# else
(void)__arg;
- std::abort();
+ std::__libcpp_verbose_abort("bad_expected_access was thrown in -fno-exceptions mode");
# endif
}
#include <__filesystem/path.h>
#include <__memory/shared_ptr.h>
#include <__utility/forward.h>
+#include <__verbose_abort>
#include <iosfwd>
#include <new>
#include <system_error>
}
#else
void __throw_filesystem_error(_Args&&...) {
- _VSTD::abort();
+ std::__libcpp_verbose_abort("filesystem_error was thrown in -fno-exceptions mode");
}
#endif
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
#include <__utility/move.h>
#include <__utility/piecewise_construct.h>
#include <__utility/swap.h>
+#include <__verbose_abort>
#include <exception>
#include <new>
#include <tuple>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_function_call();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_function_call was thrown in -fno-exceptions mode");
#endif
}
#include <__utility/forward.h>
#include <__utility/move.h>
#include <__utility/swap.h>
+#include <__verbose_abort>
#include <cstddef>
#include <cstdlib> // abort
#include <iosfwd>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_weak_ptr();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_weak_ptr was thrown in -fno-exceptions mode");
#endif
}
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__utility/unreachable.h>
+#include <__verbose_abort>
#include <cstdlib>
#include <initializer_list>
#include <typeinfo>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_any_cast();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_any_cast was thrown in -fno-exceptions mode");
#endif
}
#include <__utility/auto_cast.h>
#include <__utility/forward.h>
#include <__utility/move.h>
+#include <__verbose_abort>
#include <exception>
#include <mutex>
#include <new>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw future_error(make_error_code(__ev));
#else
- ((void)__ev);
- _VSTD::abort();
+ (void)__ev;
+ std::__libcpp_verbose_abort("future_error was thrown in -fno-exceptions mode");
#endif
}
#include <__ios/fpos.h>
#include <__locale>
#include <__utility/swap.h>
+#include <__verbose_abort>
#include <system_error>
#include <version>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw ios_base::failure(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#include <__type_traits/is_function.h>
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cv.h>
+#include <__verbose_abort>
#include <cstddef>
#include <cstdlib>
#include <exception>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_array_new_length();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_array_new_length was thrown in -fno-exceptions mode");
#endif
}
#include <__utility/in_place.h>
#include <__utility/move.h>
#include <__utility/swap.h>
+#include <__verbose_abort>
#include <initializer_list>
#include <new>
#include <stdexcept>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_optional_access();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_optional_access was thrown in -fno-exceptions mode");
#endif
}
#include <__utility/move.h>
#include <__utility/pair.h>
#include <__utility/swap.h>
+#include <__verbose_abort>
#include <deque>
#include <stdexcept>
#include <string>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw regex_error(_Ev);
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("regex_error was thrown in -fno-exceptions mode");
#endif
}
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
+#include <__verbose_abort>
#include <cstdlib>
#include <exception>
#include <iosfwd> // for string forward decl
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw logic_error(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw domain_error(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw invalid_argument(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw length_error(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw out_of_range(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw range_error(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw overflow_error(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw underflow_error(__msg);
#else
- ((void)__msg);
- _VSTD::abort();
+ std::__libcpp_verbose_abort("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
#endif
}
#include <__availability>
#include <__config>
#include <__type_traits/is_constant_evaluated.h>
+#include <__verbose_abort>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_cast();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_cast was thrown in -fno-exceptions mode");
#endif
}
_LIBCPP_END_NAMESPACE_STD
#include <__utility/move.h>
#include <__utility/swap.h>
#include <__variant/monostate.h>
+#include <__verbose_abort>
#include <exception>
#include <initializer_list>
#include <limits>
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_variant_access();
#else
- _VSTD::abort();
+ std::__libcpp_verbose_abort("bad_variant_access was thrown in -fno-exceptions mode");
#endif
}