On 6/3/24 22:22, Jonathan Wakely wrote:
Pushed to trunk now.
Just a heads-up that this started to cause Clang (at least 18/19) to
emit a -Wdeprecated-declarations now,
$ cat test.cc
#include <algorithm>
void f(int * p1, int * p2) { std::stable_sort(p1, p2); }
$ clang++
--gcc-install-dir=/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0
-fsyntax-only test.cc
In file included from test.cc:1:
In file included from
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/algorithm:61:
In file included from
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/stl_algo.h:69:
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/stl_tempbuf.h:207:11:
warning: 'get_temporary_buffer<int>' is deprecated [-Wdeprecated-declarations]
207 | std::get_temporary_buffer<value_type>(__original_len));
| ^
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/stl_tempbuf.h:323:40:
note: in instantiation of member function
'std::_Temporary_buffer<__gnu_cxx::__normal_iterator<int *, std::vector<int>>,
int>::_Impl::_Impl' requested here
323 | : _M_original_len(__original_len), _M_impl(__original_len)
| ^
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/stl_algo.h:4948:15:
note: in instantiation of member function
'std::_Temporary_buffer<__gnu_cxx::__normal_iterator<int *, std::vector<int>>,
int>::_Temporary_buffer' requested here
4948 | _TmpBuf __buf(__first, (__last - __first + 1) / 2);
| ^
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/stl_algo.h:4993:23:
note: in instantiation of function template specialization
'std::__stable_sort<__gnu_cxx::__normal_iterator<int *, std::vector<int>>,
__gnu_cxx::__ops::_Iter_less_iter>' requested here
4993 | _GLIBCXX_STD_A::__stable_sort(__first, __last,
| ^
test.cc:3:37: note: in instantiation of function template specialization
'std::stable_sort<__gnu_cxx::__normal_iterator<int *, std::vector<int>>>'
requested here
3 | void f(std::vector<int> & v) { std::stable_sort(v.begin(), v.end()); }
| ^
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/bits/stl_tempbuf.h:141:5:
note: 'get_temporary_buffer<int>' has been explicitly marked deprecated here
141 | _GLIBCXX17_DEPRECATED
| ^
/home/sberg/gcc/inst/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-pc-linux-gnu/bits/c++config.h:123:34:
note: expanded from macro '_GLIBCXX17_DEPRECATED'
123 | # define _GLIBCXX17_DEPRECATED [[__deprecated__]]
| ^
1 warning generated.
which could be silenced with
--- a/libstdc++-v3/include/bits/stl_tempbuf.h
+++ b/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -203,8 +203,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit
_Impl(ptrdiff_t __original_len)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
pair<pointer, size_type> __p(
std::get_temporary_buffer<value_type>(__original_len));
+#pragma GCC diagnostic pop
_M_len = __p.second;
_M_buffer = __p.first;
}
(There already is another such pragma diagnostic ignored a bit further
down in that file, so I assume that's the way to go there?)