Skip to content
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

Downlevel standard coroutine support #1730

Merged
merged 4 commits into from
Mar 12, 2021

Conversation

joemmett
Copy link
Member

@joemmett joemmett commented Mar 11, 2021

Allow <coroutine> to be included if _DOWNLEVEL_COROUTINES_SUPPORTED
is defined even if __cpp_lib_coroutine is not. Allows use of standard
coroutines in C++14 and C++17 modes with a compiler that supports it.
Comparison operators are explicitly defined instead of <=> in these
modes.

This mirrors the STL changes in internal MSVC-PR-309095.

Allow `<coroutine>` to be included if `_DOWNLEVEL_COROUTINES_SUPPORTED`
is defined even if `__cpp_lib_coroutine` is not. Allows use of standard
coroutines in C++14 and C++17 modes with a compiler that permits it.
Comparison operators are explicitly defined instead of <=> in these
modes.

Corresponding compiler changes are expected to come in 16.10.
@joemmett joemmett requested a review from a team as a code owner March 11, 2021 16:59
@CaseyCarter CaseyCarter added the enhancement Something can be improved label Mar 11, 2021
tests/std/tests/P0912R5_coroutine/env.lst Outdated Show resolved Hide resolved
stl/inc/coroutine Outdated Show resolved Hide resolved
joemmett and others added 2 commits March 11, 2021 19:18
Add /permissive- to the /Zc:preprocessor config.

Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
- Move detection of downlevel coroutines to yvals_core.h in
  definition of __cpp_lib_coroutine.
- Rework inclusion of <coroutine> in terms of __cpp_lib_coroutine,
guard <compare> inclusion and spaceship definition in _HAS_CXX20.
- C++14-ify the coroutine test.
@StephanTLavavej StephanTLavavej self-assigned this Mar 12, 2021
@StephanTLavavej StephanTLavavej removed their assignment Mar 12, 2021
@StephanTLavavej StephanTLavavej merged commit c5ee3b3 into microsoft:main Mar 12, 2021
@StephanTLavavej
Copy link
Member

Thanks for improving the past via time travel! 📅 🚀 🎉 😹

@@ -1296,6 +1292,10 @@
#define __cpp_lib_shared_ptr_arrays 201611L // P0497R0 Fixing shared_ptr For Arrays
#endif // _HAS_CXX20

#if defined(__cpp_impl_coroutine) || defined(_DOWNLEVEL_COROUTINES_SUPPORTED) // TRANSITION, Clang coroutine support
Copy link
Member

@CaseyCarter CaseyCarter Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late feedback: We should remove the TRANSITION comment. Now that this is outside of _HAS_CXX20, this condition is permanent. I hate to make a PR for a single comment cleanup. @stl (Sorry!) @StephanTLavavej, do you have a "miscellaneous cleanups" branch laying around you could add this change to, or should I start one of my own?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had recorded a todo about the matching comment being out of date (too small to reset testing), I’ll add this to that list, and fix it when we’re done with deadlines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants