This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] deprecates/removes `std::raw_storage_iterator`
ClosedPublic

Authored by cjdb on May 2 2021, 1:45 PM.

Details

Summary

C++17 deprecates std::raw_storage_iterator and C++20 removes it.

Implements part of:

  • P0174R2 'Deprecating Vestigial Library Parts in C++17'
  • P0619R4 'Reviewing Deprecated Facilities of C++17 for C++20'

Diff Detail

Event Timeline

cjdb requested review of this revision.May 2 2021, 1:45 PM
cjdb created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2021, 1:45 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

LGTM % comments.

libcxx/include/__memory/raw_storage_iterator.h
28

Insert a blank line between lines 28 and 29. (Or, remove line 55; but I think for a chunk of code this long, "insert" is the right answer.)

libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
10

REQUIRES: c++17

18–29

I don't even think you use struct A?
Replace these 12 lines with one line:

std::raw_storage_iterator<int*, int> it; // expected-warning {{deprecated}}
libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp
13–14
#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
cjdb updated this revision to Diff 342295.May 2 2021, 5:37 PM
cjdb marked 2 inline comments as done.

applies @Quuxplusone feedback

cjdb marked 2 inline comments as done.May 2 2021, 5:37 PM
cjdb added inline comments.
libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
10

Thanks. Is there a way to say REQUIRES: <less-than-std>? It'd be sucky if we needed to add c++2c, c++2d, ....

Looks like you need to git grep -i p0619 libcxx/ and update at least one of those comments.
Also git grep -i p0174, although maybe nothing needs changing there? I'm assuming this doesn't finish p0174. (But you should check and see.)

libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
10

IIUC, you're asking about this syntax, which is indeed supported.

// REQUIRES: c++03 || c++11 || c++14

Look at the auto_ptr tests for some examples of that.

libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
9

// REQUIRES: c++03 || c++11 || c++14 || c++17

ldionne accepted this revision.May 5 2021, 10:41 AM

We should also amend the <memory> synopsis with // deprecated in C++17, removed in C++20.

LGTM with my and Arthur's suggestions.

Note that if that were a more widely used type, I'd request that we add an escape hatch for users to get the type back in C++20. I hate those, but sometimes they are a necessity if we want to be able to ship the library to users. In this case I think it won't be necessary.

libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp
16

This include is not needed.

This revision is now accepted and ready to land.May 5 2021, 10:41 AM
cjdb updated this revision to Diff 344216.May 10 2021, 3:18 PM
cjdb marked 4 inline comments as done.

applies all of @Quuxplusone's feedback

cjdb added a comment.May 10 2021, 3:18 PM

Feedback addressed.

This revision was automatically updated to reflect the committed changes.