Skip to content

Commit dbfa70a

Browse files
deps: update googletest to 8eff9e336692fc95961e096564f1044c600b881d
PR-URL: #66009 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent fa10566 commit dbfa70a

5 files changed

Lines changed: 43 additions & 307 deletions

File tree

‎deps/googletest/include/gtest/gtest-death-test.h‎

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -105,54 +105,10 @@ GTEST_API_ bool InDeathTestChild();
105105
//
106106
// On the regular expressions used in death tests:
107107
//
108-
// On POSIX-compliant systems (*nix), we use the <regex.h> library,
109-
// which uses the POSIX extended regex syntax.
110-
//
111-
// On other platforms (e.g. Windows or Mac), we only support a simple regex
112-
// syntax implemented as part of Google Test. This limited
113-
// implementation should be enough most of the time when writing
114-
// death tests; though it lacks many features you can find in PCRE
115-
// or POSIX extended regex syntax. For example, we don't support
116-
// union ("x|y"), grouping ("(xy)"), brackets ("[xy]"), and
117-
// repetition count ("x{5,7}"), among others.
118-
//
119-
// Below is the syntax that we do support. We chose it to be a
120-
// subset of both PCRE and POSIX extended regex, so it's easy to
121-
// learn wherever you come from. In the following: 'A' denotes a
122-
// literal character, period (.), or a single \\ escape sequence;
123-
// 'x' and 'y' denote regular expressions; 'm' and 'n' are for
124-
// natural numbers.
125-
//
126-
// c matches any literal character c
127-
// \\d matches any decimal digit
128-
// \\D matches any character that's not a decimal digit
129-
// \\f matches \f
130-
// \\n matches \n
131-
// \\r matches \r
132-
// \\s matches any ASCII whitespace, including \n
133-
// \\S matches any character that's not a whitespace
134-
// \\t matches \t
135-
// \\v matches \v
136-
// \\w matches any letter, _, or decimal digit
137-
// \\W matches any character that \\w doesn't match
138-
// \\c matches any literal character c, which must be a punctuation
139-
// . matches any single character except \n
140-
// A? matches 0 or 1 occurrences of A
141-
// A* matches 0 or many occurrences of A
142-
// A+ matches 1 or many occurrences of A
143-
// ^ matches the beginning of a string (not that of each line)
144-
// $ matches the end of a string (not that of each line)
145-
// xy matches x followed by y
146-
//
147-
// If you accidentally use PCRE or POSIX extended regex features
148-
// not implemented by us, you will get a run-time failure. In that
149-
// case, please try to rewrite your regular expression within the
150-
// above syntax.
151-
//
152-
// This implementation is *not* meant to be as highly tuned or robust
153-
// as a compiled regex library, but should perform well enough for a
154-
// death test, which already incurs significant overhead by launching
155-
// a child process.
108+
// Depending on the platform, this may use RE2, the POSIX <regex.h> library,
109+
// the C++11 standard library's <regex> engine with ECMAScript syntax, or
110+
// another similar engine. Regular expressions should be simple and portable
111+
// enough to work across the engines of interest.
156112
//
157113
// Known caveats:
158114
//

‎deps/googletest/include/gtest/internal/gtest-port.h‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with
177177
// GTEST_HAS_POSIX_RE (see above) which users can
178178
// define themselves.
179-
// GTEST_USES_SIMPLE_RE - our own simple regex is used;
179+
// GTEST_USES_STD_RE - std::regex from the C++ standard library is used;
180180
// the above RE\b(s) are mutually exclusive.
181181
// GTEST_HAS_ABSL - Google Test is compiled with Abseil.
182182

@@ -438,8 +438,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
438438
#include <regex.h> // NOLINT
439439
#define GTEST_USES_POSIX_RE 1
440440
#else
441-
// Use our own simple regex implementation.
442-
#define GTEST_USES_SIMPLE_RE 1
441+
// Use std::regex from the C++ standard library.
442+
#include <regex> // NOLINT
443+
#define GTEST_USES_STD_RE 1
443444
#endif
444445

445446
#ifndef GTEST_HAS_EXCEPTIONS
@@ -992,12 +993,11 @@ class GTEST_API_ [[nodiscard]] RE {
992993
RE2 regex_;
993994
};
994995

995-
#elif defined(GTEST_USES_POSIX_RE) || defined(GTEST_USES_SIMPLE_RE)
996+
#elif defined(GTEST_USES_POSIX_RE) || defined(GTEST_USES_STD_RE)
996997
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
997998
/* class A needs to have dll-interface to be used by clients of class B */)
998999

999-
// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
1000-
// Regular Expression syntax.
1000+
// A simple C++ wrapper for <regex.h> or <regex>.
10011001
class GTEST_API_ [[nodiscard]] RE {
10021002
public:
10031003
// A copy constructor is required by the Standard to initialize object
@@ -1037,9 +1037,9 @@ class GTEST_API_ [[nodiscard]] RE {
10371037
regex_t full_regex_; // For FullMatch().
10381038
regex_t partial_regex_; // For PartialMatch().
10391039

1040-
#else // GTEST_USES_SIMPLE_RE
1040+
#else // GTEST_USES_STD_RE
10411041

1042-
std::string full_pattern_; // For FullMatch();
1042+
std::regex regex_;
10431043

10441044
#endif
10451045
};
@@ -1755,14 +1755,16 @@ class [[nodiscard]] MutexBase {
17551755
#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
17561756
extern ::testing::internal::MutexBase mutex
17571757

1758+
#if defined(PTHREAD_NULL)
1759+
#define GTEST_INTERNAL_PTHREAD_NULL PTHREAD_NULL
1760+
#else
1761+
#define GTEST_INTERNAL_PTHREAD_NULL (pthread_t{})
1762+
#endif
1763+
17581764
// Defines and statically (i.e. at link time) initializes a static mutex.
1759-
// The initialization list here does not explicitly initialize each field,
1760-
// instead relying on default initialization for the unspecified fields. In
1761-
// particular, the owner_ field (a pthread_t) is not explicitly initialized.
1762-
// This allows initialization to work whether pthread_t is a scalar or struct.
1763-
// The flag -Wmissing-field-initializers must not be specified for this to work.
1764-
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1765-
::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
1765+
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
1766+
::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, \
1767+
GTEST_INTERNAL_PTHREAD_NULL}
17661768

17671769
// The Mutex class can only be used for mutexes created at runtime. It
17681770
// shares its API with MutexBase otherwise.

‎deps/googletest/src/gtest-internal-inl.h‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -980,26 +980,7 @@ inline UnitTestImpl* GetUnitTestImpl() {
980980
return UnitTest::GetInstance()->impl();
981981
}
982982

983-
#ifdef GTEST_USES_SIMPLE_RE
984-
985-
// Internal helper functions for implementing the simple regular
986-
// expression matcher.
987-
GTEST_API_ bool IsInSet(char ch, const char* str);
988-
GTEST_API_ bool IsAsciiDigit(char ch);
989-
GTEST_API_ bool IsAsciiPunct(char ch);
990-
GTEST_API_ bool IsRepeat(char ch);
991-
GTEST_API_ bool IsAsciiWhiteSpace(char ch);
992-
GTEST_API_ bool IsAsciiWordChar(char ch);
993-
GTEST_API_ bool IsValidEscape(char ch);
994-
GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
995-
GTEST_API_ bool ValidateRegex(const char* regex);
996-
GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
997-
GTEST_API_ bool MatchRepetitionAndRegexAtHead(bool escaped, char ch,
998-
char repeat, const char* regex,
999-
const char* str);
1000-
GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
1001-
1002-
#endif // GTEST_USES_SIMPLE_RE
983+
1003984

1004985
// Parses the command line for Google Test flags, without initializing
1005986
// other parts of Google Test.

0 commit comments

Comments
 (0)