On Wed, 25 Feb 2026 14:04:40 GMT, SendaoYan <[email protected]> wrote:
> Hi all, > > clang23+gcc12(ubuntu) generate compiler warning > "get_temporary_buffer<testing::TestInfo *>' is deprecated > [-Werror,-Wdeprecated-declarations]". And this compiler warning from > googletest file googletest/src/gtest.cc, googletest/src/gtest.cc invoke > `std::stable_sort`, and `std::stable_sort` invoke deprecated > `std::get_temporary_buffer`. So this warning unrelated JDK totally. > > This PR disable deprecated-declarations warning when building libgtest. > Change has been verified locally. This is a gcc12-specific glibc bug. gcc11.5 does not annotate get_temporary_buffer with the _GLIBCXX17_DEPRECATED attribute. gcc12.2 adds the deprecated attribute to `get_temporary_buffer`. gcc13.2 and later continue to have the deprecated attribute, but also disable that warning around the call down in the guts of `stable_sort`. I wasn't able to reproduce the warning when building with our gcc12.2 devkit. That's because the relevant headers are treated as system headers, so the warning is suppressed. (Verified by turning on `-Wsystem-headers` while building gtest.) So why isn't clang treating the relevant headers as system headers in the configuration where this warning is arising? I don't think an unconditional clang disabling of the warning for the gtest build is an appropriate fix. ------------- PR Comment: https://git.openjdk.org/jdk/pull/29919#issuecomment-3963995547
