TEST_P overrides TestBody() with public visibility instead
of private as defined in the Test base class
PiperOrigin-RevId: 981828756
Change-Id: I9ad0852642520b6b8585df15c3e63885f6fbd135
Static (linker-initialized) global mutex has a
pthread_t member, which is currently initialized
with 0. This is incorrect, since pthread_t is
an opaque type, which can be a struct in some
libc implementations (e.g. in LLVM-libc). Using
POSIX-specified PTHREAD_NULL is a better option,
however it may not be available on older platforms.
So, use PTHREAD_NULL if it's available, but
fallback to the original behavior for compatibility.
PiperOrigin-RevId: 979239391
Change-Id: I79a292868f85f62bb1962b3ac956ad40eb145907
Previously, non-Abseil builds of GoogleTest used either the POSIX <regex.h> header, or a hand-rolled bare-bones regex engine in GoogleTest.
This commit removes the custom regex engine and switches to the C++11 <regex> header instead, which primarily affects Windows builds. Correspondingly, the GTEST_USES_SIMPLE_RE macro is removed and GTEST_USES_STD_RE is defined in its place, so users that depend on the macro should update their code accordingly.
This commit may break on any exotic toolchains or platforms that lack all of these libraries, but these have been long unsupported, as GoogleTest requires C++17.
Note: MSVC's engine can be prone to overflowing the stack on some patterns and inputs. As a trivial example:
#include <regex>
int main() {
std::string corpus;
for (size_t i = 0; i < 1000; ++i) {
corpus += "a\n";
}
// Stack overflow
std::regex_match(corpus, std::regex("(\n|.)*", std::regex_constants::ECMAScript));
}
In such cases, it is recommended to use alternative patterns accomplishing the same goal, such as checking for pieces of a pattern independently.
PiperOrigin-RevId: 978659894
Change-Id: I4594285e696af12a008e1e4cee300f292bbdbf32
Compilers before this do not support C++17 at all, which is required by GoogleTest.
PiperOrigin-RevId: 975312508
Change-Id: I77a0649a11ea9162010a8a26807e4a970610616f
Classic IBM XL C/C++ (__IBMCPP__) only supported up to C++14 (V16.1 for AIX) before IBM retired the proprietary frontend and transitioned to IBM Open XL C/C++ (which is Clang-based and defines __clang__).
Since the legacy XL frontend never supported C++17, the workarounds are obsolete and should be removed.
PiperOrigin-RevId: 975123206
Change-Id: Ia706c7759d3f1df73d375fca68f91eee3aaef825
Classic Borland C++ (bcc32) only supported up to C++98/C++03 before Embarcadero transitioned C++Builder to Clang-based compilers (bcc32c/bcc64, which define __clang__) and is long obsolete.
PiperOrigin-RevId: 974883761
Change-Id: I220f736485710f37fe4a2b922bda3116304e3812
Oracle Developer Studio 12.6 (released July 2017) was the final release of the SunPro/Solaris Studio compiler suite, providing only partial/experimental support for C++14 before Oracle discontinued active compiler development. Sun Studio never supported C++17.
Additionally, Solaris 8 and 9 reached EOL over a decade ago. Therefore, workarounds for non-standard putenv/getenv memory behavior in legacy Solaris libc are obsolete, and should be removed.
PiperOrigin-RevId: 974866696
Change-Id: I29db7a1123642c7db0975522c641bd0500a40682
HP aC++ for HP-UX on Itanium (A.06.28) only supported up to C++03 and partial C++11 before HPE placed HP-UX and Itanium into maintenance mode. It was discontinued without ever supporting C++14 or C++17.
As GoogleTest requires C++17, the HP-specific workarounds are obsolete and should be removed.
PiperOrigin-RevId: 974700202
Change-Id: Iff9a41101f90f65d76394752bf197b8f2e97311f
- having this flag causes emscripten to generate binary with pthread
support, which is not compatible with browsers that do not support
pthreads or with web pages that do not enable pthread support
Define `GTEST_HAS_NATIVE_WCHAR` as a replacement for the `!defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)` condition used to remove `wchar_t*` overloads when `wchar_t` is a typedef. Remove `GMOCK_WCHAR_T_IS_NATIVE_` and migrate its uses to the GTest define.
PiperOrigin-RevId: 966022317
Change-Id: Ic929f45763566b9e8d194f280d1f32f5a582ff61
If the standard library claims not to support wide character strings, disable `GTEST_HAS_STD_WSTRING` and disallow users overriding it. If the standard library implementation can't be recognized, fall back to using the existing list of OSes with a known lack of support.
PiperOrigin-RevId: 964237076
Change-Id: I906f296259f8f17099990d51447a0d0d04dead66
If the standard library doesn't support wide character strings, `std::char_traits<Char>` won't be defined, so the definition of `PrintTo` shouldn't reference it. Use `wstrlen` directly instead.
PiperOrigin-RevId: 964168903
Change-Id: Ic628e6583679073b47bb1218dcf52b4c9eadaaf6
Android started supporting std::wstring with API Level 21 (Lollipop). On Android, unless `GTEST_HAS_STD_WSTRING` is explicitly defined, set it based on the current Android API level.
PiperOrigin-RevId: 963538624
Change-Id: I1a19c4e5b0fef841e0650a1f95b45fa3439dee92
This reapplies the change that was rolled back, with the change that it removes the convertibility requirement to string_view, because that excluded some desirable explicit conversions (like absl::Cord). Note that this is now the same criterion previously used by testing::internal::StringLike.
Fixes: #4912
PiperOrigin-RevId: 959205696
Change-Id: I002cb1224f5a2701bdf8e68ea4d91776b9c38593
Add a configurable `GTEST_HAS_WCHAR` option to control whether to provide `wchar_t*` overloads for `PrintTo`. Check implementation-specific standard library defines to determine proper defaults for `GTEST_HAS_WCHAR` and `GTEST_HAS_STD_WSTRING` and to produce compile errors if the users pick a configuration that depends on unavailable standard library features.
PiperOrigin-RevId: 958668507
Change-Id: Ic9b78d83fb455dff7d993303d54a0bde749a8cd8
Add a configurable `GTEST_HAS_WCHAR` option to control whether to provide `wchar_t*` overloads for `PrintTo`. Check implementation-specific standard library defines to determine proper defaults for `GTEST_HAS_WCHAR` and `GTEST_HAS_STD_WSTRING` and to produce compile errors if the users pick a configuration that depends on unavailable standard library features.
PiperOrigin-RevId: 958595883
Change-Id: I5ff25b395e4cbdab679effa7e760d64c31ac6572
PrintTo(char8_t) and PrintTo(char16_t) widened their argument to char32_t
and printed it with the U+XXXX notation. That notation names a code point,
but char8_t and char16_t hold code units, so it is wrong for every value
that does not encode a code point on its own: any non-ASCII char8_t (always
part of a multi-unit UTF-8 sequence) and the UTF-16 surrogates D800-DFFF.
For example, PrintTo(char8_t(0x80)) printed "U+0080", the code point of a
character that value cannot represent.
Print those values as code units instead, using the same escape-plus-code
form already used for char, unsigned char and wchar_t: char8_t(0x80) now
prints as u8'\x80' (128) and char16_t(0xD800) as u'\xD800' (55296). Values
that do encode a code point keep the U+XXXX notation.
Fixes#4762