Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85981 - in branches/release: boost/coroutine boost/coroutine/detail boost/coroutine/v2 libs/coroutine/doc libs/coroutine/example/cpp03 libs/coroutine/test
From: oliver.kowalke_at_[hidden]
Date: 2013-09-28 11:22:15


Author: olli
Date: 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013)
New Revision: 85981
URL: http://svn.boost.org/trac/boost/changeset/85981

Log:
coroutine: merge from trunk (bufx for export symbols, docu)

Properties modified:
   branches/release/boost/coroutine/ (props changed)
Text files modified:
   branches/release/boost/coroutine/detail/coroutine_context.hpp | 11 +++++
   branches/release/boost/coroutine/detail/segmented_stack_allocator.hpp | 2
   branches/release/boost/coroutine/detail/standard_stack_allocator.hpp | 4 +-
   branches/release/boost/coroutine/v2/coroutine.hpp | 54 +++++++++++++++++--------------
   branches/release/libs/coroutine/doc/attributes.qbk | 68 ++++++++++------------------------------
   branches/release/libs/coroutine/example/cpp03/segmented_stack.cpp | 12 ++++--
   branches/release/libs/coroutine/test/test_coroutine.cpp | 3 +
   7 files changed, 70 insertions(+), 84 deletions(-)

Modified: branches/release/boost/coroutine/detail/coroutine_context.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_context.hpp Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/boost/coroutine/detail/coroutine_context.hpp 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -14,7 +14,12 @@
 #include <boost/context/fcontext.hpp>
 
 #include <boost/coroutine/detail/config.hpp>
-#include "boost/coroutine/stack_context.hpp"
+#include <boost/coroutine/stack_context.hpp>
+
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4275)
+#endif
 
 #ifdef BOOST_HAS_ABI_HEADERS
 # include BOOST_ABI_PREFIX
@@ -58,4 +63,8 @@
 # include BOOST_ABI_SUFFIX
 #endif
 
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
 #endif // BOOST_COROUTINES_DETAIL_COROUTINE_CONTEXT_H

Modified: branches/release/boost/coroutine/detail/segmented_stack_allocator.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/segmented_stack_allocator.hpp Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/boost/coroutine/detail/segmented_stack_allocator.hpp 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -25,7 +25,7 @@
 namespace detail {
 
 #if defined(BOOST_USE_SEGMENTED_STACKS)
-class segmented_stack_allocator
+class BOOST_COROUTINES_DECL segmented_stack_allocator
 {
 public:
     static bool is_stack_unbound();

Modified: branches/release/boost/coroutine/detail/standard_stack_allocator.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/standard_stack_allocator.hpp Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/boost/coroutine/detail/standard_stack_allocator.hpp 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -11,7 +11,7 @@
 
 #include <boost/config.hpp>
 
-#include <boost/context/detail/config.hpp>
+#include <boost/coroutine/detail/config.hpp>
 
 #ifdef BOOST_HAS_ABI_HEADERS
 # include BOOST_ABI_PREFIX
@@ -24,7 +24,7 @@
 
 namespace detail {
 
-class standard_stack_allocator
+class BOOST_COROUTINES_DECL standard_stack_allocator
 {
 public:
     static bool is_stack_unbound();

Modified: branches/release/boost/coroutine/v2/coroutine.hpp
==============================================================================
--- branches/release/boost/coroutine/v2/coroutine.hpp Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/boost/coroutine/v2/coroutine.hpp 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -58,10 +58,9 @@
     typedef detail::push_coroutine_base< Arg > base_t;
     typedef typename base_t::ptr_t ptr_t;
 
- struct dummy
- { void nonnull() {} };
+ struct dummy;
 
- typedef void ( dummy::*safe_bool)();
+ typedef void ( push_coroutine::*safe_bool)();
 
     ptr_t impl_;
 
@@ -83,6 +82,8 @@
                 callee, unwind, preserve_fpu, a) );
     }
 
+ void nonnull_() {}
+
 public:
     push_coroutine() BOOST_NOEXCEPT :
         impl_()
@@ -227,7 +228,7 @@
     { return ! impl_; }
 
     operator safe_bool() const BOOST_NOEXCEPT
- { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+ { return ( empty() || impl_->is_complete() ) ? 0 : & push_coroutine::nonnull_; }
 
     bool operator!() const BOOST_NOEXCEPT
     { return empty() || impl_->is_complete(); }
@@ -317,10 +318,9 @@
     typedef detail::push_coroutine_base< Arg & > base_t;
     typedef typename base_t::ptr_t ptr_t;
 
- struct dummy
- { void nonnull() {} };
+ struct dummy;
 
- typedef void ( dummy::*safe_bool)();
+ typedef void ( push_coroutine::*safe_bool)();
 
     ptr_t impl_;
 
@@ -342,6 +342,8 @@
                 callee, unwind, preserve_fpu, a) );
     }
 
+ void nonnull_() {}
+
 public:
     push_coroutine() BOOST_NOEXCEPT :
         impl_()
@@ -486,7 +488,7 @@
     { return ! impl_; }
 
     operator safe_bool() const BOOST_NOEXCEPT
- { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+ { return ( empty() || impl_->is_complete() ) ? 0 : & push_coroutine::nonnull_; }
 
     bool operator!() const BOOST_NOEXCEPT
     { return empty() || impl_->is_complete(); }
@@ -551,10 +553,9 @@
     typedef detail::push_coroutine_base< void > base_t;
     typedef base_t::ptr_t ptr_t;
 
- struct dummy
- { void nonnull() {} };
+ struct dummy;
 
- typedef void ( dummy::*safe_bool)();
+ typedef void ( push_coroutine::*safe_bool)();
 
     ptr_t impl_;
 
@@ -576,6 +577,8 @@
                 callee, unwind, preserve_fpu, a) );
     }
 
+ void nonnull_() {}
+
 public:
     push_coroutine() BOOST_NOEXCEPT :
         impl_()
@@ -720,7 +723,7 @@
     { return ! impl_; }
 
     operator safe_bool() const BOOST_NOEXCEPT
- { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+ { return ( empty() || impl_->is_complete() ) ? 0 : & push_coroutine::nonnull_; }
 
     bool operator!() const BOOST_NOEXCEPT
     { return empty() || impl_->is_complete(); }
@@ -754,10 +757,9 @@
     typedef detail::pull_coroutine_base< R > base_t;
     typedef typename base_t::ptr_t ptr_t;
 
- struct dummy
- { void nonnull() {} };
+ struct dummy;
 
- typedef void ( dummy::*safe_bool)();
+ typedef void ( pull_coroutine::*safe_bool)();
 
     ptr_t impl_;
 
@@ -780,6 +782,8 @@
                 callee, unwind, preserve_fpu, a, result) );
     }
 
+ void nonnull_() {}
+
 public:
     pull_coroutine() BOOST_NOEXCEPT :
         impl_()
@@ -1056,7 +1060,7 @@
     { return ! impl_; }
 
     operator safe_bool() const BOOST_NOEXCEPT
- { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+ { return ( empty() || impl_->is_complete() ) ? 0 : & pull_coroutine::nonnull_; }
 
     bool operator!() const BOOST_NOEXCEPT
     { return empty() || impl_->is_complete(); }
@@ -1275,10 +1279,9 @@
     typedef detail::pull_coroutine_base< R & > base_t;
     typedef typename base_t::ptr_t ptr_t;
 
- struct dummy
- { void nonnull() {} };
+ struct dummy;
 
- typedef void ( dummy::*safe_bool)();
+ typedef void ( pull_coroutine::*safe_bool)();
 
     ptr_t impl_;
 
@@ -1301,6 +1304,8 @@
                 callee, unwind, preserve_fpu, a, result) );
     }
 
+ void nonnull_() {}
+
 public:
     pull_coroutine() BOOST_NOEXCEPT :
         impl_()
@@ -1577,7 +1582,7 @@
     { return ! impl_; }
 
     operator safe_bool() const BOOST_NOEXCEPT
- { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+ { return ( empty() || impl_->is_complete() ) ? 0 : & pull_coroutine::nonnull_; }
 
     bool operator!() const BOOST_NOEXCEPT
     { return empty() || impl_->is_complete(); }
@@ -1792,10 +1797,9 @@
     typedef detail::pull_coroutine_base< void > base_t;
     typedef base_t::ptr_t ptr_t;
 
- struct dummy
- { void nonnull() {} };
+ struct dummy;
 
- typedef void ( dummy::*safe_bool)();
+ typedef void ( pull_coroutine::*safe_bool)();
 
     ptr_t impl_;
 
@@ -1817,6 +1821,8 @@
                 callee, unwind, preserve_fpu, a) );
     }
 
+ void nonnull_() {}
+
 public:
     pull_coroutine() BOOST_NOEXCEPT :
         impl_()
@@ -2093,7 +2099,7 @@
     { return ! impl_; }
 
     operator safe_bool() const BOOST_NOEXCEPT
- { return ( empty() || impl_->is_complete() ) ? 0 : & dummy::nonnull; }
+ { return ( empty() || impl_->is_complete() ) ? 0 : & pull_coroutine::nonnull_; }
 
     bool operator!() const BOOST_NOEXCEPT
     { return empty() || impl_->is_complete(); }

Modified: branches/release/libs/coroutine/doc/attributes.qbk
==============================================================================
--- branches/release/libs/coroutine/doc/attributes.qbk Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/libs/coroutine/doc/attributes.qbk 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -14,55 +14,21 @@
         {
             std::size_t size;
             flag_unwind_t do_unwind;
- bool preserve_fpu;
+ flag_fpu_t preserve_fpu;
 
- attributes() BOOST_NOEXCEPT :
- size( ctx::default_stacksize() ),
- do_unwind( stack_unwind),
- preserve_fpu( true)
- {}
-
- explicit attributes( std::size_t size_) BOOST_NOEXCEPT :
- size( size_),
- do_unwind( stack_unwind),
- preserve_fpu( true)
- {}
-
- explicit attributes( flag_unwind_t do_unwind_) BOOST_NOEXCEPT :
- size( ctx::default_stacksize() ),
- do_unwind( do_unwind_),
- preserve_fpu( true)
- {}
-
- explicit attributes( bool preserve_fpu_) BOOST_NOEXCEPT :
- size( ctx::default_stacksize() ),
- do_unwind( stack_unwind),
- preserve_fpu( preserve_fpu_)
- {}
-
- explicit attributes(
- std::size_t size_,
- flag_unwind_t do_unwind_) BOOST_NOEXCEPT :
- size( size_),
- do_unwind( do_unwind_),
- preserve_fpu( true)
- {}
-
- explicit attributes(
- std::size_t size_,
- bool preserve_fpu_) BOOST_NOEXCEPT :
- size( size_),
- do_unwind( stack_unwind),
- preserve_fpu( preserve_fpu_)
- {}
-
- explicit attributes(
- flag_unwind_t do_unwind_,
- bool preserve_fpu_) BOOST_NOEXCEPT :
- size( ctx::default_stacksize() ),
- do_unwind( do_unwind_),
- preserve_fpu( preserve_fpu_)
- {}
+ attributes() BOOST_NOEXCEPT;
+
+ explicit attributes( std::size_t size_) BOOST_NOEXCEPT;
+
+ explicit attributes( flag_unwind_t do_unwind_) BOOST_NOEXCEPT;
+
+ explicit attributes( flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT;
+
+ explicit attributes( std::size_t size_, flag_unwind_t do_unwind_) BOOST_NOEXCEPT;
+
+ explicit attributes( std::size_t size_, flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT;
+
+ explicit attributes( flag_unwind_t do_unwind_, flag_fpu_t preserve_fpu_) BOOST_NOEXCEPT;
         };
 
 [heading `attributes()`]
@@ -88,7 +54,7 @@
 [[Throws:] [Nothing.]]
 ]
 
-[heading `attributes( bool preserve_fpu)`]
+[heading `attributes( flag_fpu_t preserve_fpu)`]
 [variablelist
 [[Effects:] [Argument `preserve_fpu` determines if FPU register have to be
 preserved if a `context` switches. THe default stacksize is used for the
@@ -103,14 +69,14 @@
 [[Throws:] [Nothing.]]
 ]
 
-[heading `attributes( std::size_t size, bool preserve_fpu)`]
+[heading `attributes( std::size_t size, flag_fpu_t preserve_fpu)`]
 [variablelist
 [[Effects:] [Arguments `size` and `preserve_fpu` are given by the user.
 The stack is automatically unwound after coroutine/generator terminates.]]
 [[Throws:] [Nothing.]]
 ]
 
-[heading `attributes( flag_unwind_t do_unwind, bool preserve_fpu)`]
+[heading `attributes( flag_unwind_t do_unwind, flag_fpu_t preserve_fpu)`]
 [variablelist
 [[Effects:] [Arguments `do_unwind` and `preserve_fpu` are given by the user.
 The stack gets a default value of `ctx::default_stacksize()`.]]

Modified: branches/release/libs/coroutine/example/cpp03/segmented_stack.cpp
==============================================================================
--- branches/release/libs/coroutine/example/cpp03/segmented_stack.cpp Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/libs/coroutine/example/cpp03/segmented_stack.cpp 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -7,11 +7,15 @@
 #include <iostream>
 
 #include <boost/assert.hpp>
+#include <boost/config.hpp>
 #include <boost/coroutine/all.hpp>
 #include <boost/thread.hpp>
 
-int count = 20;
-#if defined(BOOST_USE_SEGMENTED_STACKS)
+int count = 384;
+
+#ifdef BOOST_MSVC //MS VisualStudio
+__declspec(noinline) void access( char *buf);
+#else // GCC
 void access( char *buf) __attribute__ ((noinline));
 #endif
 void access( char *buf)
@@ -66,11 +70,11 @@
 int main( int argc, char * argv[])
 {
 #if defined(BOOST_USE_SEGMENTED_STACKS)
- std::cout << "using segmented stacks: allocates " << count << " * 4kB on stack, ";
+ std::cout << "using segmented stacks: allocates " << count << " * 4kB == " << 4 * count << "kB on stack, ";
     std::cout << "initial stack size = " << boost::coroutines::stack_allocator::default_stacksize() / 1024 << "kB" << std::endl;
     std::cout << "application should not fail" << std::endl;
 #else
- std::cout << "using standard stacks: allocates " << count << " * 4kB on stack, ";
+ std::cout << "using standard stacks: allocates " << count << " * 4kB == " << 4 * count << "kB on stack, ";
     std::cout << "initial stack size = " << boost::coroutines::stack_allocator::default_stacksize() / 1024 << "kB" << std::endl;
     std::cout << "application might fail" << std::endl;
 #endif

Modified: branches/release/libs/coroutine/test/test_coroutine.cpp
==============================================================================
--- branches/release/libs/coroutine/test/test_coroutine.cpp Sat Sep 28 11:20:50 2013 (r85980)
+++ branches/release/libs/coroutine/test/test_coroutine.cpp 2013-09-28 11:22:14 EDT (Sat, 28 Sep 2013) (r85981)
@@ -522,8 +522,9 @@
     try
     {
         int i = coro.get();
+ (void)i;
     }
- catch ( coro::invalid_result const& e)
+ catch ( coro::invalid_result const&)
     {
         catched = true;
     }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk