$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r80504 - in trunk: boost/context/detail libs/context/test
From: oliver.kowalke_at_[hidden]
Date: 2012-09-12 07:36:49
Author: olli
Date: 2012-09-12 07:36:48 EDT (Wed, 12 Sep 2012)
New Revision: 80504
URL: http://svn.boost.org/trac/boost/changeset/80504
Log:
context: fixing invalid fcontext_t struct on i386; test stacksizes
Text files modified: 
   trunk/boost/context/detail/fcontext_i386.hpp |     7 +++----                                 
   trunk/libs/context/test/test_context.cpp     |    31 +++++++++++++++++++++++--------         
   2 files changed, 26 insertions(+), 12 deletions(-)
Modified: trunk/boost/context/detail/fcontext_i386.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_i386.hpp	(original)
+++ trunk/boost/context/detail/fcontext_i386.hpp	2012-09-12 07:36:48 EDT (Wed, 12 Sep 2012)
@@ -27,24 +27,23 @@
 
 struct stack_t
 {
-    boost::uint32_t     code;
     void            *   sp;
     std::size_t         size;
 
     stack_t() :
-        code( 0), sp( 0), size( 0)
+        sp( 0), size( 0)
     {}
 };
 
 struct fcontext_t
 {
-    stack_t             fc_stack;
     boost::uint32_t     fc_greg[6];
+    stack_t             fc_stack;
     boost::uint32_t     fc_freg[2];
 
     fcontext_t() :
-        fc_stack(),
         fc_greg(),
+        fc_stack(),
         fc_freg()
     {}
 };
Modified: trunk/libs/context/test/test_context.cpp
==============================================================================
--- trunk/libs/context/test/test_context.cpp	(original)
+++ trunk/libs/context/test/test_context.cpp	2012-09-12 07:36:48 EDT (Wed, 12 Sep 2012)
@@ -76,6 +76,20 @@
     ctx::jump_fcontext( fc, & fcm, 0);
 }
 
+void test_stack()
+{
+    std::size_t def = ctx::guarded_stack_allocator::default_stacksize();
+    std::size_t min = ctx::guarded_stack_allocator::minimum_stacksize();
+    bool unbound = ctx::guarded_stack_allocator::is_stack_unbound();
+    if ( ! unbound)
+    {
+        std::size_t max = ctx::guarded_stack_allocator::maximum_stacksize();
+        BOOST_CHECK( unbound || ( max >= def) );
+    }
+
+    BOOST_CHECK( min <= def);
+}
+
 void test_setup()
 {
     ctx::guarded_stack_allocator alloc;
@@ -205,14 +219,15 @@
     boost::unit_test::test_suite * test =
         BOOST_TEST_SUITE("Boost.Context: context test suite");
 
-    test->add( BOOST_TEST_CASE( & test_setup) );
-    test->add( BOOST_TEST_CASE( & test_start) );
-    test->add( BOOST_TEST_CASE( & test_jump) );
-    test->add( BOOST_TEST_CASE( & test_result) );
-    test->add( BOOST_TEST_CASE( & test_arg) );
-    test->add( BOOST_TEST_CASE( & test_transfer) );
-    test->add( BOOST_TEST_CASE( & test_exception) );
-    test->add( BOOST_TEST_CASE( & test_fp) );
+    test->add( BOOST_TEST_CASE( & test_stack) );
+   test->add( BOOST_TEST_CASE( & test_setup) );
+   test->add( BOOST_TEST_CASE( & test_start) );
+   test->add( BOOST_TEST_CASE( & test_jump) );
+   test->add( BOOST_TEST_CASE( & test_result) );
+   test->add( BOOST_TEST_CASE( & test_arg) );
+   test->add( BOOST_TEST_CASE( & test_transfer) );
+   test->add( BOOST_TEST_CASE( & test_exception) );
+   test->add( BOOST_TEST_CASE( & test_fp) );
 
     return test;
 }