diff options
author | Xiaoyi Zhang <zhangxy@google.com> | 2019-11-04 16:43:27 (GMT) |
---|---|---|
committer | Xiaoyi Zhang <zhangxy@google.com> | 2019-11-04 16:43:27 (GMT) |
commit | 8697709e0308af4cd5b09dc108480804e5447cf0 (patch) | |
tree | c28c9fae6cb42e78fdb0750a63fcf8a814966b0d /googletest/include/gtest/gtest-printers.h | |
parent | e8a82dc7ede61c4af3b9d75aa0e953b8cecfc8bb (diff) | |
parent | 6e87238c9b14bcd749364e9b7125622a985a8a20 (diff) | |
download | googletest-8697709e0308af4cd5b09dc108480804e5447cf0.zip googletest-8697709e0308af4cd5b09dc108480804e5447cf0.tar.gz googletest-8697709e0308af4cd5b09dc108480804e5447cf0.tar.bz2 |
Merge pull request #2453 from kuzkry:gtest-port-clean-up_kMaxBiggestInt
PiperOrigin-RevId: 278008286
Diffstat (limited to 'googletest/include/gtest/gtest-printers.h')
-rw-r--r-- | googletest/include/gtest/gtest-printers.h | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 808d319..56a0545 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -133,7 +133,7 @@ GTEST_API_ void PrintBytesInObjectTo(const unsigned char* obj_bytes, // nor PrintTo(). enum TypeKind { kProtobuf, // a protobuf type - kConvertibleToInteger, // a type implicitly convertible to std::intmax_t + kConvertibleToInteger, // a type implicitly convertible to BiggestInt // (e.g. a named or unnamed enum type) #if GTEST_HAS_ABSL kConvertibleToStringView, // a type implicitly convertible to @@ -179,14 +179,14 @@ template <typename T> class TypeWithoutFormatter<T, kConvertibleToInteger> { public: // Since T has no << operator or PrintTo() but can be implicitly - // converted to the maximum width integer, we print it as a std::intmax_t. + // converted to BiggestInt, we print it as a BiggestInt. // // Most likely T is an enum type (either named or unnamed), in which - // case printing it as an integer is the desired behavior. In case + // case printing it as an integer is the desired behavior. In case // T is not an enum, printing it as an integer is the best we can do // given that it has no user-defined printer. static void PrintValue(const T& value, ::std::ostream* os) { - const std::intmax_t kBigInt = value; + const internal::BiggestInt kBigInt = value; *os << kBigInt; } }; @@ -204,10 +204,10 @@ class TypeWithoutFormatter<T, kConvertibleToStringView> { }; #endif -// Prints the given value to the given ostream. If the value is a +// Prints the given value to the given ostream. If the value is a // protocol message, its debug string is printed; if it's an enum or -// of a type implicitly convertible to std::intmax_t, it's printed as an -// integer; otherwise the bytes in the value are printed. This is +// of a type implicitly convertible to BiggestInt, it's printed as an +// integer; otherwise the bytes in the value are printed. This is // what UniversalPrinter<T>::Print() does when it knows nothing about // type T and T has neither << operator nor PrintTo(). // @@ -231,18 +231,19 @@ class TypeWithoutFormatter<T, kConvertibleToStringView> { template <typename Char, typename CharTraits, typename T> ::std::basic_ostream<Char, CharTraits>& operator<<( ::std::basic_ostream<Char, CharTraits>& os, const T& x) { - TypeWithoutFormatter< - T, (internal::IsAProtocolMessage<T>::value - ? kProtobuf - : std::is_convertible<const T&, std::intmax_t>::value - ? kConvertibleToInteger - : + TypeWithoutFormatter<T, (internal::IsAProtocolMessage<T>::value + ? kProtobuf + : std::is_convertible< + const T&, internal::BiggestInt>::value + ? kConvertibleToInteger + : #if GTEST_HAS_ABSL - std::is_convertible<const T&, absl::string_view>::value - ? kConvertibleToStringView - : + std::is_convertible< + const T&, absl::string_view>::value + ? kConvertibleToStringView + : #endif - kOtherType)>::PrintValue(x, &os); + kOtherType)>::PrintValue(x, &os); return os; } |