xref: /freebsd/contrib/llvm-project/libcxx/src/stdexcept.cpp (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1349cc55cSDimitry Andric //===----------------------------------------------------------------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
9*5f757f3fSDimitry Andric #include <__verbose_abort>
1081ad6265SDimitry Andric #include <new>
1181ad6265SDimitry Andric #include <stdexcept>
1281ad6265SDimitry Andric #include <string>
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifdef _LIBCPP_ABI_VCRUNTIME
150b57cec5SDimitry Andric #  include "support/runtime/stdexcept_vcruntime.ipp"
160b57cec5SDimitry Andric #else
170b57cec5SDimitry Andric #  include "support/runtime/stdexcept_default.ipp"
180b57cec5SDimitry Andric #endif
19*5f757f3fSDimitry Andric 
20*5f757f3fSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
21*5f757f3fSDimitry Andric 
22*5f757f3fSDimitry Andric _LIBCPP_NORETURN void __throw_runtime_error(const char* msg) {
23*5f757f3fSDimitry Andric #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
24*5f757f3fSDimitry Andric   throw runtime_error(msg);
25*5f757f3fSDimitry Andric #else
26*5f757f3fSDimitry Andric   _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg);
27*5f757f3fSDimitry Andric #endif
28*5f757f3fSDimitry Andric }
29*5f757f3fSDimitry Andric 
30*5f757f3fSDimitry Andric _LIBCPP_END_NAMESPACE_STD
31