From ab31507a8b683083d687c3e16adc5b4f4dac2776 Mon Sep 17 00:00:00 2001 From: Christian Trott Date: Thu, 26 Jan 2023 17:46:22 -0700 Subject: [PATCH] Add patch file for gtest so it works with HIP compiler in C++20 mode See report here: https://github.com/google/googletest/issues/3659 --- scripts/snl/gtest-hip-patch | 102 ++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 scripts/snl/gtest-hip-patch diff --git a/scripts/snl/gtest-hip-patch b/scripts/snl/gtest-hip-patch new file mode 100644 index 00000000..7fe5644b --- /dev/null +++ b/scripts/snl/gtest-hip-patch @@ -0,0 +1,102 @@ +diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h +index 7d7e77c1..025ed642 100644 +--- a/googletest/include/gtest/gtest-printers.h ++++ b/googletest/include/gtest/gtest-printers.h +@@ -473,7 +473,7 @@ GTEST_API_ void PrintTo(char32_t c, ::std::ostream* os); + inline void PrintTo(char16_t c, ::std::ostream* os) { + PrintTo(ImplicitCast_(c), os); + } +-#ifdef __cpp_char8_t ++#ifdef __cpp_lib_char8_t + inline void PrintTo(char8_t c, ::std::ostream* os) { + PrintTo(ImplicitCast_(c), os); + } +@@ -586,7 +586,7 @@ inline void PrintTo(const unsigned char* s, ::std::ostream* os) { + inline void PrintTo(unsigned char* s, ::std::ostream* os) { + PrintTo(ImplicitCast_(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) { +@@ -906,7 +906,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); +@@ -1002,7 +1002,7 @@ template <> + class UniversalTersePrinter : public UniversalTersePrinter { + }; + +-#ifdef __cpp_char8_t ++#ifdef __cpp_lib_char8_t + template <> + class UniversalTersePrinter { + public: +diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h +index b4fa3f07..594a038c 100644 +--- a/googletest/include/gtest/internal/gtest-port.h ++++ b/googletest/include/gtest/internal/gtest-port.h +@@ -1939,7 +1939,7 @@ inline bool IsUpper(char ch) { + inline bool IsXDigit(char ch) { + return isxdigit(static_cast(ch)) != 0; + } +-#ifdef __cpp_char8_t ++#ifdef __cpp_lib_char8_t + inline bool IsXDigit(char8_t ch) { + return isxdigit(static_cast(ch)) != 0; + } +diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc +index d475ad36..7ccd181d 100644 +--- a/googletest/src/gtest-printers.cc ++++ b/googletest/src/gtest-printers.cc +@@ -214,7 +214,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 + +@@ -230,7 +230,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); + } +@@ -393,7 +393,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) { +@@ -436,7 +436,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 + +@@ -528,7 +528,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); + }