Skip to content

Conversation

@StephanTLavavej
Copy link
Member

@StephanTLavavej StephanTLavavej commented Aug 19, 2020

  • Remove /await from test configurations.
  • Update VSO_0157762_feature_test_macros/env.lst comment.
    • Now this mentions another intentional difference from usual_matrix.lst.
  • Add missing /fp:strict to MEOW_winsdk_matrix.lst.
  • Add missing /Zc:noexceptTypes- to locale0_implib_cpp_matrix.lst.
  • Remove VSO-1093670 workaround.
  • Unskip a configuration of VSO_0000000_string_view_idl.

The rationale for removing /await coverage is that the STL is almost completely insensitive to this option. The only places we detect it are Standard <coroutine> where it's simply rejected:

STL/stl/inc/coroutine

Lines 12 to 15 in 3cca473

#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED
#pragma message("The contents of <coroutine> are not available with /await.")
#pragma message("Remove /await for standard coroutines or use <experimental/coroutine> for legacy /await support.")
#else // ^^^ /await ^^^ / vvv no /await vvv

and <future> which defines support machinery:

STL/stl/inc/future

Lines 1505 to 1599 in 3cca473

#ifdef _RESUMABLE_FUNCTIONS_SUPPORTED
// Experimental coroutine support for std::future. Subject to change/removal!
namespace experimental {
template <class _Ty, class... _ArgTypes>
struct coroutine_traits<future<_Ty>, _ArgTypes...> {
// defines resumable traits for functions returning future<_Ty>
struct promise_type {
promise<_Ty> _MyPromise;
future<_Ty> get_return_object() {
return _MyPromise.get_future();
}
suspend_never initial_suspend() const noexcept {
return {};
}
suspend_never final_suspend() const noexcept {
return {};
}
template <class _Ut>
void return_value(_Ut&& _Value) {
_MyPromise.set_value(_STD forward<_Ut>(_Value));
}
void unhandled_exception() {
_MyPromise.set_exception(_STD current_exception());
}
};
};
template <class... _ArgTypes>
struct coroutine_traits<future<void>, _ArgTypes...> {
// defines resumable traits for functions returning future<void>
struct promise_type {
promise<void> _MyPromise;
future<void> get_return_object() {
return _MyPromise.get_future();
}
suspend_never initial_suspend() const noexcept {
return {};
}
suspend_never final_suspend() const noexcept {
return {};
}
void return_void() {
_MyPromise.set_value();
}
void unhandled_exception() {
_MyPromise.set_exception(_STD current_exception());
}
};
};
template <class _Ty>
struct _Future_awaiter {
future<_Ty>& _Fut;
bool await_ready() const {
return _Fut._Is_ready();
}
void await_suspend(experimental::coroutine_handle<> _ResumeCb) {
// TRANSITION, change to .then if and when future gets .then
thread _WaitingThread([&_Fut = _Fut, _ResumeCb]() mutable {
_Fut.wait();
_ResumeCb();
});
_WaitingThread.detach();
}
decltype(auto) await_resume() {
return _Fut.get();
}
};
} // namespace experimental
// Coroutines TS and C++20 coroutine adapter.
template <class _Ty>
auto operator co_await(future<_Ty>&& _Fut) {
return experimental::_Future_awaiter<_Ty>{_Fut};
}
template <class _Ty>
auto operator co_await(future<_Ty>& _Fut) {
return experimental::_Future_awaiter<_Ty>{_Fut};
}
#endif // _RESUMABLE_FUNCTIONS_SUPPORTED

/await coverage for that support machinery remains in a single test:

RUNALL_INCLUDE ..\prefix.lst
RUNALL_CROSSLIST
PM_CL="/EHsc /MT /std:c++latest /permissive-"
PM_CL="/EHsc /MT /std:c++latest /permissive"
PM_CL="/EHsc /MT /std:c++latest /permissive- /await"
PM_CL="/EHsc /MT /std:c++latest /permissive /await"
PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive- /await"
PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-"

Now that Standard coroutines have been finalized, we know that the experimental support machinery won't be needed for C++20 support, so there's no reason to test it everywhere.

Now this mentions another intentional difference from usual_matrix.lst.
This was skipped by microsoftGH-682 on 2020-04-09. At the time, we were using
VS 2019 16.6 Preview 2 (microsoftGH-645 merged on 2020-03-28). Now we're using
VS 2019 16.8 Preview 1, and I can't reproduce this ICE locally. I ran
x86 and x64, 30 times each, and they all passed. Let's try restoring
this configuration.
@StephanTLavavej StephanTLavavej added the test Related to test code label Aug 19, 2020
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner August 19, 2020 00:49
VSO_0971246_legacy_await_headers provides superior coverage.
@StephanTLavavej StephanTLavavej self-assigned this Aug 21, 2020
@StephanTLavavej StephanTLavavej merged commit 22d061b into microsoft:master Aug 22, 2020
@StephanTLavavej StephanTLavavej deleted the await branch August 22, 2020 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Related to test code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants