]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/test/verbose_terminate_handler_fail.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / core / test / verbose_terminate_handler_fail.cpp
1 // Copyright 2022 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // https://www.boost.org/LICENSE_1_0.txt
4
5 #if defined(_MSC_VER)
6 # pragma warning(disable: 4702) // unreachable code
7 # pragma warning(disable: 4530) // C++ exception handler used
8 # pragma warning(disable: 4577) // 'noexcept' used
9 #endif
10
11 #include <boost/core/verbose_terminate_handler.hpp>
12 #include <boost/throw_exception.hpp>
13 #include <exception>
14 #include <stdlib.h>
15 #if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
16 # include <crtdbg.h>
17 #endif
18
19 int main()
20 {
21 #if defined(_MSC_VER) && (_MSC_VER > 1310)
22 // disable message boxes on assert(), abort()
23 ::_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
24 #endif
25 #if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
26 // disable message boxes on iterator debugging violations
27 _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
28 _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
29 #endif
30
31 std::set_terminate( boost::core::verbose_terminate_handler );
32
33 boost::throw_with_location( std::exception() );
34 }
35
36 #if defined(BOOST_NO_EXCEPTIONS)
37
38 void boost::throw_exception( std::exception const& x )
39 {
40 std::fprintf( stderr, "throw_exception: %s\n\n", x.what() );
41 std::terminate();
42 }
43
44 void boost::throw_exception( std::exception const& x, boost::source_location const& )
45 {
46 std::fprintf( stderr, "throw_exception: %s\n\n", x.what() );
47 std::terminate();
48 }
49
50 #endif