stack_context.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_STACK_CONTEXT_H
  6. #define BOOST_CONTEXT_STACK_CONTEXT_H
  7. #include <cstddef>
  8. #include <boost/config.hpp>
  9. #include <boost/context/detail/config.hpp>
  10. #ifdef BOOST_HAS_ABI_HEADERS
  11. # include BOOST_ABI_PREFIX
  12. #endif
  13. namespace boost {
  14. namespace context {
  15. #if ! defined(BOOST_CONTEXT_NO_CXX11)
  16. struct BOOST_CONTEXT_DECL stack_context {
  17. # if defined(BOOST_USE_SEGMENTED_STACKS)
  18. typedef void * segments_context[BOOST_CONTEXT_SEGMENTS];
  19. # endif
  20. std::size_t size{ 0 };
  21. void * sp{ nullptr };
  22. # if defined(BOOST_USE_SEGMENTED_STACKS)
  23. segments_context segments_ctx{};
  24. # endif
  25. # if defined(BOOST_USE_VALGRIND)
  26. unsigned valgrind_stack_id{ 0 };
  27. # endif
  28. };
  29. #else
  30. struct BOOST_CONTEXT_DECL stack_context {
  31. # if defined(BOOST_USE_SEGMENTED_STACKS)
  32. typedef void * segments_context[BOOST_CONTEXT_SEGMENTS];
  33. # endif
  34. std::size_t size;
  35. void * sp;
  36. # if defined(BOOST_USE_SEGMENTED_STACKS)
  37. segments_context segments_ctx;
  38. # endif
  39. # if defined(BOOST_USE_VALGRIND)
  40. unsigned valgrind_stack_id;
  41. # endif
  42. stack_context() :
  43. size( 0),
  44. sp( 0)
  45. # if defined(BOOST_USE_SEGMENTED_STACKS)
  46. , segments_ctx()
  47. # endif
  48. # if defined(BOOST_USE_VALGRIND)
  49. , valgrind_stack_id( 0)
  50. # endif
  51. {}
  52. };
  53. #endif
  54. }}
  55. #ifdef BOOST_HAS_ABI_HEADERS
  56. # include BOOST_ABI_SUFFIX
  57. #endif
  58. #endif // BOOST_CONTEXT_STACK_CONTEXT_H