]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/stacktrace/example/user_config.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / stacktrace / example / user_config.cpp
1 // Copyright Antony Polukhin, 2016-2017.
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 #define BOOST_USER_CONFIG <libs/stacktrace/example/user_config.hpp>
8
9 #include <boost/array.hpp>
10 #include <exception> // std::set_terminate, std::abort
11 #include <boost/stacktrace.hpp>
12 #include <iostream> // std::cerr
13 BOOST_NOINLINE void foo(int i);
14 BOOST_NOINLINE void bar(int i);
15
16 BOOST_NOINLINE void bar(int i) {
17 boost::array<int, 5> a = {{-1, -231, -123, -23, -32}};
18 if (i >= 0) {
19 foo(a[i]);
20 } else {
21 std::cerr << "Terminate called:\n" << boost::stacktrace::stacktrace() << '\n';
22 std::exit(0);
23 }
24 }
25
26 BOOST_NOINLINE void foo(int i) {
27 bar(--i);
28 }
29
30 int main() {
31 foo(5);
32
33 return 2;
34 }
35
36
37
38