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

<generator>: Various fixes and cleanups #4471

Merged

Conversation

StephanTLavavej
Copy link
Member

@StephanTLavavej StephanTLavavej commented Mar 12, 2024

My apologies for the grab-bag PR (slightly excusable for a feature branch).

This starts with trivial followups to #4464, then addresses pre-existing issues that I found:

  • std:: => _STD
  • Include <cstddef> for std::nullptr_t.
  • Extract a verbose immediately-invoked lambda for clarity.
  • Bugfix: Use __stdcall to make <generator> immune to default calling conventions.
    • We must always do this when mentioning function pointer types in headers.
  • Scalar constexpr size_t _Align doesn't need to be static.
  • Fix unintentional move from const _Alloc&.
    • This is now consistent with the other occurrence of auto& _Stored_al.
  • Consistently use _RANGES.
  • _Promise => _CoroPromise to avoid intolerable shadowing of <future>.
    • I clearly missed this in the shipping <coroutine>. We conventionally never allow template parameters to shadow other machinery like this:

      STL/stl/inc/future

      Lines 1001 to 1002 in d6efe94

      template <class _Ty>
      class _Promise {
  • throw; => _RERAISE;
    • We never directly try/catch/throw in headers. Using the macros respects _HAS_EXCEPTIONS=0.
  • Overhaul generator's static_asserts.
    • Add Standard citations.
    • "generator's second argument" was bogus; use "generator's selected reference type" to describe italic-monospace-reference. Then say "an actual reference type" for clarity.
    • "an iterator with [...] cannot model indirectly_readable" was confusing because it was describing a bad situation, but the other messages are describing how situations must be good. Rephrase this for clarity.
  • Mark _Dealloc_fn as _NOEXCEPT_FNPTR.
    • This is important because the compiler can't see through function pointers.
  • Use static member functions instead of lambdas to make Clang happy.
    • Clang -fno-ms-compatibility refuses to convert stateless lambdas to __stdcall function pointers, which I suppose is a defensible choice.

This is now consistent with the other occurrence of `auto& _Stored_al`.
Add Standard citations.

"generator's second argument" was bogus; use "generator's selected reference type" to describe italic-monospace-reference. Then say "an actual reference type" for clarity.

"an iterator with \[...\] cannot model indirectly_readable" was confusing because it was describing a bad situation, but the other messages are describing how situations must be good. Rephrase this for clarity.
@StephanTLavavej StephanTLavavej added bug Something isn't working generator C++23 generator labels Mar 12, 2024
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner March 12, 2024 12:48
…s instead of lambdas to make Clang happy.
@StephanTLavavej StephanTLavavej merged commit 14bbb8e into microsoft:feature/generator Mar 13, 2024
35 checks passed
@StephanTLavavej StephanTLavavej deleted the generator-cleanups branch March 13, 2024 07:42
yronglin added a commit to yronglin/STL that referenced this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working generator C++23 generator
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants