exception.hpp 959 B

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