boost: 1.65.0 Update + Fixes

This commit updates the boost libraries to version 1.65.0

This new version brings two new libraries:
 - Boost.Stacktrace [1]
   -> Gather, store, copy and print backtraces, from Antony Polukhin.
 - Boost.PolyCollection [2]
   -> Fast containers of polymorphic objects, from Joaquín M López Muñoz.

Fixes in this commit:
 - Boost.Python for Python 3.6
   -> The dynamic library was not being compiled, resulting in an empty package. Fixed.
 - Boost.TypeErasure
   -> The dynamic library was not available to install. Fixed.
 - Boost.Serialization
   -> The wserialization dynamic library was being compiled but not available to install. Fixed.

Extras:
 - This commit also contains the post-release fixes, which did not make it into the final release [3].

As always, more information about this release, can be found in [4].

[1]: http://www.boost.org/doc/libs/1_65_0/doc/html/stacktrace.html
[2]: http://www.boost.org/doc/libs/1_65_0/doc/html/poly_collection.html
[3]: http://www.boost.org/patches/
[4]: http://www.boost.org/users/history/version_1_65_0.html

Signed-off-by: Carlos Miguel Ferreira <carlosmf.pt@gmail.com>
This commit is contained in:
Carlos Miguel Ferreira 2017-08-30 12:20:55 +01:00
parent d4e9a4f098
commit cf67f5f47a
No known key found for this signature in database
GPG Key ID: 33A82DFF65092E55
5 changed files with 395 additions and 121 deletions

View File

@ -16,15 +16,15 @@ include $(INCLUDE_DIR)/nls.mk
include $(INCLUDE_DIR)/target.mk
PKG_NAME:=boost
PKG_VERSION:=1.64.0
PKG_SOURCE_VERSION:=1_64_0
PKG_VERSION:=1.65.0
PKG_SOURCE_VERSION:=1_65_0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
PKG_SOURCE_URL:=https://sourceforge.net/projects/boost/files/boost/$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
PKG_HASH:=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332
PKG_HASH:=ea26712742e2fb079c2a566a31f3266973b76e38222b9f88b387e3c8b2f9902c
PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
@ -44,7 +44,7 @@ define Package/boost/Default
endef
define Package/boost/description
This package provides the Boost v1.64 libraries.
This package provides the Boost v1.65 libraries.
Boost is a set of free, peer-reviewed, portable C++ source libraries.
-----------------------------------------------------------------------------
@ -80,15 +80,17 @@ This package provides the following run-time libraries:
- python3
- random
- regex
- serialization
- serialization and wserialization
- signals
- stackstrace (new in 1.65.0)
- system
- thread
- timer
- type_erasure
- wave
There are many more header-only libraries supported by Boost.
See more at http://www.boost.org/doc/libs/1_64_0/
See more at http://www.boost.org/doc/libs/1_65_0/
endef
PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
@ -302,10 +304,10 @@ $(eval $(call DefineBoostLibrary,context,chrono system thread,))
$(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
$(eval $(call DefineBoostLibrary,date_time,,))
#$(eval $(call DefineBoostLibrary,exception,,))
$(eval $(call DefineBoostLibrary,fiber,coroutine,,))
$(eval $(call DefineBoostLibrary,fiber,coroutine filesystem,,))
$(eval $(call DefineBoostLibrary,filesystem,system,))
$(eval $(call DefineBoostLibrary,graph,regex,))
$(eval $(call DefineBoostLibrary,iostreams,,+zlib))
$(eval $(call DefineBoostLibrary,iostreams,,+zlib +liblzma))
$(eval $(call DefineBoostLibrary,locale,system,$(ICONV_DEPENDS),BUILD_NLS))
$(eval $(call DefineBoostLibrary,log,system chrono date_time thread filesystem regex,))
$(eval $(call DefineBoostLibrary,math,,))
@ -316,10 +318,13 @@ $(eval $(call DefineBoostLibrary,python3,,,PACKAGE_python3))
$(eval $(call DefineBoostLibrary,random,system,))
$(eval $(call DefineBoostLibrary,regex,,))
$(eval $(call DefineBoostLibrary,serialization,,))
$(eval $(call DefineBoostLibrary,wserialization,serialization,))
$(eval $(call DefineBoostLibrary,signals,,))
$(eval $(call DefineBoostLibrary,stacktrace,,))
$(eval $(call DefineBoostLibrary,system,,))
$(eval $(call DefineBoostLibrary,thread,system chrono atomic,))
$(eval $(call DefineBoostLibrary,timer,chrono))
$(eval $(call DefineBoostLibrary,type_erasure,chrono system thread,))
$(eval $(call DefineBoostLibrary,wave,date_time thread filesystem,))
@ -333,7 +338,7 @@ TARGET_LDFLAGS += -pthread -lrt
TARGET_CFLAGS += \
$(if $(CONFIG_PACKAGE_boost-python), -I$(STAGING_DIR)/usr/include/python2.7/) \
$(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
$(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.6/) \
$(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
@ -358,11 +363,11 @@ define Build/Compile
( cd $(PKG_BUILD_DIR) ; \
echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
$(if $(CONFIG_PACKAGE_boost-python3), \
echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
echo "using python : 3.6 : : $(STAGING_DIR)/usr/include/python3.6/ : $(STAGING_DIR)/usr/lib/libpython3.6.so ;" >> \
tools/build/src/user-config.jam; \
) \
$(if $(CONFIG_PACKAGE_boost-python), \
echo "using python : 2.7 : $(STAGING_DIR_ROOT)/usr/bin/python : $(STAGING_DIR)/usr/include/python2.7/ ;" >> \
echo "using python : 2.7 : : $(STAGING_DIR)/usr/include/python2.7/ : $(STAGING_DIR)/usr/lib/libpython2.7.so ;" >> \
tools/build/src/user-config.jam; \
) \
b2 \
@ -389,7 +394,7 @@ define Build/Compile
$(if $(CONFIG_PACKAGE_boost-test),,--without-test) \
$(foreach lib,$(BOOST_LIBS), \
$(if $(findstring python,$(lib)), \
$(if $(or $(CONFIG_PACKAGE_boost-python),$(CONFIG_PACKAGE_boost-python3)),,--without-python), \
$(if $(CONFIG_PACKAGE_boost-python),python=2.7,--without-python), \
$(if $(CONFIG_PACKAGE_boost-$(lib)),,--without-$(lib))) \
) \
$(if $(CONFIG_PACKAGE_boost-locale),boost.locale.iconv=on -sICONV_PATH=$(ICONV_PREFIX) boost.locale.posix=$(if $(USE_MUSL),on,off), \
@ -397,7 +402,27 @@ define Build/Compile
\
$(if $(CONFIG_PACKAGE_boost-iostreams),-sNO_BZIP2=1 -sZLIB_INCLUDE=$(STAGING_DIR)/usr/include \
-sZLIB_LIBPATH=$(STAGING_DIR)/usr/lib) \
install \
install ;\
b2 \
$(CONFIGURE_ARGS) \
--ignore-site-config \
--toolset=gcc-$(ARCH) abi=$(BOOST_ABI) \
--disable-long-double \
$(if $(CONFIG_boost-variant-release), variant=release,) \
$(if $(CONFIG_boost-variant-debug), variant=debug,) \
$(if $(CONFIG_boost-variant-profile), variant=profile,) \
$(if $(CONFIG_boost-use-name-tags),--layout=tagged,--layout=system) \
$(if $(CONFIG_boost-build-type-complete),--build-type=complete,--build-type=minimal) \
$(if $(CONFIG_boost-shared-libs),link=shared,) \
$(if $(CONFIG_boost-static-libs),link=static,) \
$(if $(CONFIG_boost-static-and-shared-libs),link=static$(comma)shared,) \
$(if $(CONFIG_boost-runtime-shared),runtime-link=shared,) \
$(if $(CONFIG_boost-runtime-static),runtime-link=static,) \
$(if $(CONFIG_boost-runtime-static-and-shared),runtime-link=shared$(comma)static,) \
$(if $(CONFIG_boost-single-thread),threading=single,) \
threading=multi \
$(if $(CONFIG_PACKAGE_boost-python3),--with-python python=3.6,) \
install ;\
)
endef
@ -447,7 +472,7 @@ endef
define BuildBoostLibrary
define Package/boost-$(1)/install
$(call Package/boost/Default/install,$$(1),$(1))
$(call Package/boost/Default/install,$$(1),$(1))
endef
$$(eval $$(call BuildPackage,boost-$(1)))

View File

@ -0,0 +1,344 @@
Index: boost_1_65_0/boost/context/continuation_fcontext.hpp
===================================================================
--- boost_1_65_0.orig/boost/context/continuation_fcontext.hpp
+++ boost_1_65_0/boost/context/continuation_fcontext.hpp
@@ -95,7 +95,7 @@ transfer_t context_ontop( transfer_t t)
t.data = nullptr;
Ctx c{ t.fctx };
// execute function, pass continuation via reference
- fn( std::move( c) );
+ c = fn( std::move( c) );
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
return { exchange( c.fctx_, nullptr), nullptr };
#else
Index: boost_1_65_0/boost/context/continuation_ucontext.hpp
===================================================================
--- boost_1_65_0.orig/boost/context/continuation_ucontext.hpp
+++ boost_1_65_0/boost/context/continuation_ucontext.hpp
@@ -84,18 +84,18 @@ static void entry_func( void * data) noe
struct BOOST_CONTEXT_DECL activation_record {
thread_local static activation_record * current_rec;
- ucontext_t uctx{};
- stack_context sctx{};
- bool main_ctx{ true };
- activation_record * from{ nullptr };
- std::function< void(activation_record*&) > ontop{};
- bool terminated{ false };
- bool force_unwind{ false };
+ ucontext_t uctx{};
+ stack_context sctx{};
+ bool main_ctx{ true };
+ activation_record * from{ nullptr };
+ std::function< activation_record*(activation_record*&) > ontop{};
+ bool terminated{ false };
+ bool force_unwind{ false };
#if defined(BOOST_USE_ASAN)
- void * fake_stack{ nullptr };
- void * stack_bottom{ nullptr };
- std::size_t stack_size{ 0 };
- bool started{ false };
+ void * fake_stack{ nullptr };
+ void * stack_bottom{ nullptr };
+ std::size_t stack_size{ 0 };
+ bool started{ false };
#endif
static activation_record *& current() noexcept;
@@ -168,20 +168,30 @@ struct BOOST_CONTEXT_DECL activation_rec
current()->ontop = std::bind(
[](typename std::decay< Fn >::type & fn, activation_record *& ptr){
Ctx c{ ptr };
- fn( std::move( c) );
+ c = fn( std::move( c) );
if ( ! c) {
ptr = nullptr;
}
+#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
+ return exchange( c.ptr_, nullptr);
+#else
+ return std::exchange( c.ptr_, nullptr);
+#endif
},
std::forward< Fn >( fn),
std::placeholders::_1);
#else
current()->ontop = [fn=std::forward<Fn>(fn)](activation_record *& ptr){
Ctx c{ ptr };
- fn( std::move( c) );
+ c = fn( std::move( c) );
if ( ! c) {
ptr = nullptr;
}
+#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
+ return exchange( c.ptr_, nullptr);
+#else
+ return std::exchange( c.ptr_, nullptr);
+#endif
};
#endif
#if defined(BOOST_USE_SEGMENTED_STACKS)
@@ -408,7 +418,7 @@ public:
if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
throw detail::forced_unwind{ ptr};
} else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
- detail::activation_record::current()->ontop( ptr);
+ ptr = detail::activation_record::current()->ontop( ptr);
detail::activation_record::current()->ontop = nullptr;
}
return continuation{ ptr };
@@ -426,7 +436,7 @@ public:
if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
throw detail::forced_unwind{ ptr};
} else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
- detail::activation_record::current()->ontop( ptr);
+ ptr = detail::activation_record::current()->ontop( ptr);
detail::activation_record::current()->ontop = nullptr;
}
return continuation{ ptr };
Index: boost_1_65_0/boost/context/continuation_winfib.hpp
===================================================================
--- boost_1_65_0.orig/boost/context/continuation_winfib.hpp
+++ boost_1_65_0/boost/context/continuation_winfib.hpp
@@ -65,13 +65,13 @@ static VOID WINAPI entry_func( LPVOID da
struct BOOST_CONTEXT_DECL activation_record {
thread_local static activation_record * current_rec;
- LPVOID fiber{ nullptr };
- stack_context sctx{};
- bool main_ctx{ true };
- activation_record * from{ nullptr };
- std::function< void(activation_record*&) > ontop{};
- bool terminated{ false };
- bool force_unwind{ false };
+ LPVOID fiber{ nullptr };
+ stack_context sctx{};
+ bool main_ctx{ true };
+ activation_record * from{ nullptr };
+ std::function< activation_record*(activation_record*&) > ontop{};
+ bool terminated{ false };
+ bool force_unwind{ false };
static activation_record *& current() noexcept;
@@ -142,20 +142,30 @@ struct BOOST_CONTEXT_DECL activation_rec
current()->ontop = std::bind(
[](typename std::decay< Fn >::type & fn, activation_record *& ptr){
Ctx c{ ptr };
- fn( std::move( c) );
+ c = fn( std::move( c) );
if ( ! c) {
ptr = nullptr;
}
+#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
+ return exchange( c.ptr_, nullptr);
+#else
+ return std::exchange( c.ptr_, nullptr);
+#endif
},
std::forward< Fn >( fn),
std::placeholders::_1);
#else
current()->ontop = [fn=std::forward<Fn>(fn)](activation_record *& ptr){
Ctx c{ ptr };
- fn( std::move( c) );
+ c = fn( std::move( c) );
if ( ! c) {
ptr = nullptr;
}
+#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
+ return exchange( c.ptr_, nullptr);
+#else
+ return std::exchange( c.ptr_, nullptr);
+#endif
};
#endif
// context switch
@@ -336,7 +346,7 @@ public:
if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
throw detail::forced_unwind{ ptr};
} else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
- detail::activation_record::current()->ontop( ptr);
+ ptr = detail::activation_record::current()->ontop( ptr);
detail::activation_record::current()->ontop = nullptr;
}
return continuation{ ptr };
@@ -354,7 +364,7 @@ public:
if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
throw detail::forced_unwind{ ptr};
} else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
- detail::activation_record::current()->ontop( ptr);
+ ptr = detail::activation_record::current()->ontop( ptr);
detail::activation_record::current()->ontop = nullptr;
}
return continuation{ ptr };
Index: boost_1_65_0/boost/thread/win32/condition_variable.hpp
===================================================================
--- boost_1_65_0.orig/boost/thread/win32/condition_variable.hpp
+++ boost_1_65_0/boost/thread/win32/condition_variable.hpp
@@ -211,7 +211,7 @@ namespace boost
{}
#endif
- void remove_waiter()
+ void remove_waiter_and_reset()
{
if (entry) {
boost::lock_guard<boost::mutex> internal_lock(internal_mutex);
@@ -221,7 +221,7 @@ namespace boost
}
~entry_manager() BOOST_NOEXCEPT_IF(false)
{
- remove_waiter();
+ remove_waiter_and_reset();
}
list_entry* operator->()
@@ -250,7 +250,7 @@ namespace boost
woken=entry->woken();
}
// do it here to avoid throwing on the destructor
- entry->remove_waiter();
+ entry.remove_waiter_and_reset();
locker.lock();
return woken;
}
Index: boost_1_65_0/libs/context/doc/callcc.qbk
===================================================================
--- boost_1_65_0.orig/libs/context/doc/callcc.qbk
+++ boost_1_65_0/libs/context/doc/callcc.qbk
@@ -176,6 +176,7 @@ return `void`.
c=c.resume_with([&data](ctx::continuation && c){
std::cout << "f2: entered: " << data << std::endl;
data=-1;
+ return std::move( c);
});
std::cout << "f1: returned third time" << std::endl;
@@ -221,6 +222,7 @@ an exception.
c = c.resume_with(
[](ctx::continuation && c){
throw my_exception(std::move(c),"abc");
+ return std::move( c);
});
output:
@@ -527,11 +529,11 @@ e.g. ['continuation::operator bool()] re
[variablelist
[[Effects:] [Captures current continuation and resumes `*this`.
-The function `resume_with`, is used to execute function `fn` in continuation
+The function `resume_with`, is used to execute function `fn` in the execution context of
`*this` (e.g. the stack frame of `fn` is allocated on stack of `*this`).]]
[[Returns:] [The continuation representing the continuation that has been
suspended.]]
-[[Note:] [Function `fn` needs to return void.]]
+[[Note:] [Function `fn` needs to return `continuation`.]]
[[Note:] [The returned continuation indicates if the suspended continuation has
terminated (return from context-function) via `bool operator()`.]]
]
Index: boost_1_65_0/libs/context/example/ontop.cpp
===================================================================
--- boost_1_65_0.orig/libs/context/example/ontop.cpp
+++ boost_1_65_0/libs/context/example/ontop.cpp
@@ -32,6 +32,7 @@ int main() {
c = c.resume_with( [&data](ctx::continuation && c){
std::cout << "f2: entered: " << data << std::endl;
data = -1;
+ return std::move( c);
});
std::cout << "f1: returned third time" << std::endl;
std::cout << "main: done" << std::endl;
Index: boost_1_65_0/libs/context/example/ontop_void.cpp
===================================================================
--- boost_1_65_0.orig/libs/context/example/ontop_void.cpp
+++ boost_1_65_0/libs/context/example/ontop_void.cpp
@@ -21,8 +21,9 @@ ctx::continuation f1( ctx::continuation
return std::move( c);
}
-void f2( ctx::continuation && c) {
+ctx::continuation f2( ctx::continuation && c) {
std::cout << "f2: entered" << std::endl;
+ return std::move( c);
}
int main() {
Index: boost_1_65_0/libs/context/example/throw.cpp
===================================================================
--- boost_1_65_0.orig/libs/context/example/throw.cpp
+++ boost_1_65_0/libs/context/example/throw.cpp
@@ -38,6 +38,7 @@ int main() {
c = c.resume_with(
[](ctx::continuation && c){
throw my_exception(std::move( c), "abc");
+ return std::move( c);
});
std::cout << "main: done" << std::endl;
Index: boost_1_65_0/libs/context/test/test_callcc.cpp
===================================================================
--- boost_1_65_0.orig/libs/context/test/test_callcc.cpp
+++ boost_1_65_0/libs/context/test/test_callcc.cpp
@@ -252,6 +252,7 @@ void test_ontop() {
c = c.resume_with(
[&i](ctx::continuation && c){
i -= 10;
+ return std::move( c);
});
BOOST_CHECK( c);
BOOST_CHECK_EQUAL( i, 200);
@@ -266,6 +267,7 @@ void test_ontop() {
c = c.resume_with(
[&c1](ctx::continuation && c){
c1 = std::move( c);
+ return std::move( c);
});
}
}
@@ -290,7 +292,8 @@ void test_ontop_exception() {
const char * what = "hello world";
c.resume_with(
[what](ctx::continuation && c){
- throw my_exception( std::move( c), what);
+ throw my_exception( std::move( c), what);
+ return std::move( c);
});
BOOST_CHECK_EQUAL( 3, value1);
BOOST_CHECK_EQUAL( std::string( what), value2);
Index: boost_1_65_0/libs/fiber/src/context.cpp
===================================================================
--- boost_1_65_0.orig/libs/fiber/src/context.cpp
+++ boost_1_65_0/libs/fiber/src/context.cpp
@@ -145,6 +145,7 @@ context::resume() noexcept {
// pass pointer to the context that resumes `this`
c_.resume_with([prev](boost::context::continuation && c){
prev->c_ = std::move( c);
+ return boost::context::continuation{};
});
}
@@ -158,6 +159,7 @@ context::resume( detail::spinlock_lock &
c_.resume_with([prev,&lk](boost::context::continuation && c){
prev->c_ = std::move( c);
lk.unlock();
+ return boost::context::continuation{};
});
}
@@ -171,6 +173,7 @@ context::resume( context * ready_ctx) no
c_.resume_with([prev,ready_ctx](boost::context::continuation && c){
prev->c_ = std::move( c);
context::active()->schedule( ready_ctx);
+ return boost::context::continuation{};
});
}
@@ -218,6 +221,7 @@ context::suspend_with_cc() noexcept {
// pass pointer to the context that resumes `this`
return c_.resume_with([prev](boost::context::continuation && c){
prev->c_ = std::move( c);
+ return boost::context::continuation{};
});
}

View File

@ -1,26 +0,0 @@
Index: boost_1_63_0/libs/fiber/build/Jamfile.v2
===================================================================
--- boost_1_63_0.orig/libs/fiber/build/Jamfile.v2
+++ boost_1_63_0/libs/fiber/build/Jamfile.v2
@@ -44,20 +44,6 @@ lib boost_fiber
recursive_timed_mutex.cpp
timed_mutex.cpp
scheduler.cpp
- : <link>shared:<library>../../context/build//boost_context
- [ requires cxx11_auto_declarations
- cxx11_constexpr
- cxx11_defaulted_functions
- cxx11_final
- cxx11_hdr_mutex
- cxx11_hdr_tuple
- cxx11_lambdas
- cxx11_noexcept
- cxx11_nullptr
- cxx11_rvalue_references
- cxx11_template_aliases
- cxx11_thread_local
- cxx11_variadic_templates ]
- ;
+ : <link>shared:<library>../../context/build//boost_context ;
boost-install boost_fiber ;

View File

@ -0,0 +1,12 @@
Index: boost_1_65_0/libs/fiber/src/numa/linux/pin_thread.cpp
===================================================================
--- boost_1_65_0.orig/libs/fiber/src/numa/linux/pin_thread.cpp
+++ boost_1_65_0/libs/fiber/src/numa/linux/pin_thread.cpp
@@ -9,6 +9,7 @@
extern "C" {
#include <pthread.h>
#include <sched.h>
+#include <string.h>
}
#include <system_error>

View File

@ -1,81 +0,0 @@
Index: boost_1_64_0/boost/context/continuation.hpp
===================================================================
--- boost_1_64_0.orig/boost/context/continuation.hpp 2017-04-24 12:36:55.987412031 +0100
+++ boost_1_64_0/boost/context/continuation.hpp 2017-04-24 12:37:49.730416122 +0100
@@ -56,7 +56,7 @@
namespace context {
namespace detail {
-template< int N >
+template<typename U>
struct helper {
template< typename T >
static T convert( T && t) noexcept {
@@ -64,8 +64,8 @@
}
};
-template<>
-struct helper< 1 > {
+template<typename U>
+struct helper< std::tuple<U> > {
template< typename T >
static std::tuple< T > convert( T && t) noexcept {
return std::make_tuple( std::forward< T >( t) );
@@ -239,15 +239,16 @@
}
-template< typename Ctx, typename Fn, typename ... Arg >
+template< typename Ctx, typename Fn, typename Arg >
detail::transfer_t context_ontop( detail::transfer_t t) {
- auto p = static_cast< std::tuple< Fn, std::tuple< Arg ... > > * >( t.data);
+ auto p = static_cast< Arg * >( t.data);
BOOST_ASSERT( nullptr != p);
typename std::decay< Fn >::type fn = std::forward< Fn >( std::get< 0 >( * p) );
t.data = & std::get< 1 >( * p);
Ctx c{ t };
// execute function, pass continuation via reference
- std::get< 1 >( * p) = detail::helper< sizeof ... (Arg) >::convert( fn( std::move( c) ) );
+ typedef typename std::decay<decltype(std::get<1>(*p))>::type H;
+ std::get< 1 >(* p) = detail::helper<H>::convert( fn( std::move( c) ) );
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
return { detail::exchange( c.t_.fctx, nullptr), & std::get< 1 >( * p) };
#else
@@ -275,7 +276,7 @@
template< typename Ctx, typename StackAlloc, typename Fn >
friend class detail::record;
- template< typename Ctx, typename Fn, typename ... Arg >
+ template< typename Ctx, typename Fn, typename Arg >
friend detail::transfer_t
context_ontop( detail::transfer_t);
@@ -354,7 +355,7 @@
template< typename Fn, typename ... Arg >
continuation resume_with( Fn && fn, Arg ... arg) {
BOOST_ASSERT( nullptr != t_.fctx);
- auto tpl = std::make_tuple( std::forward< Fn >( fn), std::forward< Arg >( arg) ... );
+ auto tpl = std::make_tuple( std::forward< Fn >( fn), std::make_tuple( std::forward< Arg >( arg) ... ));
return detail::ontop_fcontext(
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
detail::exchange( t_.fctx, nullptr),
@@ -362,7 +363,7 @@
std::exchange( t_.fctx, nullptr),
#endif
& tpl,
- context_ontop< continuation, Fn, Arg ... >);
+ context_ontop< continuation, Fn, decltype(tpl) >);
}
continuation resume() {
@@ -451,7 +452,8 @@
template<
typename Fn,
typename ... Arg,
- typename = detail::disable_overload< continuation, Fn >
+ typename = detail::disable_overload< continuation, Fn >,
+ typename = detail::disable_overload< std::allocator_arg_t, Fn >
>
continuation
callcc( Fn && fn, Arg ... arg) {