This is an archive of the discontinued LLVM Phabricator instance.

Remove `std::random_shuffle` in C++17
ClosedPublic

Authored by mclow.lists on Feb 16 2017, 7:13 AM.

Details

Reviewers
EricWF
Summary

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190 removed random_shuffle from C++1z. (and other stuff)

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

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

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

Diff Detail

Event Timeline

mclow.lists created this revision.Feb 16 2017, 7:13 AM
EricWF accepted this revision.Feb 16 2017, 7:20 PM

LGTM after fixing inline comments.

include/algorithm
3029

We should still expose these when building the library using || defined(_LIBCPP_BUILDING_LIBRARY).

test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp
11

REQUIRES-ANY got removed. This should be written:

// REQUIRES: c++98 || c++03 || c++11 || c++14
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle_rand.pass.cpp
11

REQUIRES-ANY got removed. This should be written:

// REQUIRES: c++98 || c++03 || c++11 || c++14
This revision is now accepted and ready to land.Feb 16 2017, 7:20 PM

@mclow.lists A couple of additional things:

  • Add _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE to the _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES list in __config.
  • Add a test for that in test/libcxx/depr/enable_removed_cpp17_features.pass.cpp
include/algorithm
3029

This is specifically needed in this case because the definitions for symbols exist in the dylib and must be declared when compiling it.

mclow.lists closed this revision.Mar 23 2017, 11:01 PM

Committed as revision 298597