• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 //          Copyright Oliver Kowalke 2014.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef BOOST_CONTEXT_DETAIL_EXCEPTION_H
8 #define BOOST_CONTEXT_DETAIL_EXCEPTION_H
9 
10 #include <boost/assert.hpp>
11 #include <boost/config.hpp>
12 
13 #include <boost/context/detail/fcontext.hpp>
14 
15 #ifdef BOOST_HAS_ABI_HEADERS
16 # include BOOST_ABI_PREFIX
17 #endif
18 
19 namespace boost {
20 namespace context {
21 namespace detail {
22 
23 struct forced_unwind {
24     fcontext_t  fctx{ nullptr };
25 #ifndef BOOST_ASSERT_IS_VOID
26     bool        caught{ false };
27 #endif
28 
29     forced_unwind() = default;
30 
forced_unwindboost::context::detail::forced_unwind31     forced_unwind( fcontext_t fctx_) :
32         fctx( fctx_) {
33     }
34 
35 #ifndef BOOST_ASSERT_IS_VOID
~forced_unwindboost::context::detail::forced_unwind36     ~forced_unwind() {
37         BOOST_ASSERT( caught);
38     }
39 #endif
40 };
41 
42 }}}
43 
44 #ifdef BOOST_HAS_ABI_HEADERS
45 #include BOOST_ABI_SUFFIX
46 #endif
47 
48 #endif // BOOST_CONTEXT_DETAIL_EXCEPTION_H
49