[asio,boost-asio] Fix experimental::coro compile error with MSVC (#32004)

This commit is contained in:
Connor Broyles 2023-06-14 22:16:45 -04:00 committed by GitHub
parent e61fc59376
commit 678323514f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 280 additions and 4 deletions

View File

@ -0,0 +1,131 @@
diff --git a/asio/include/asio/experimental/impl/coro.hpp b/asio/include/asio/experimental/impl/coro.hpp
index a4d8d277..9f01687e 100644
--- a/asio/include/asio/experimental/impl/coro.hpp
+++ b/asio/include/asio/experimental/impl/coro.hpp
@@ -1069,17 +1069,17 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::true_type /* error is noexcept */,
std::true_type /* result is void */) //noexcept
{
- return [this, coro = coro_,
+ return [this, coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- assert(coro);
+ assert(coro_promise_);
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
assert(ch && !ch.done());
- coro->awaited_from = post_coroutine(std::move(exec), std::move(h));
- coro->reset_error();
+ coro_promise_->awaited_from = post_coroutine(std::move(exec), std::move(h));
+ coro_promise_->reset_error();
ch.resume();
};
}
@@ -1090,18 +1090,18 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::true_type /* error is noexcept */,
std::false_type /* result is void */) //noexcept
{
- return [coro = coro_,
+ return [coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- assert(coro);
+ assert(coro_promise_);
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
assert(ch && !ch.done());
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->result_).handle;
- coro->reset_error();
+ coro_promise_->awaited_from = detail::post_coroutine(
+ exec, std::move(h), coro_promise_->result_).handle;
+ coro_promise_->reset_error();
ch.resume();
};
}
@@ -1111,16 +1111,16 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::false_type /* error is noexcept */,
std::true_type /* result is void */)
{
- return [coro = coro_,
+ return [coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- if (!coro)
+ if (!coro_promise_)
return asio::post(exec,
asio::append(std::move(h),
detail::coro_error<error_type>::invalid()));
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
if (!ch)
return asio::post(exec,
asio::append(std::move(h),
@@ -1131,9 +1131,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
detail::coro_error<error_type>::done()));
else
{
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->error_).handle;
- coro->reset_error();
+ coro_promise_->awaited_from = detail::post_coroutine(
+ exec, std::move(h), coro_promise_->error_).handle;
+ coro_promise_->reset_error();
ch.resume();
}
};
@@ -1144,17 +1144,17 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::false_type /* error is noexcept */,
std::false_type /* result is void */)
{
- return [coro = coro_,
+ return [coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- if (!coro)
+ if (!coro_promise_)
return asio::post(exec,
asio::append(std::move(h),
detail::coro_error<error_type>::invalid(), result_type{}));
auto ch =
- detail::coroutine_handle<promise_type>::from_promise(*coro);
+ detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
if (!ch)
return asio::post(exec,
asio::append(std::move(h),
@@ -1165,9 +1165,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
detail::coro_error<error_type>::done(), result_type{}));
else
{
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->error_, coro->result_).handle;
- coro->reset_error();
+ coro_promise_->awaited_from = detail::post_coroutine(
+ exec, std::move(h), coro_promise_->error_, coro_promise_->result_).handle;
+ coro_promise_->reset_error();
ch.resume();
}
};
@@ -1203,9 +1203,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
[h = handle(exec, std::forward<WaitHandler>(handler),
std::integral_constant<bool, is_noexcept>{},
std::is_void<result_type>{}),
- in = std::forward<Input>(input), coro = coro_]() mutable
+ in = std::forward<Input>(input), coro_promise_ = coro_]() mutable
{
- coro->input_ = std::move(in);
+ coro_promise_->input_ = std::move(in);
std::move(h)();
});
}

View File

@ -6,6 +6,7 @@ vcpkg_from_github(
REF asio-1-28-0
SHA512 0d635c40a28b6427e2cb6b9c89ab53dba7d3a237df2279148ca05fa899d6f8039a131929230e5ca1dbc7477be784e3da9a6cb68456cbf194178510621556e467
HEAD_REF master
PATCHES fix_coro_compile_error_msvc.patch #upstream PR: https://github.com/chriskohlhoff/asio/pull/1313
)
# Always use "ASIO_STANDALONE" to avoid boost dependency

View File

@ -1,6 +1,7 @@
{
"name": "asio",
"version": "1.28.0",
"port-version": 1,
"description": "Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.",
"homepage": "https://github.com/chriskohlhoff/asio",
"documentation": "https://think-async.com/Asio/asio-1.28.0/doc/",

View File

@ -0,0 +1,131 @@
diff --git a/include/boost/asio/experimental/impl/coro.hpp b/include/boost/asio/experimental/impl/coro.hpp
index ec7d956e..ba219453 100644
--- a/include/boost/asio/experimental/impl/coro.hpp
+++ b/include/boost/asio/experimental/impl/coro.hpp
@@ -1070,17 +1070,17 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::true_type /* error is noexcept */,
std::true_type /* result is void */) //noexcept
{
- return [this, coro = coro_,
+ return [this, coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- assert(coro);
+ assert(coro_promise_);
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
assert(ch && !ch.done());
- coro->awaited_from = post_coroutine(std::move(exec), std::move(h));
- coro->reset_error();
+ coro_promise_->awaited_from = post_coroutine(std::move(exec), std::move(h));
+ coro_promise_->reset_error();
ch.resume();
};
}
@@ -1091,18 +1091,18 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::true_type /* error is noexcept */,
std::false_type /* result is void */) //noexcept
{
- return [coro = coro_,
+ return [coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- assert(coro);
+ assert(coro_promise_);
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
assert(ch && !ch.done());
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->result_).handle;
- coro->reset_error();
+ coro_promise_->awaited_from = detail::post_coroutine(
+ exec, std::move(h), coro_promise_->result_).handle;
+ coro_promise_->reset_error();
ch.resume();
};
}
@@ -1112,16 +1112,16 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::false_type /* error is noexcept */,
std::true_type /* result is void */)
{
- return [coro = coro_,
+ return [coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- if (!coro)
+ if (!coro_promise_)
return boost::asio::post(exec,
boost::asio::append(std::move(h),
detail::coro_error<error_type>::invalid()));
- auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro);
+ auto ch = detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
if (!ch)
return boost::asio::post(exec,
boost::asio::append(std::move(h),
@@ -1132,9 +1132,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
detail::coro_error<error_type>::done()));
else
{
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->error_).handle;
- coro->reset_error();
+ coro_promise_->awaited_from = detail::post_coroutine(
+ exec, std::move(h), coro_promise_->error_).handle;
+ coro_promise_->reset_error();
ch.resume();
}
};
@@ -1145,17 +1145,17 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
std::false_type /* error is noexcept */,
std::false_type /* result is void */)
{
- return [coro = coro_,
+ return [coro_promise_ = coro_,
h = std::forward<WaitHandler>(handler),
exec = std::move(exec)]() mutable
{
- if (!coro)
+ if (!coro_promise_)
return boost::asio::post(exec,
boost::asio::append(std::move(h),
detail::coro_error<error_type>::invalid(), result_type{}));
auto ch =
- detail::coroutine_handle<promise_type>::from_promise(*coro);
+ detail::coroutine_handle<promise_type>::from_promise(*coro_promise_);
if (!ch)
return boost::asio::post(exec,
boost::asio::append(std::move(h),
@@ -1166,9 +1166,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
detail::coro_error<error_type>::done(), result_type{}));
else
{
- coro->awaited_from = detail::post_coroutine(
- exec, std::move(h), coro->error_, coro->result_).handle;
- coro->reset_error();
+ coro_promise_->awaited_from = detail::post_coroutine(
+ exec, std::move(h), coro_promise_->error_, coro_promise_->result_).handle;
+ coro_promise_->reset_error();
ch.resume();
}
};
@@ -1204,9 +1204,9 @@ struct coro<Yield, Return, Executor, Allocator>::initiate_async_resume
[h = handle(exec, std::forward<WaitHandler>(handler),
std::integral_constant<bool, is_noexcept>{},
std::is_void<result_type>{}),
- in = std::forward<Input>(input), coro = coro_]() mutable
+ in = std::forward<Input>(input), coro_promise_ = coro_]() mutable
{
- coro->input_ = std::move(in);
+ coro_promise_->input_ = std::move(in);
std::move(h)();
});
}

View File

@ -6,7 +6,9 @@ vcpkg_from_github(
REF boost-1.82.0
SHA512 d54fd77ca7996da138b10408df1eae28bbcae0c6475467cc19837bf6f6624c38ad7f9e1eec87ceae27f516583b204fdbaeb04daad7cc28e6aeec02ab5f188731
HEAD_REF master
PATCHES windows_alloca_header.patch
PATCHES
windows_alloca_header.patch
fix_coro_compile_error_msvc.patch #upstream PR: https://github.com/chriskohlhoff/asio/pull/1313
)
include(${CURRENT_INSTALLED_DIR}/share/boost-vcpkg-helpers/boost-modular-headers.cmake)

View File

@ -2,7 +2,7 @@
"$comment": "Automatically generated by scripts/boost/generate-ports.ps1",
"name": "boost-asio",
"version": "1.82.0",
"port-version": 2,
"port-version": 3,
"description": "Boost asio module",
"homepage": "https://github.com/boostorg/asio",
"license": "BSL-1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "726d66784925af6062a5a8f285c76dab2469572f",
"version": "1.28.0",
"port-version": 1
},
{
"git-tree": "7dde6674d23759f187d73d08f3bd869562a41e8d",
"version": "1.28.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2ae81c27afef052cdab26f3bbadb1154905cfecc",
"version": "1.82.0",
"port-version": 3
},
{
"git-tree": "12dc4325ca29b508676211dfadc95ff688a00395",
"version": "1.82.0",

View File

@ -234,7 +234,7 @@
},
"asio": {
"baseline": "1.28.0",
"port-version": 0
"port-version": 1
},
"asio-grpc": {
"baseline": "2.5.1",
@ -650,7 +650,7 @@
},
"boost-asio": {
"baseline": "1.82.0",
"port-version": 2
"port-version": 3
},
"boost-assert": {
"baseline": "1.82.0",