diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-07-26 14:05:58 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-03-18 13:50:45 +0000 |
commit | bfa7e7dfc19e07bff319636cf1bdfd57b6c68f41 (patch) | |
tree | 7db7c14b1ba52a3cc41b3729b83304156255fcbc /libstdc++-v3/include | |
parent | 9f381ebb7211c1359f5de87760148096fcba3357 (diff) | |
download | gcc-bfa7e7dfc19e07bff319636cf1bdfd57b6c68f41.zip gcc-bfa7e7dfc19e07bff319636cf1bdfd57b6c68f41.tar.gz gcc-bfa7e7dfc19e07bff319636cf1bdfd57b6c68f41.tar.bz2 |
libstdc++: Add deprecated attribute to std::random_shuffle declarations
We already have these attributes on the definitions in <bits/stl_algo.h>
but they don't work due to PR c++/84542. Add the attributes to the
declarations in <bits/algorithmfwd.h> as well, and add a test.
libstdc++-v3/ChangeLog:
* include/bits/algorithmfwd.h (random_shuffle): Add deprecated
attribute.
* include/bits/stl_algo.h (random_shuffle): Correct comments.
* testsuite/25_algorithms/random_shuffle/1.cc: Disable
deprecated warnings.
* testsuite/25_algorithms/random_shuffle/59603.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/moveable.cc: Likewise.
* testsuite/25_algorithms/random_shuffle/deprecated.cc: New
test.
(cherry picked from commit c01b344e814001e07fd304ce98d013d811e90192)
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/bits/algorithmfwd.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_algo.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h index 5271a90..5b85b0b 100644 --- a/libstdc++-v3/include/bits/algorithmfwd.h +++ b/libstdc++-v3/include/bits/algorithmfwd.h @@ -828,10 +828,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO partition(_BIter, _BIter, _Predicate); template<typename _RAIter> + _GLIBCXX14_DEPRECATED_SUGGEST("std::shuffle") void random_shuffle(_RAIter, _RAIter); template<typename _RAIter, typename _Generator> + _GLIBCXX14_DEPRECATED_SUGGEST("std::shuffle") void random_shuffle(_RAIter, _RAIter, #if __cplusplus >= 201103L diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 1f07b9e..41a8cf2 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -4532,7 +4532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO * equally likely. * * @deprecated - * Since C++14 `std::random_shuffle` is not part of the C++ standard. + * Since C++17, `std::random_shuffle` is not part of the C++ standard. * Use `std::shuffle` instead, which was introduced in C++11. */ template<typename _RandomAccessIterator> @@ -4572,7 +4572,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO * range [0,N). * * @deprecated - * Since C++14 `std::random_shuffle` is not part of the C++ standard. + * Since C++17, `std::random_shuffle` is not part of the C++ standard. * Use `std::shuffle` instead, which was introduced in C++11. */ template<typename _RandomAccessIterator, typename _RandomNumberGenerator> |