aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kruskal <mkruskal@google.com>2023-06-30 18:49:33 -0700
committerCopybara-Service <copybara-worker@google.com>2023-06-30 18:50:27 -0700
commitbe03d00f5f0cc3a997d1a368bee8a1fe93651f48 (patch)
treeabf909f199fbdb9efefb041e6aab638f06d0c6fc
parent1f531be3a19055d1402ec6476c5cab80492d3c68 (diff)
downloadgoogletest-be03d00f5f0cc3a997d1a368bee8a1fe93651f48.zip
googletest-be03d00f5f0cc3a997d1a368bee8a1fe93651f48.tar.gz
googletest-be03d00f5f0cc3a997d1a368bee8a1fe93651f48.tar.bz2
Fix C++20 compatibility bug.
This was shown to work for C++14, C++17, and C++20 after patched into googletest for the protobuf repo's CI. Closes #3659 PiperOrigin-RevId: 544795507 Change-Id: I3e0a94f675e78a6ee9aeccae86c23d940efed8eb
-rw-r--r--googletest/include/gtest/gtest-printers.h6
-rw-r--r--googletest/include/gtest/internal/gtest-port.h2
-rw-r--r--googletest/src/gtest-printers.cc8
3 files changed, 8 insertions, 8 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index 539d99c..9a765fd 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -475,7 +475,7 @@ GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os);
inline void PrintTo(char16_t c, ::std::ostream* os) {
PrintTo(ImplicitCast_<char32_t>(c), os);
}
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
inline void PrintTo(char8_t c, ::std::ostream* os) {
PrintTo(ImplicitCast_<char32_t>(c), os);
}
@@ -588,7 +588,7 @@ inline void PrintTo(const unsigned char* s, ::std::ostream* os) {
inline void PrintTo(unsigned char* s, ::std::ostream* os) {
PrintTo(ImplicitCast_<const void*>(s), os);
}
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
// Overloads for u8 strings.
GTEST_API_ void PrintTo(const char8_t* s, ::std::ostream* os);
inline void PrintTo(char8_t* s, ::std::ostream* os) {
@@ -908,7 +908,7 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
GTEST_API_ void UniversalPrintArray(const char* begin, size_t len,
::std::ostream* os);
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
// This overload prints a (const) char8_t array compactly.
GTEST_API_ void UniversalPrintArray(const char8_t* begin, size_t len,
::std::ostream* os);
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 5221540..26e4cc3 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -1998,7 +1998,7 @@ inline bool IsUpper(char ch) {
inline bool IsXDigit(char ch) {
return isxdigit(static_cast<unsigned char>(ch)) != 0;
}
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
inline bool IsXDigit(char8_t ch) {
return isxdigit(static_cast<unsigned char>(ch)) != 0;
}
diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc
index 2b47067..e3acecb 100644
--- a/googletest/src/gtest-printers.cc
+++ b/googletest/src/gtest-printers.cc
@@ -216,7 +216,7 @@ static const char* GetCharWidthPrefix(signed char) { return ""; }
static const char* GetCharWidthPrefix(unsigned char) { return ""; }
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
static const char* GetCharWidthPrefix(char8_t) { return "u8"; }
#endif
@@ -232,7 +232,7 @@ static CharFormat PrintAsStringLiteralTo(char c, ostream* os) {
return PrintAsStringLiteralTo(ToChar32(c), os);
}
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
static CharFormat PrintAsStringLiteralTo(char8_t c, ostream* os) {
return PrintAsStringLiteralTo(ToChar32(c), os);
}
@@ -395,7 +395,7 @@ void UniversalPrintArray(const char* begin, size_t len, ostream* os) {
UniversalPrintCharArray(begin, len, os);
}
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
// Prints a (const) char8_t array of 'len' elements, starting at address
// 'begin'.
void UniversalPrintArray(const char8_t* begin, size_t len, ostream* os) {
@@ -438,7 +438,7 @@ void PrintCStringTo(const Char* s, ostream* os) {
void PrintTo(const char* s, ostream* os) { PrintCStringTo(s, os); }
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
void PrintTo(const char8_t* s, ostream* os) { PrintCStringTo(s, os); }
#endif