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

<iterator>: Modernize and deprecate (un)checked_array_iterator #3818

Merged
merged 10 commits into from Jul 14, 2023

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #943. Fixes #951.

This PR

  • introduces convertibility from (un)checked_array_iterator<T*> to (un)checked_array_iterator<const T*>,
  • deprecates (un)checked_array_iterator and make_(un)checked_array_iterator in C++17 and later modes, while allowing users to define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING to suppress the deprecation,
  • diagnoses (un)checked_array_iterator<void*> and (un)checked_array_iterator<Ret(*)(Args...)> in static_assert,
  • expands iterator_traits<Ptr>::meow typedefs,
  • uses default member initializers for default construction,
  • strengthens exception specification for make_checked_array_iterator, and
  • ensures that (un)checked_array_iterator are contiguous iterators in C++20.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner June 21, 2023 16:55
@github-actions github-actions bot added this to Initial Review in Code Reviews Jun 21, 2023
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jun 21, 2023
Code Reviews automation moved this from Initial Review to Work In Progress Jun 21, 2023
@CaseyCarter CaseyCarter moved this from Work In Progress to Final Review in Code Reviews Jun 22, 2023
@StephanTLavavej StephanTLavavej self-assigned this Jun 23, 2023
@strega-nil-ms strega-nil-ms moved this from Final Review to Ready To Merge in Code Reviews Jun 30, 2023
Copy link
Member

@StephanTLavavej StephanTLavavej left a comment

Choose a reason for hiding this comment

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

Thanks! I'll validate and push changes.

stl/inc/yvals_core.h Outdated Show resolved Hide resolved
"warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory " \
"functions are non-Standard extensions and will be removed in future. std::span (since C++20) and gsl::span " \
"can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or " \
"_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to suppress this warning.")]]
Copy link
Member

Choose a reason for hiding this comment

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

It is debatable whether this should be controlled by the coarse-grained _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS as this is a Microsoft deprecation, not an ISO deprecation. On the other hand, guarding this with _HAS_CXX17 will significantly limit the impact on legacy code (which is good). I suppose I am fine with this; the precedent doesn't even really matter since we are running out of unwise Microsoft extensions to deprecate.

stl/inc/yvals_core.h Outdated Show resolved Hide resolved
stl/inc/iterator Show resolved Hide resolved
stl/inc/iterator Outdated Show resolved Hide resolved
@StephanTLavavej StephanTLavavej removed their assignment Jul 1, 2023
@StephanTLavavej
Copy link
Member

FYI @strega-nil-ms I pushed changes after you approved; probably the most significant being the removal of deprecation on the pointer_traits partial specialization.

@StephanTLavavej StephanTLavavej self-assigned this Jul 13, 2023
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 90dcf26 into microsoft:main Jul 14, 2023
35 checks passed
Code Reviews automation moved this from Ready To Merge to Done Jul 14, 2023
@StephanTLavavej
Copy link
Member

Thanks for enhancing and then discouraging use of this old machinery! 🏚️ 🏡 ✨

@frederick-vs-ja frederick-vs-ja deleted the ext-array-iterators branch July 14, 2023 02:12
@kobykahane
Copy link

This deprecation triggered build errors in cpprestsdk: microsoft/cpprestsdk#1768.

briv added a commit to trice-imaging/vcpkg that referenced this pull request Nov 21, 2023
Due to the msvc compiler change in microsoft/STL#3818,
the aws-sdk-cpp CI build breaks (warnings are treated as errors).

A fix is available upstream when we upgrade our vcpkg ports but to avoid
an immediate upgrade, we'll define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
for now.
briv added a commit to trice-imaging/vcpkg that referenced this pull request Nov 21, 2023
Due to the msvc compiler change in microsoft/STL#3818,
the aws-sdk-cpp CI build breaks (warnings are treated as errors).

A fix is available upstream when we upgrade our vcpkg ports but to avoid
an immediate upgrade, we'll define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
for now.
briv added a commit to trice-imaging/vcpkg that referenced this pull request Nov 21, 2023
Due to the msvc compiler change in microsoft/STL#3818,
the aws-sdk-cpp CI build breaks (warnings are treated as errors).

A fix is available upstream when we upgrade our vcpkg ports but to avoid
an immediate upgrade, we'll define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
for now.
briv added a commit to trice-imaging/vcpkg that referenced this pull request Nov 21, 2023
Due to the msvc compiler change in microsoft/STL#3818,
the aws-sdk-cpp CI build breaks (warnings are treated as errors).

A fix is available upstream when we upgrade our vcpkg ports but to avoid
an immediate upgrade, we'll define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
for now.
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
No open projects
5 participants