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

feat(common): g::c::future support for coroutines #8532

Merged
merged 3 commits into from
Mar 14, 2022

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Mar 11, 2022

Integrate google::cloud::future<T> with C++20 coroutines. This
feature is optional, and only enabled if the compiler supports C++20.
Because some C++20 compilers disable coroutines by default, this feature
is disabled if __cpp_impl_coroutine is not defined, or it is 0.

I verified our C++20 build actually tests these features.


This change is Reviewable

Integrate `google::cloud::future<T>` with C++20 coroutines.  This
feature is optional, and only enabled if the compiler supports C++20.
Because some C++20 compilers disable coroutines by default, this feature
is disabled if `__cpp_impl_coroutine` is not defined, or it is 0.
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 3ab86e6cc2a32b2502f37c964d1cbcacbaa2bd8f

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #8532 (2346d84) into main (8e39dd5) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8532      +/-   ##
==========================================
- Coverage   93.92%   93.92%   -0.01%     
==========================================
  Files        1453     1453              
  Lines      125889   125889              
==========================================
- Hits       118247   118239       -8     
- Misses       7642     7650       +8     
Impacted Files Coverage Δ
google/cloud/future_generic.h 100.00% <ø> (ø)
google/cloud/future_void.h 100.00% <ø> (ø)
google/cloud/internal/future_base.h 100.00% <ø> (ø)
google/cloud/internal/future_impl.h 94.27% <ø> (ø)
...e/cloud/spanner/testing/cleanup_stale_instances.cc 61.29% <0.00%> (-19.36%) ⬇️
...le/cloud/storage/internal/curl_download_request.cc 89.75% <0.00%> (-0.36%) ⬇️
...cloud/pubsub/internal/subscription_session_test.cc 98.00% <0.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e39dd5...2346d84. Read the comment docs.

coryan added 2 commits March 12, 2022 00:22
I think the new code is cleaner too, so there is that.
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 2346d847ef94c4716d49e1dd0964a358c86a6aaa

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan marked this pull request as ready for review March 12, 2022 01:05
@coryan coryan requested a review from a team as a code owner March 12, 2022 01:05
Copy link
Contributor

@devjgm devjgm left a comment

Choose a reason for hiding this comment

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

I'm new to C++20, but from what I can tell this LGTM.


/// Specialize `std::coroutine_traits` for `google::cloud::future<T>`.
template <typename T, typename... Args>
requires(!std::is_void_v<T> && !std::is_reference_v<T>) /**/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is /**/ intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, clang-format does a poor job with these otherwise.

@coryan coryan merged commit a5a805c into googleapis:main Mar 14, 2022
@coryan coryan deleted the prototype-coroutine-support branch March 14, 2022 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants