Skip to content

Commit

Permalink
Fix gtest when using C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
Rombur committed Aug 2, 2023
1 parent 23870b3 commit f193f90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions tpls/gtest/gtest/gtest-all.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11957,7 +11957,7 @@ static const char* GetCharWidthPrefix(unsigned char) {
return "";
}

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
static const char* GetCharWidthPrefix(char8_t) {
return "u8";
}
Expand All @@ -11981,7 +11981,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);
}
Expand Down Expand Up @@ -12103,7 +12103,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) {
Expand Down Expand Up @@ -12146,7 +12146,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

Expand Down Expand Up @@ -12240,7 +12240,7 @@ void PrintStringTo(const ::std::string& s, ostream* os) {
}
}

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
void PrintU8StringTo(const ::std::u8string& s, ostream* os) {
PrintCharsAsStringTo(s.data(), s.size(), os);
}
Expand Down
16 changes: 8 additions & 8 deletions tpls/gtest/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,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;
}
Expand Down Expand Up @@ -5417,7 +5417,7 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char8_t);
GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char8_t);
#endif
Expand All @@ -5442,7 +5442,7 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char32_t);

GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char8_t, ::std::u8string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char8_t, ::std::u8string);
#endif
Expand Down Expand Up @@ -5530,7 +5530,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);
}
Expand All @@ -5556,7 +5556,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) {
Expand Down Expand Up @@ -5608,7 +5608,7 @@ inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
}

// Overloads for ::std::u8string
#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
GTEST_API_ void PrintU8StringTo(const ::std::u8string& s, ::std::ostream* os);
inline void PrintTo(const ::std::u8string& s, ::std::ostream* os) {
PrintU8StringTo(s, os);
Expand Down Expand Up @@ -5862,7 +5862,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);
Expand Down Expand Up @@ -5951,7 +5951,7 @@ template <>
class UniversalTersePrinter<char*> : public UniversalTersePrinter<const char*> {
};

#ifdef __cpp_char8_t
#ifdef __cpp_lib_char8_t
template <>
class UniversalTersePrinter<const char8_t*> {
public:
Expand Down

0 comments on commit f193f90

Please sign in to comment.