-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify experimental includes #171
base: master
Are you sure you want to change the base?
Unify experimental includes #171
Conversation
@andreasbuhr Something isn't right here, the PR says that you extracted parts of my pull request here, but in truth, all my commits (and @mmha 's commit too, and a few from you) is included in this PR, along with some merge commits. If this pull request is only the experimental include fix, shouldn't it just be a single commit, the cherry-pick of 0b201f8? |
Yes, you are right. I cherry-picked your whole pull request. I see three options:
|
You can also fix this PR by (with your unify_experimantal_includes branch checked out locally):
|
Starting with GCC 10.1, GCC/libstdc++ supports coroutines, but includes them in their final location in <coroutine>. This commit generalizes the location of the header, and the name of the types (either in the std or std::experimental namespace), so that both the current Clang/MSVC and the GCC approach can be supported. This should also guarantee that both current and later Clang/MSVC releases will be supported by the library.
48a7b99
to
b62a8af
Compare
The change for <coroutine> vs. <experimental/coroutine> is replicated for <filesystem> in this patch. In addition, the std::experimental namespace is replaced by cppcoro:: namespace in a few more places.
b62a8af
to
06b3bab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! A couple of minor comments.
But otherwise looks good.
include/cppcoro/coroutine.hpp
Outdated
|
||
using suspend_always = std::suspend_always; | ||
using suspend_never = std::suspend_never; | ||
static inline auto noop_coroutine() { return std::noop_coroutine(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just be using std::noop_coroutine;
?
Similarly for the other names?
using std::coroutine_handle;
using std::suspend_always;
using std::suspend_never;
using std::noop_coroutine;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this looks much better. Done.
@@ -11,7 +11,7 @@ | |||
|
|||
#include <atomic> | |||
#include <optional> | |||
#include <experimental/coroutine> | |||
#include <cppcoro/coroutine.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove this include if it's not being used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -11,7 +11,7 @@ | |||
|
|||
#include <atomic> | |||
#include <optional> | |||
#include <experimental/coroutine> | |||
#include <cppcoro/coroutine.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here. Remove this include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -15,7 +15,7 @@ | |||
|
|||
# include <atomic> | |||
# include <optional> | |||
# include <experimental/coroutine> | |||
# include <cppcoro/coroutine.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this include? It doesn't seem to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
I'll just squash the changes during the merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes.
include/cppcoro/coroutine.hpp
Outdated
using std::experimental::coroutine_handle; | ||
using std::experimental::suspend_always; | ||
using std::experimental::suspend_never; | ||
using std::experimental::noop_coroutine; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to break MSVC 2017 (and I think also some MSVC 2019 versions), which doesn't have noop_coroutine()
.
Maybe put this inside #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER
and add an include of <cppcoro/config.hpp>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed now thx to @Garcia6l20
This pull request is now open for two month. I now stop maintaining this pull request. From now on, I will continue to maintain the master branch in https://github.com/andreasbuhr/cppcoro. There we have CMake support, a CI based on Github Actions, and support for the latest compilers. |
This pull request cares about three issues:
#include <coroutine>
vs.#include <experimental/coroutine>
problem. A header is introduced which checks which include is available.std::
vs.std::experimental::
namespace issue. Coroutine related things a defined into the cppcoro:: namespace.This pull request is based on the pull request #158 by @dutow. Thanks to @dutow for the great work.
Pull request 158 addresses several issues at the same time. I extracted this pull request which cares only about one single issue, in order to have an easy to review pull request.
To help improve this pull request, please fork https://github.com/andreasbuhr/cppcoro/tree/unify_experimental_includes and create a pull request toward this branch.