diff --git a/example/cpp03/segmented_stack.cpp b/example/cpp03/segmented_stack.cpp index 1a97a89..96b6625 100644 --- a/example/cpp03/segmented_stack.cpp +++ b/example/cpp03/segmented_stack.cpp @@ -11,7 +11,7 @@ #include #include -int count = 50; +int count = 384; #ifdef BOOST_MSVC //MS VisualStudio __declspec(noinline) void access( char *buf); @@ -70,11 +70,11 @@ void thread_fn() 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 diff --git a/include/boost/coroutine/detail/coroutine_context.hpp b/include/boost/coroutine/detail/coroutine_context.hpp index d02ab1a..fcc09f6 100644 --- a/include/boost/coroutine/detail/coroutine_context.hpp +++ b/include/boost/coroutine/detail/coroutine_context.hpp @@ -14,7 +14,12 @@ #include #include -#include "boost/coroutine/stack_context.hpp" +#include + +#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 @@ public: # include BOOST_ABI_SUFFIX #endif +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #endif // BOOST_COROUTINES_DETAIL_COROUTINE_CONTEXT_H diff --git a/include/boost/coroutine/detail/segmented_stack_allocator.hpp b/include/boost/coroutine/detail/segmented_stack_allocator.hpp index 5afefa0..73d33b1 100644 --- a/include/boost/coroutine/detail/segmented_stack_allocator.hpp +++ b/include/boost/coroutine/detail/segmented_stack_allocator.hpp @@ -25,7 +25,7 @@ struct stack_context; 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(); diff --git a/include/boost/coroutine/detail/standard_stack_allocator.hpp b/include/boost/coroutine/detail/standard_stack_allocator.hpp index c20499b..9c207d5 100644 --- a/include/boost/coroutine/detail/standard_stack_allocator.hpp +++ b/include/boost/coroutine/detail/standard_stack_allocator.hpp @@ -11,7 +11,7 @@ #include -#include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -24,7 +24,7 @@ struct stack_context; namespace detail { -class standard_stack_allocator +class BOOST_COROUTINES_DECL standard_stack_allocator { public: static bool is_stack_unbound(); diff --git a/include/boost/coroutine/v2/coroutine.hpp b/include/boost/coroutine/v2/coroutine.hpp index f166a19..6eaba23 100644 --- a/include/boost/coroutine/v2/coroutine.hpp +++ b/include/boost/coroutine/v2/coroutine.hpp @@ -58,10 +58,9 @@ private: 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 @@ private: callee, unwind, preserve_fpu, a) ); } + void nonnull_() {} + public: push_coroutine() BOOST_NOEXCEPT : impl_() @@ -227,7 +228,7 @@ public: { 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 @@ private: 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 @@ private: callee, unwind, preserve_fpu, a) ); } + void nonnull_() {} + public: push_coroutine() BOOST_NOEXCEPT : impl_() @@ -486,7 +488,7 @@ public: { 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 @@ private: 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 @@ private: callee, unwind, preserve_fpu, a) ); } + void nonnull_() {} + public: push_coroutine() BOOST_NOEXCEPT : impl_() @@ -720,7 +723,7 @@ public: { 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 @@ private: 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 @@ private: callee, unwind, preserve_fpu, a, result) ); } + void nonnull_() {} + public: pull_coroutine() BOOST_NOEXCEPT : impl_() @@ -1056,7 +1060,7 @@ public: { 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 @@ private: 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 @@ private: callee, unwind, preserve_fpu, a, result) ); } + void nonnull_() {} + public: pull_coroutine() BOOST_NOEXCEPT : impl_() @@ -1577,7 +1582,7 @@ public: { 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 @@ private: 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 @@ private: callee, unwind, preserve_fpu, a) ); } + void nonnull_() {} + public: pull_coroutine() BOOST_NOEXCEPT : impl_() @@ -2093,7 +2099,7 @@ public: { 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(); } diff --git a/test/test_coroutine.cpp b/test/test_coroutine.cpp index b4a6bcb..ae33ef5 100644 --- a/test/test_coroutine.cpp +++ b/test/test_coroutine.cpp @@ -524,7 +524,7 @@ void test_invalid_result() int i = coro.get(); (void)i; } - catch ( coro::invalid_result const& e) + catch ( coro::invalid_result const&) { catched = true; }