bash: version bump to 4.4.12
[feed/packages.git] / libs / boost / patches / 010-boost-1.65.0_after_release_patches.patch
1 Index: boost_1_65_0/boost/context/continuation_fcontext.hpp
2 ===================================================================
3 --- boost_1_65_0.orig/boost/context/continuation_fcontext.hpp
4 +++ boost_1_65_0/boost/context/continuation_fcontext.hpp
5 @@ -95,7 +95,7 @@ transfer_t context_ontop( transfer_t t)
6 t.data = nullptr;
7 Ctx c{ t.fctx };
8 // execute function, pass continuation via reference
9 - fn( std::move( c) );
10 + c = fn( std::move( c) );
11 #if defined(BOOST_NO_CXX14_STD_EXCHANGE)
12 return { exchange( c.fctx_, nullptr), nullptr };
13 #else
14 Index: boost_1_65_0/boost/context/continuation_ucontext.hpp
15 ===================================================================
16 --- boost_1_65_0.orig/boost/context/continuation_ucontext.hpp
17 +++ boost_1_65_0/boost/context/continuation_ucontext.hpp
18 @@ -84,18 +84,18 @@ static void entry_func( void * data) noe
19 struct BOOST_CONTEXT_DECL activation_record {
20 thread_local static activation_record * current_rec;
21
22 - ucontext_t uctx{};
23 - stack_context sctx{};
24 - bool main_ctx{ true };
25 - activation_record * from{ nullptr };
26 - std::function< void(activation_record*&) > ontop{};
27 - bool terminated{ false };
28 - bool force_unwind{ false };
29 + ucontext_t uctx{};
30 + stack_context sctx{};
31 + bool main_ctx{ true };
32 + activation_record * from{ nullptr };
33 + std::function< activation_record*(activation_record*&) > ontop{};
34 + bool terminated{ false };
35 + bool force_unwind{ false };
36 #if defined(BOOST_USE_ASAN)
37 - void * fake_stack{ nullptr };
38 - void * stack_bottom{ nullptr };
39 - std::size_t stack_size{ 0 };
40 - bool started{ false };
41 + void * fake_stack{ nullptr };
42 + void * stack_bottom{ nullptr };
43 + std::size_t stack_size{ 0 };
44 + bool started{ false };
45 #endif
46
47 static activation_record *& current() noexcept;
48 @@ -168,20 +168,30 @@ struct BOOST_CONTEXT_DECL activation_rec
49 current()->ontop = std::bind(
50 [](typename std::decay< Fn >::type & fn, activation_record *& ptr){
51 Ctx c{ ptr };
52 - fn( std::move( c) );
53 + c = fn( std::move( c) );
54 if ( ! c) {
55 ptr = nullptr;
56 }
57 +#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
58 + return exchange( c.ptr_, nullptr);
59 +#else
60 + return std::exchange( c.ptr_, nullptr);
61 +#endif
62 },
63 std::forward< Fn >( fn),
64 std::placeholders::_1);
65 #else
66 current()->ontop = [fn=std::forward<Fn>(fn)](activation_record *& ptr){
67 Ctx c{ ptr };
68 - fn( std::move( c) );
69 + c = fn( std::move( c) );
70 if ( ! c) {
71 ptr = nullptr;
72 }
73 +#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
74 + return exchange( c.ptr_, nullptr);
75 +#else
76 + return std::exchange( c.ptr_, nullptr);
77 +#endif
78 };
79 #endif
80 #if defined(BOOST_USE_SEGMENTED_STACKS)
81 @@ -408,7 +418,7 @@ public:
82 if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
83 throw detail::forced_unwind{ ptr};
84 } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
85 - detail::activation_record::current()->ontop( ptr);
86 + ptr = detail::activation_record::current()->ontop( ptr);
87 detail::activation_record::current()->ontop = nullptr;
88 }
89 return continuation{ ptr };
90 @@ -426,7 +436,7 @@ public:
91 if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
92 throw detail::forced_unwind{ ptr};
93 } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
94 - detail::activation_record::current()->ontop( ptr);
95 + ptr = detail::activation_record::current()->ontop( ptr);
96 detail::activation_record::current()->ontop = nullptr;
97 }
98 return continuation{ ptr };
99 Index: boost_1_65_0/boost/context/continuation_winfib.hpp
100 ===================================================================
101 --- boost_1_65_0.orig/boost/context/continuation_winfib.hpp
102 +++ boost_1_65_0/boost/context/continuation_winfib.hpp
103 @@ -65,13 +65,13 @@ static VOID WINAPI entry_func( LPVOID da
104 struct BOOST_CONTEXT_DECL activation_record {
105 thread_local static activation_record * current_rec;
106
107 - LPVOID fiber{ nullptr };
108 - stack_context sctx{};
109 - bool main_ctx{ true };
110 - activation_record * from{ nullptr };
111 - std::function< void(activation_record*&) > ontop{};
112 - bool terminated{ false };
113 - bool force_unwind{ false };
114 + LPVOID fiber{ nullptr };
115 + stack_context sctx{};
116 + bool main_ctx{ true };
117 + activation_record * from{ nullptr };
118 + std::function< activation_record*(activation_record*&) > ontop{};
119 + bool terminated{ false };
120 + bool force_unwind{ false };
121
122 static activation_record *& current() noexcept;
123
124 @@ -142,20 +142,30 @@ struct BOOST_CONTEXT_DECL activation_rec
125 current()->ontop = std::bind(
126 [](typename std::decay< Fn >::type & fn, activation_record *& ptr){
127 Ctx c{ ptr };
128 - fn( std::move( c) );
129 + c = fn( std::move( c) );
130 if ( ! c) {
131 ptr = nullptr;
132 }
133 +#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
134 + return exchange( c.ptr_, nullptr);
135 +#else
136 + return std::exchange( c.ptr_, nullptr);
137 +#endif
138 },
139 std::forward< Fn >( fn),
140 std::placeholders::_1);
141 #else
142 current()->ontop = [fn=std::forward<Fn>(fn)](activation_record *& ptr){
143 Ctx c{ ptr };
144 - fn( std::move( c) );
145 + c = fn( std::move( c) );
146 if ( ! c) {
147 ptr = nullptr;
148 }
149 +#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
150 + return exchange( c.ptr_, nullptr);
151 +#else
152 + return std::exchange( c.ptr_, nullptr);
153 +#endif
154 };
155 #endif
156 // context switch
157 @@ -336,7 +346,7 @@ public:
158 if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
159 throw detail::forced_unwind{ ptr};
160 } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
161 - detail::activation_record::current()->ontop( ptr);
162 + ptr = detail::activation_record::current()->ontop( ptr);
163 detail::activation_record::current()->ontop = nullptr;
164 }
165 return continuation{ ptr };
166 @@ -354,7 +364,7 @@ public:
167 if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) {
168 throw detail::forced_unwind{ ptr};
169 } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) {
170 - detail::activation_record::current()->ontop( ptr);
171 + ptr = detail::activation_record::current()->ontop( ptr);
172 detail::activation_record::current()->ontop = nullptr;
173 }
174 return continuation{ ptr };
175 Index: boost_1_65_0/boost/thread/win32/condition_variable.hpp
176 ===================================================================
177 --- boost_1_65_0.orig/boost/thread/win32/condition_variable.hpp
178 +++ boost_1_65_0/boost/thread/win32/condition_variable.hpp
179 @@ -211,7 +211,7 @@ namespace boost
180 {}
181 #endif
182
183 - void remove_waiter()
184 + void remove_waiter_and_reset()
185 {
186 if (entry) {
187 boost::lock_guard<boost::mutex> internal_lock(internal_mutex);
188 @@ -221,7 +221,7 @@ namespace boost
189 }
190 ~entry_manager() BOOST_NOEXCEPT_IF(false)
191 {
192 - remove_waiter();
193 + remove_waiter_and_reset();
194 }
195
196 list_entry* operator->()
197 @@ -250,7 +250,7 @@ namespace boost
198 woken=entry->woken();
199 }
200 // do it here to avoid throwing on the destructor
201 - entry->remove_waiter();
202 + entry.remove_waiter_and_reset();
203 locker.lock();
204 return woken;
205 }
206 Index: boost_1_65_0/libs/context/doc/callcc.qbk
207 ===================================================================
208 --- boost_1_65_0.orig/libs/context/doc/callcc.qbk
209 +++ boost_1_65_0/libs/context/doc/callcc.qbk
210 @@ -176,6 +176,7 @@ return `void`.
211 c=c.resume_with([&data](ctx::continuation && c){
212 std::cout << "f2: entered: " << data << std::endl;
213 data=-1;
214 + return std::move( c);
215 });
216 std::cout << "f1: returned third time" << std::endl;
217
218 @@ -221,6 +222,7 @@ an exception.
219 c = c.resume_with(
220 [](ctx::continuation && c){
221 throw my_exception(std::move(c),"abc");
222 + return std::move( c);
223 });
224
225 output:
226 @@ -527,11 +529,11 @@ e.g. ['continuation::operator bool()] re
227
228 [variablelist
229 [[Effects:] [Captures current continuation and resumes `*this`.
230 -The function `resume_with`, is used to execute function `fn` in continuation
231 +The function `resume_with`, is used to execute function `fn` in the execution context of
232 `*this` (e.g. the stack frame of `fn` is allocated on stack of `*this`).]]
233 [[Returns:] [The continuation representing the continuation that has been
234 suspended.]]
235 -[[Note:] [Function `fn` needs to return void.]]
236 +[[Note:] [Function `fn` needs to return `continuation`.]]
237 [[Note:] [The returned continuation indicates if the suspended continuation has
238 terminated (return from context-function) via `bool operator()`.]]
239 ]
240 Index: boost_1_65_0/libs/context/example/ontop.cpp
241 ===================================================================
242 --- boost_1_65_0.orig/libs/context/example/ontop.cpp
243 +++ boost_1_65_0/libs/context/example/ontop.cpp
244 @@ -32,6 +32,7 @@ int main() {
245 c = c.resume_with( [&data](ctx::continuation && c){
246 std::cout << "f2: entered: " << data << std::endl;
247 data = -1;
248 + return std::move( c);
249 });
250 std::cout << "f1: returned third time" << std::endl;
251 std::cout << "main: done" << std::endl;
252 Index: boost_1_65_0/libs/context/example/ontop_void.cpp
253 ===================================================================
254 --- boost_1_65_0.orig/libs/context/example/ontop_void.cpp
255 +++ boost_1_65_0/libs/context/example/ontop_void.cpp
256 @@ -21,8 +21,9 @@ ctx::continuation f1( ctx::continuation
257 return std::move( c);
258 }
259
260 -void f2( ctx::continuation && c) {
261 +ctx::continuation f2( ctx::continuation && c) {
262 std::cout << "f2: entered" << std::endl;
263 + return std::move( c);
264 }
265
266 int main() {
267 Index: boost_1_65_0/libs/context/example/throw.cpp
268 ===================================================================
269 --- boost_1_65_0.orig/libs/context/example/throw.cpp
270 +++ boost_1_65_0/libs/context/example/throw.cpp
271 @@ -38,6 +38,7 @@ int main() {
272 c = c.resume_with(
273 [](ctx::continuation && c){
274 throw my_exception(std::move( c), "abc");
275 + return std::move( c);
276 });
277
278 std::cout << "main: done" << std::endl;
279 Index: boost_1_65_0/libs/context/test/test_callcc.cpp
280 ===================================================================
281 --- boost_1_65_0.orig/libs/context/test/test_callcc.cpp
282 +++ boost_1_65_0/libs/context/test/test_callcc.cpp
283 @@ -252,6 +252,7 @@ void test_ontop() {
284 c = c.resume_with(
285 [&i](ctx::continuation && c){
286 i -= 10;
287 + return std::move( c);
288 });
289 BOOST_CHECK( c);
290 BOOST_CHECK_EQUAL( i, 200);
291 @@ -266,6 +267,7 @@ void test_ontop() {
292 c = c.resume_with(
293 [&c1](ctx::continuation && c){
294 c1 = std::move( c);
295 + return std::move( c);
296 });
297 }
298 }
299 @@ -290,7 +292,8 @@ void test_ontop_exception() {
300 const char * what = "hello world";
301 c.resume_with(
302 [what](ctx::continuation && c){
303 - throw my_exception( std::move( c), what);
304 + throw my_exception( std::move( c), what);
305 + return std::move( c);
306 });
307 BOOST_CHECK_EQUAL( 3, value1);
308 BOOST_CHECK_EQUAL( std::string( what), value2);
309 Index: boost_1_65_0/libs/fiber/src/context.cpp
310 ===================================================================
311 --- boost_1_65_0.orig/libs/fiber/src/context.cpp
312 +++ boost_1_65_0/libs/fiber/src/context.cpp
313 @@ -145,6 +145,7 @@ context::resume() noexcept {
314 // pass pointer to the context that resumes `this`
315 c_.resume_with([prev](boost::context::continuation && c){
316 prev->c_ = std::move( c);
317 + return boost::context::continuation{};
318 });
319 }
320
321 @@ -158,6 +159,7 @@ context::resume( detail::spinlock_lock &
322 c_.resume_with([prev,&lk](boost::context::continuation && c){
323 prev->c_ = std::move( c);
324 lk.unlock();
325 + return boost::context::continuation{};
326 });
327 }
328
329 @@ -171,6 +173,7 @@ context::resume( context * ready_ctx) no
330 c_.resume_with([prev,ready_ctx](boost::context::continuation && c){
331 prev->c_ = std::move( c);
332 context::active()->schedule( ready_ctx);
333 + return boost::context::continuation{};
334 });
335 }
336
337 @@ -218,6 +221,7 @@ context::suspend_with_cc() noexcept {
338 // pass pointer to the context that resumes `this`
339 return c_.resume_with([prev](boost::context::continuation && c){
340 prev->c_ = std::move( c);
341 + return boost::context::continuation{};
342 });
343 }
344