From acdc51f84fd7d0cca5947047ce07fe2ff164e23a Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Thu, 25 Apr 2024 04:19:40 +0200 Subject: [PATCH] deps: update googletest to 2dd1c13 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/50081 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen --- graal-nodejs/deps/googletest/src/gtest-port.cc | 15 +++++++++++++-- .../maintaining/maintaining-dependencies.md | 6 +++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/graal-nodejs/deps/googletest/src/gtest-port.cc b/graal-nodejs/deps/googletest/src/gtest-port.cc index e9d12d92e7c..3bb7dd45081 100644 --- a/graal-nodejs/deps/googletest/src/gtest-port.cc +++ b/graal-nodejs/deps/googletest/src/gtest-port.cc @@ -697,13 +697,24 @@ bool RE::PartialMatch(const char* str, const RE& re) { void RE::Init(const char* regex) { pattern_ = regex; + // NetBSD (and Android, which takes its regex implemntation from NetBSD) does + // not include the GNU regex extensions (such as Perl style character classes + // like \w) in REG_EXTENDED. REG_EXTENDED is only specified to include the + // [[:alpha:]] style character classes. Enable REG_GNU wherever it is defined + // so users can use those extensions. +#if defined(REG_GNU) + constexpr int reg_flags = REG_EXTENDED | REG_GNU; +#else + constexpr int reg_flags = REG_EXTENDED; +#endif + // Reserves enough bytes to hold the regular expression used for a // full match. const size_t full_regex_len = strlen(regex) + 10; char* const full_pattern = new char[full_regex_len]; snprintf(full_pattern, full_regex_len, "^(%s)$", regex); - is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0; + is_valid_ = regcomp(&full_regex_, full_pattern, reg_flags) == 0; // We want to call regcomp(&partial_regex_, ...) even if the // previous expression returns false. Otherwise partial_regex_ may // not be properly initialized can may cause trouble when it's @@ -714,7 +725,7 @@ void RE::Init(const char* regex) { // regex. We change it to an equivalent form "()" to be safe. if (is_valid_) { const char* const partial_regex = (*regex == '\0') ? "()" : regex; - is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0; + is_valid_ = regcomp(&partial_regex_, partial_regex, reg_flags) == 0; } EXPECT_TRUE(is_valid_) << "Regular expression \"" << regex diff --git a/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md b/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md index 8052956ce83..4cec1dce2c0 100644 --- a/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md +++ b/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md @@ -15,7 +15,7 @@ This a list of all the dependencies: * [c-ares 1.20.1][] * [cjs-module-lexer][] * [corepack][] -* [googletest e47544a][] +* [googletest 2dd1c13][] * [histogram][] * [icu-small][] * [llhttp][] @@ -187,7 +187,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to install them - just like what currently happens with npm, which is shipped by Node.js by default. -### googletest e47544a +### googletest 2dd1c13 The [googletest](https://github.com/google/googletest) dependency is Google’s C++ testing and mocking framework. @@ -319,7 +319,7 @@ performance improvements not currently available in standard zlib. [cjs-module-lexer]: #cjs-module-lexer [corepack]: #corepack [dependency-update-action]: ../../../.github/workflows/tools.yml -[googletest e47544a]: #googletest-e47544a +[googletest 2dd1c13]: #googletest-2dd1c13 [histogram]: #histogram [icu-small]: #icu-small [llhttp]: #llhttp