This is an archive of the discontinued LLVM Phabricator instance.

Remove `auto_ptr` in C++17.
ClosedPublic

Authored by mclow.lists on May 25 2016, 9:28 PM.

Details

Summary

N4190 removed auto_ptr from C++1z. (and other stuff)

Wrap all the auto_ptr bits in an #ifdef so they disappear when compiling with -std=c++1z or later.

Introduce a new configuration option, _LIBCPP_NO_REMOVE_AUTOPTR which allows user code to continue using auto_ptr in C++1z mode if desired.

Add a test for _LIBCPP_NO_REMOVE_AUTOPTR, and mark all the rest of the auto_ptr tests to XFAIL for c++1z

Diff Detail

Event Timeline

mclow.lists retitled this revision from to Remove `auto_ptr` in C++17..
mclow.lists updated this object.
mclow.lists added a reviewer: EricWF.
mclow.lists added a subscriber: cfe-commits.
EricWF edited edge metadata.May 25 2016, 9:38 PM

A couple of comments.

  1. there's probably a better way to state _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_NO_REMOVE_AUTO_PTR). Maybe _LIBCPP_HAS_NO_AUTO_PTR which __config defines if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_NO_REMOVE_AUTO_PTR).
  1. // XFAIL c++1z is eventually going to be a pain to maintain. I'll try and come up with a better way to state this condition in the test suite.

NO_REMOVE seems like a strange way of saying it - is there existing
precedent for that naming/description? (rather than something like
_LIBCPP_PROVIDE_AUTOPTR ?

As for tests - XFAILing seems a bit general when there's really not much
value in running any of the tests anyway. REQUIRES, perhaps? (that does
bring the issue I assume Eric is alluding to forward a bit (I assume what
he's alluding to is that when we have c++2x then we'd have to say XFAIL
c++1z c++2x and so on - switching it around we /already/ have the problem
that we'd want the auto_ptr tests to REQUIRE c++11, c++14 or whatever)) &
maybe having an explicit test or two for the negative case (I would worry
that XFAIL would be too vague "this should fail somehow... "). But maybe
that's all unnecessary paranoia.

  • Dave

FYI I have a LIT change out for review that adds "// REQUIRES-ANY: [...]" which would be subtle for use in this patch.

http://reviews.llvm.org/D20757

EricWF added a comment.Jun 1 2016, 7:07 PM

REQUIRES-ANY landed in r271468.

EricWF added inline comments.Jan 4 2017, 10:25 PM
include/memory
1962

I would love to have a semi-consistent naming scheme for macros which re-enable removed C++17 features. Maybe _LIBCPP_ENABLE_REMOVED_CXX17_FOO? I'l apply whatever naming scheme we decide on to the changes in D28172

2019

Comment on the #endif?

test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
21

Please add // MODULES_DEFINES: _LIBCPP_NO_REMOVE_AUTOPTR

test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp
16

Please use REQUIRES: c++98, c++03, c++11, c++14 instead of XFAIL: c++1z for two reasons:

  1. The former is future proof to new standard dialects whereas the latter is not.
  2. XFAIL should only be used on tests that fail due to a bug or missing compiler feature, not for tests which we expect to fail for well defined reasons.

there's probably a better way to state _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_NO_REMOVE_AUTO_PTR).

There probably is; but remember, we want to make it so someone can -D_LIBCPP_NO_REMOVE_AUTO_PTR on the command-line and get this back.

I would love to have a semi-consistent naming scheme for macros which re-enable removed C++17 features. Maybe _LIBCPP_ENABLE_REMOVED_CXX17_FOO

I like this: I'm using _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR now.

test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
27

D'oh! auto_ptr

Updated the macro name.
Use REQUIRES-ALL
Found a couple more tests that needed to be updated.
Fixed the libcxx/test bit.

mclow.lists marked 3 inline comments as done.Jan 16 2017, 2:02 PM
mclow.lists accepted this revision.Feb 13 2017, 1:07 PM

Landed as r292986

This revision is now accepted and ready to land.Feb 13 2017, 1:07 PM
mclow.lists closed this revision.Mar 23 2017, 11:02 PM