From 19cf51980e16a0a12641c06f2c4e02b43dee867b Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Thu, 15 May 2025 19:42:10 +0200 Subject: [PATCH 1/2] Fix CI after #138708 Silence a warning in gtest casting a char8_t/char16_t to char32_t. Note that this cast, as well as the behavior of `PrintTo(char32_t)` is incorrect when printing a code unit that does not represent a code point. --- .../unittest/googletest/include/gtest/gtest-printers.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/third-party/unittest/googletest/include/gtest/gtest-printers.h b/third-party/unittest/googletest/include/gtest/gtest-printers.h index d0da9bc1843ce..409b135fc2141 100644 --- a/third-party/unittest/googletest/include/gtest/gtest-printers.h +++ b/third-party/unittest/googletest/include/gtest/gtest-printers.h @@ -510,11 +510,15 @@ GTEST_API_ void PrintTo(wchar_t wc, ::std::ostream* os); GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os); inline void PrintTo(char16_t c, ::std::ostream* os) { - PrintTo(ImplicitCast_(c), os); + // FIXME: the cast from char16_t to char32_t may be incorrect + // for a lone surrogate + PrintTo(static_cast(c), os); } #ifdef __cpp_lib_char8_t inline void PrintTo(char8_t c, ::std::ostream* os) { - PrintTo(ImplicitCast_(c), os); + // FIXME: the cast from char8_t to char32_t may be incorrect + // for c > 0x7F + PrintTo(static_cast(c), os); } #endif From 76aedfc9fcaab5a82963f954287dece329b7cbea Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Thu, 15 May 2025 20:07:03 +0200 Subject: [PATCH 2/2] modify README.LLVM --- third-party/unittest/googletest/README.LLVM | 3 +++ 1 file changed, 3 insertions(+) diff --git a/third-party/unittest/googletest/README.LLVM b/third-party/unittest/googletest/README.LLVM index b574c7f98be41..56715cff9a73d 100644 --- a/third-party/unittest/googletest/README.LLVM +++ b/third-party/unittest/googletest/README.LLVM @@ -19,3 +19,6 @@ Modified as follows: * Added StringRef support to include/gtest/internal/custom/gtest-printers.h. * Added LLVM printable value support to include/gtest/gtest-message.h and include/gtest/gtest-printers.h. +* Modified `PrintTo(char16_t c, ::std::ostream* os)` and + `PrintTo(char16_t c, ::std::ostream* os)` in include/gtest/gtest-printers.h. + to work around https://github.com/google/googletest/issues/4762