Skip to content

Conversation

@CaseyCarter
Copy link
Contributor

Restore kernel mode operation by defining unhandled_exception only when _KERNEL_MODE is not defined. (When unhandled_exception is defined, the compiler will wrap the coroutine body in a try...catch as depicted in [dcl.fct.def.coroutine]/5, which it then diagnoses as ill-formed when unwinding is disabled as in /kernel.)

Fixes #1323.

Some cleanup while we're here:

  • Use STL style:
    • Prefer not to deduce simple return types
    • const west
    • introduce template type parameters with class
    • Annotate functions that don't throw exceptions noexcept
    • remove excess empy lines
    • Use _Capital_snake names for non-template-parameters
    • generator::promise_type only has members _Exception and _Rethrow_if_exception to "delay" exception delivery so as to avoid triggering VSO-1172852. They aren't needed in kernel mode.
  • generator::iterator should have explicit conversion from coroutine_handle rather than implicit for good design hygiene. The conversion from nullptr_t is unnecessary.

Note that the story for /EHs- without /kernel is less clear and currently not supported.

Restore kernel mode operation by defining `unhandled_exception` only when `_KERNEL_MODE` is not defined. (When `unhandled_exception` is defined, the compiler will wrap the coroutine body in a `try...catch` as depicted in [dcl.fct.def.coroutine]/5, which it then diagnoses as ill-formed when unwinding is disabled as in `/kernel`.)

Fixes microsoft#1323.

Some cleanup while we're here:
* Use STL style:
  * Prefer not to deduce simple return types
  * `const` west
  * introduce template type parameters with `class`
  * Annotate functions that don't throw exceptions `noexcept`
  * remove excess empy lines
  * Use `_Capital_snake` names for non-template-parameters
  * `generator::promise_type` only has members `_Exception` and `_Rethrow_if_exception` to "delay" exception delivery so as to avoid triggering VSO-1172852. They aren't needed in kernel mode.
* `generator::iterator` should have _explicit_ conversion from `coroutine_handle` rather than implicit for good design hygiene. The conversion from `nullptr_t` is unnecessary.

Note that the story for `/EHs-` without `/kernel` is less clear and currently not supported.
@CaseyCarter CaseyCarter added the bug Something isn't working label Oct 14, 2020
@CaseyCarter CaseyCarter requested a review from a team as a code owner October 14, 2020 15:55
Copy link

@GorNishanov GorNishanov left a comment

Choose a reason for hiding this comment

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

LGTM!

@cbezault cbezault removed their assignment Oct 14, 2020
CaseyCarter and others added 2 commits October 14, 2020 15:26
Co-authored-by: Curtis J Bezault <curtbezault@gmail.com>
@StephanTLavavej StephanTLavavej removed their assignment Oct 15, 2020
@StephanTLavavej StephanTLavavej self-assigned this Oct 17, 2020
@StephanTLavavej StephanTLavavej merged commit 46effab into microsoft:master Oct 17, 2020
@StephanTLavavej
Copy link
Member

Thanks for fixing this regression! I was unable to think of a clever pun involving /kernel and 🍿 here, so you'll have to experiment with generating one yourself. 😹

@CaseyCarter CaseyCarter deleted the generator-cleanup branch October 17, 2020 16:13
@CaseyCarter
Copy link
Contributor Author

It was Colonel 🍿, in the conservatory, with the lead pipe!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working high priority Important!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<experimental/generator>: error C2980 when compiling with /kernel (regression)

5 participants