xref: /freebsd/contrib/llvm-project/libcxx/src/stdexcept.cpp (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <__verbose_abort>
10 #include <new>
11 #include <stdexcept>
12 #include <string>
13 
14 #ifdef _LIBCPP_ABI_VCRUNTIME
15 #  include "support/runtime/stdexcept_vcruntime.ipp"
16 #else
17 #  include "support/runtime/stdexcept_default.ipp"
18 #endif
19 
20 _LIBCPP_BEGIN_NAMESPACE_STD
21 
22 _LIBCPP_NORETURN void __throw_runtime_error(const char* msg) {
23 #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
24   throw runtime_error(msg);
25 #else
26   _LIBCPP_VERBOSE_ABORT("runtime_error was thrown in -fno-exceptions mode with message \"%s\"", msg);
27 #endif
28 }
29 
30 _LIBCPP_END_NAMESPACE_STD
31