<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/76515>76515</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Shows deprecation warnings from system headers, didn't use to
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nabijaczleweli
      </td>
    </tr>
</table>

<pre>
    `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).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWduO3CgTfhrmpuSWDe3TxVz0MWppsokyvZvcWdjGNgkG_4DnsBd59l_YfZz0bDbZJLuR0hp121BA1VcfRdVAjeG1ZOwahXMULq9obxulryXN-Xta_CnYPRP8Klfl4zWK_CXLOZVQCCpruGPacCUhSCb-xAeEE4TnCM-xj0mAcRIEmJAI4Xlakiqv0jhnFfGCj-yhCz6eCE19fzLFMcIpioZpKq1aaKztEJkhvEZ4TTs7EeKunShdI7zOlfpwr3SL8Bpcs2eVEkVDufSOXSkoCftXuOe2AcFzY8tiVNMLsFeyO0RmtC2jKQR4gie-F0zdqv4S-TMU-bu_8RVPoaUfGHjvcTg27aYCrwbvFQGv4x0D7y0VAry37MFqCl71erMAr5LKa6ltPKa1VOC9XIK3zNabm1X2ar2-XW2z-WZ7i8gymrqO7ebl6rTlrRvOjeGy9irOROlxyS2ngv_JtBn7jdWuuxO98bi045qFalslwauEVQAA3vKPV29Wv283N7fZzWZ-u7rZ_Pb7u0_aX7x87YQ3XBaiL5kD-lTij9Wb282r3xBZIuc4nE-DMi2KBGGMcHwmupxtVwe5JStYmzMNjisLcCS4MOT21WHAxKgLAjebefb6zWq9eXcQRHjdqNYpek5dhNeFGgy4U5r1lguD8Fr1FuG14PlAr3H-nang5DxeThoAz9gSkeXOy0E8QsoeCtZZrqQZ37W1HLwCPAXjvCp_75ZtS4TX1ihtJwpO34quG-mzkVBxwWC3dAkD85-KktmRkpdHuC3BJcLryeRgVl0UCK8fkiiLpp7gsn_watkjvA7wXvDJ19HXO4P3wlTUSnPbtIjMouDf1SXn1jnQWJE5tSbNuU4_bnXL2i7vq0EBHBFEZgkiM7inWnJZu0eE45rZQVBpqh-zvK8qphFZFEoaCwO5ZojMcmp4kY3bN7vj7N6JNFQjsgKEZ4isHEG5gZJ1mhXUshJQOPfeHt-9khWCajrQEoXLEQ0AHBFA8eK41j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