Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85979 - in trunk: boost/coroutine/detail boost/coroutine/v2 libs/coroutine/example/cpp03 libs/coroutine/test
From: oliver.kowalke_at_[hidden]
Date: 2013-09-28 11:00:26


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

Log:
coroutine: fixing export issue for MSVC; increase used stacksize for example

Text files modified:
   trunk/boost/coroutine/detail/coroutine_context.hpp | 11 +++++++
   trunk/boost/coroutine/detail/segmented_stack_allocator.hpp | 2
   trunk/boost/coroutine/detail/standard_stack_allocator.hpp | 4 +-
   trunk/boost/coroutine/v2/coroutine.hpp | 54 ++++++++++++++++++++++-----------------
   trunk/libs/coroutine/example/cpp03/segmented_stack.cpp | 6 ++--
   trunk/libs/coroutine/test/test_coroutine.cpp | 2
   6 files changed, 47 insertions(+), 32 deletions(-)

Modified: trunk/boost/coroutine/detail/coroutine_context.hpp
==============================================================================
--- trunk/boost/coroutine/detail/coroutine_context.hpp Sat Sep 28 04:58:43 2013 (r85978)
+++ trunk/boost/coroutine/detail/coroutine_context.hpp 2013-09-28 11:00:26 EDT (Sat, 28 Sep 2013) (r85979)
@@ -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: trunk/boost/coroutine/detail/segmented_stack_allocator.hpp
==============================================================================
--- trunk/boost/coroutine/detail/segmented_stack_allocator.hpp Sat Sep 28 04:58:43 2013 (r85978)
+++ trunk/boost/coroutine/detail/segmented_stack_allocator.hpp 2013-09-28 11:00:26 EDT (Sat, 28 Sep 2013) (r85979)
@@ -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: trunk/boost/coroutine/detail/standard_stack_allocator.hpp
==============================================================================
--- trunk/boost/coroutine/detail/standard_stack_allocator.hpp Sat Sep 28 04:58:43 2013 (r85978)
+++ trunk/boost/coroutine/detail/standard_stack_allocator.hpp 2013-09-28 11:00:26 EDT (Sat, 28 Sep 2013) (r85979)
@@ -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: trunk/boost/coroutine/v2/coroutine.hpp
==============================================================================
--- trunk/boost/coroutine/v2/coroutine.hpp Sat Sep 28 04:58:43 2013 (r85978)
+++ trunk/boost/coroutine/v2/coroutine.hpp 2013-09-28 11:00:26 EDT (Sat, 28 Sep 2013) (r85979)
@@ -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: trunk/libs/coroutine/example/cpp03/segmented_stack.cpp
==============================================================================
--- trunk/libs/coroutine/example/cpp03/segmented_stack.cpp Sat Sep 28 04:58:43 2013 (r85978)
+++ trunk/libs/coroutine/example/cpp03/segmented_stack.cpp 2013-09-28 11:00:26 EDT (Sat, 28 Sep 2013) (r85979)
@@ -11,7 +11,7 @@
 #include <boost/coroutine/all.hpp>
 #include <boost/thread.hpp>
 
-int count = 50;
+int count = 384;
 
 #ifdef BOOST_MSVC //MS VisualStudio
 __declspec(noinline) void access( char *buf);
@@ -70,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: trunk/libs/coroutine/test/test_coroutine.cpp
==============================================================================
--- trunk/libs/coroutine/test/test_coroutine.cpp Sat Sep 28 04:58:43 2013 (r85978)
+++ trunk/libs/coroutine/test/test_coroutine.cpp 2013-09-28 11:00:26 EDT (Sat, 28 Sep 2013) (r85979)
@@ -524,7 +524,7 @@
         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