Issue 76515
Summary [Clang] Shows deprecation warnings from system headers, didn't use to
Labels clang
Assignees
Reporter nabijaczleweli
    `Debian clang version 18.0.0 (++20231228112336+9d3fbf97bef3-1~exp1~20231228112400.427)` (from http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm) on bookworm with libstdc++-12-dev:amd64 12.2.0-14:
```
$ make -j25
c++ -g -O3 -pipe -Wall -Wextra -fPIC -fno-math-errno -MD -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Wno-missing-field-initializers -Wno-string-plus-int -fno-common -flto    -DVOREUTILS_LIBSELINUX  -DVOREUTILS_LIBGMP   -Iinclude/ -DVOREUTILS_VERSION='"b41d9cc8"' -DVOREUTILS_DATE='"December 28, 2023"' -DVOREUTILS_SO='".so"' -DVOREUTILS_LIB_PREFIX='"/home/nabijaczleweli/code/voreutils/out/lib/"' -include vore-id.h  -std=c++17 -fno-exceptions -fno-rtti -c -o out/obj/cmd/tsort.o cmd/tsort.cpp
In file included from cmd/tsort.cpp:4:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/algorithm:61:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8: warning: 'get_temporary_buffer<const std::basic_string_view<char> *>' is deprecated [-Wdeprecated-declarations]
  263 | std::get_temporary_buffer<value_type>(_M_original_len));
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:4996:15: note: in instantiation of member function 'std::_Temporary_buffer<__gnu_cxx::__normal_iterator<const std::basic_string_view<char> **, std::vector<const std::basic_string_view<char> *>>, const std::basic_string_view<char> *>::_Temporary_buffer' requested here
 4996 |       _TmpBuf __buf(__first, (__last - __first + 1) / 2);
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:5070:23: note: in instantiation of function template specialization 'std::__stable_sort<__gnu_cxx::__normal_iterator<const std::basic_string_view<char> **, std::vector<const std::basic_string_view<char> *>>, __gnu_cxx::__ops::_Iter_comp_iter<(lambda at cmd/tsort.cpp:79:51)>>' requested here
 5070 | _GLIBCXX_STD_A::__stable_sort(__first, __last,
      | ^
cmd/tsort.cpp:79:7: note: in instantiation of function template specialization 'std::stable_sort<__gnu_cxx::__normal_iterator<const std::basic_string_view<char> **, std::vector<const std::basic_string_view<char> *>>, (lambda at cmd/tsort.cpp:79:51)>' requested here
   79 |         std::stable_sort(std::begin(out), std::end(out), [&](auto lhs, auto rhs) { return tree_cmp(tree, *lhs, *rhs); });
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:99:5: note: 'get_temporary_buffer<const std::basic_string_view<char> *>' has been explicitly marked deprecated here
   99 |     _GLIBCXX17_DEPRECATED
 | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/c++config.h:119:34: note: expanded from macro '_GLIBCXX17_DEPRECATED'
  119 | # define _GLIBCXX17_DEPRECATED [[__deprecated__]]
      | ^
1 warning generated.
```

This is a system header; previous Clang didn't show this warning and nor does GCC.

Minimal reproducer:
```cpp
#include <algorithm>
int main() {
	std::stable_sort((int **)nullptr, (int **)nullptr);
}
```
yields
```
$ c++ repro.cpp
In file included from repro.cpp:1:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/algorithm:61:
In file included from /bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8: warning: 'get_temporary_buffer<int *>' is deprecated [-Wdeprecated-declarations]
  263 | std::get_temporary_buffer<value_type>(_M_original_len));
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:4996:15: note: in instantiation of member function 'std::_Temporary_buffer<int **, int *>::_Temporary_buffer' requested here
 4996 |       _TmpBuf __buf(__first, (__last - __first + 1) / 2);
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:5034:23: note: in instantiation of function template specialization 'std::__stable_sort<int **, __gnu_cxx::__ops::_Iter_less_iter>' requested here
 5034 |       _GLIBCXX_STD_A::__stable_sort(__first, __last,
 |                       ^
repro.cpp:3:7: note: in instantiation of function template specialization 'std::stable_sort<int **>' requested here
    3 |         std::stable_sort((int **)nullptr, (int **)nullptr);
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:99:5: note: 'get_temporary_buffer<int *>' has been explicitly marked deprecated here
   99 |     _GLIBCXX17_DEPRECATED
      | ^
/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/c++config.h:119:34: note: expanded from macro '_GLIBCXX17_DEPRECATED'
  119 | # define _GLIBCXX17_DEPRECATED [[__deprecated__]]
      | ^
1 warning generated.
```

>From the dpkg log (
```
2023-12-06 04:05:50 upgrade clang-18:amd64 1:18~++20231112112638+40671bbdefb6-1~exp1~20231112112751.330 1:18~++20231205112210+b21175258b9a-1~exp1~20231205112231.380
2023-12-28 18:07:13 upgrade clang-18:amd64 1:18~++20231205112210+b21175258b9a-1~exp1~20231205112231.380 1:18~++20231228112336+9d3fbf97bef3-1~exp1~20231228112400.427
```
) I want to say either `1:18~++20231205112210+b21175258b9a-1~exp1~20231205112231.380` or `1:18~++20231112112638+40671bbdefb6-1~exp1~20231112112751.330` were good (didn't show the warning).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to