aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/re2
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-06-02 23:59:48 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-06-03 00:11:57 +0300
commit933f6cbf4f95da7762f11e135c0f5c357e6e95e4 (patch)
tree7f9ad14f21d9efce738d5f5aa255af0dc983e164 /contrib/libs/re2
parentb1fd17a0e5fc98b32b49324f04e99e5318609e47 (diff)
downloadydb-933f6cbf4f95da7762f11e135c0f5c357e6e95e4.tar.gz
Update contrib/libs/re2 to 2024-06-01
8d72a1e5220ffe0bb7a82257f422606184202ad0
Diffstat (limited to 'contrib/libs/re2')
-rw-r--r--contrib/libs/re2/include/util/logging.h1
-rw-r--r--contrib/libs/re2/re2/bitmap256.cc8
-rw-r--r--contrib/libs/re2/re2/bitmap256.h20
-rw-r--r--contrib/libs/re2/re2/bitstate.cc15
-rw-r--r--contrib/libs/re2/re2/compile.cc25
-rw-r--r--contrib/libs/re2/re2/dfa.cc48
-rw-r--r--contrib/libs/re2/re2/filtered_re2.cc13
-rw-r--r--contrib/libs/re2/re2/mimics_pcre.cc6
-rw-r--r--contrib/libs/re2/re2/nfa.cc38
-rw-r--r--contrib/libs/re2/re2/onepass.cc32
-rw-r--r--contrib/libs/re2/re2/parse.cc27
-rw-r--r--contrib/libs/re2/re2/prefilter.cc28
-rw-r--r--contrib/libs/re2/re2/prefilter.h5
-rw-r--r--contrib/libs/re2/re2/prefilter_tree.cc36
-rw-r--r--contrib/libs/re2/re2/prefilter_tree.h9
-rw-r--r--contrib/libs/re2/re2/prog.cc70
-rw-r--r--contrib/libs/re2/re2/prog.h58
-rw-r--r--contrib/libs/re2/re2/re2.cc107
-rw-r--r--contrib/libs/re2/re2/re2.h50
-rw-r--r--contrib/libs/re2/re2/regexp.cc24
-rw-r--r--contrib/libs/re2/re2/regexp.h51
-rw-r--r--contrib/libs/re2/re2/set.cc25
-rw-r--r--contrib/libs/re2/re2/simplify.cc22
-rw-r--r--contrib/libs/re2/re2/sparse_array.h16
-rw-r--r--contrib/libs/re2/re2/sparse_set.h16
-rw-r--r--contrib/libs/re2/re2/testing/backtrack.cc14
-rw-r--r--contrib/libs/re2/re2/testing/charclass_test.cc2
-rw-r--r--contrib/libs/re2/re2/testing/compile_test.cc17
-rw-r--r--contrib/libs/re2/re2/testing/dfa_test.cc27
-rw-r--r--contrib/libs/re2/re2/testing/dump.cc9
-rw-r--r--contrib/libs/re2/re2/testing/exhaustive_tester.cc19
-rw-r--r--contrib/libs/re2/re2/testing/exhaustive_tester.h1
-rw-r--r--contrib/libs/re2/re2/testing/filtered_re2_test.cc23
-rw-r--r--contrib/libs/re2/re2/testing/mimics_pcre_test.cc3
-rw-r--r--contrib/libs/re2/re2/testing/null_walker.cc5
-rw-r--r--contrib/libs/re2/re2/testing/parse_test.cc6
-rw-r--r--contrib/libs/re2/re2/testing/possible_match_test.cc15
-rw-r--r--contrib/libs/re2/re2/testing/re2_arg_test.cc9
-rw-r--r--contrib/libs/re2/re2/testing/re2_test.cc22
-rw-r--r--contrib/libs/re2/re2/testing/regexp_generator.cc18
-rw-r--r--contrib/libs/re2/re2/testing/regexp_generator.h1
-rw-r--r--contrib/libs/re2/re2/testing/regexp_test.cc5
-rw-r--r--contrib/libs/re2/re2/testing/required_prefix_test.cc3
-rw-r--r--contrib/libs/re2/re2/testing/search_test.cc9
-rw-r--r--contrib/libs/re2/re2/testing/set_test.cc8
-rw-r--r--contrib/libs/re2/re2/testing/simplify_test.cc5
-rw-r--r--contrib/libs/re2/re2/testing/string_generator.cc19
-rw-r--r--contrib/libs/re2/re2/testing/string_generator.h1
-rw-r--r--contrib/libs/re2/re2/testing/string_generator_test.cc8
-rw-r--r--contrib/libs/re2/re2/testing/tester.cc86
-rw-r--r--contrib/libs/re2/re2/testing/tester.h2
-rw-r--r--contrib/libs/re2/re2/testing/ya.make1
-rw-r--r--contrib/libs/re2/re2/tostring.cc9
-rw-r--r--contrib/libs/re2/re2/walker-inl.h7
-rw-r--r--contrib/libs/re2/util/logging.h109
-rw-r--r--contrib/libs/re2/util/pcre.cc5
-rw-r--r--contrib/libs/re2/util/pcre.h32
-rw-r--r--contrib/libs/re2/ya.make7
58 files changed, 654 insertions, 603 deletions
diff --git a/contrib/libs/re2/include/util/logging.h b/contrib/libs/re2/include/util/logging.h
deleted file mode 100644
index 6b83bd42dd..0000000000
--- a/contrib/libs/re2/include/util/logging.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../util/logging.h" /* inclink generated by yamaker */
diff --git a/contrib/libs/re2/re2/bitmap256.cc b/contrib/libs/re2/re2/bitmap256.cc
index f6fbca3048..4b9eee4302 100644
--- a/contrib/libs/re2/re2/bitmap256.cc
+++ b/contrib/libs/re2/re2/bitmap256.cc
@@ -6,14 +6,14 @@
#include <stdint.h>
-#include "absl/base/macros.h"
-#include "util/logging.h"
+#include "absl/base/attributes.h"
+#include "absl/log/absl_check.h"
namespace re2 {
int Bitmap256::FindNextSetBit(int c) const {
- DCHECK_GE(c, 0);
- DCHECK_LE(c, 255);
+ ABSL_DCHECK_GE(c, 0);
+ ABSL_DCHECK_LE(c, 255);
// Check the word that contains the bit. Mask out any lower bits.
int i = c / 64;
diff --git a/contrib/libs/re2/re2/bitmap256.h b/contrib/libs/re2/re2/bitmap256.h
index 293b31d85f..e16a570a51 100644
--- a/contrib/libs/re2/re2/bitmap256.h
+++ b/contrib/libs/re2/re2/bitmap256.h
@@ -5,13 +5,15 @@
#ifndef RE2_BITMAP256_H_
#define RE2_BITMAP256_H_
-#ifdef _MSC_VER
-#include <intrin.h>
-#endif
#include <stdint.h>
#include <string.h>
-#include "util/logging.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
namespace re2 {
@@ -28,16 +30,16 @@ class Bitmap256 {
// Tests the bit with index c.
bool Test(int c) const {
- DCHECK_GE(c, 0);
- DCHECK_LE(c, 255);
+ ABSL_DCHECK_GE(c, 0);
+ ABSL_DCHECK_LE(c, 255);
return (words_[c / 64] & (uint64_t{1} << (c % 64))) != 0;
}
// Sets the bit with index c.
void Set(int c) {
- DCHECK_GE(c, 0);
- DCHECK_LE(c, 255);
+ ABSL_DCHECK_GE(c, 0);
+ ABSL_DCHECK_LE(c, 255);
words_[c / 64] |= (uint64_t{1} << (c % 64));
}
@@ -49,7 +51,7 @@ class Bitmap256 {
private:
// Finds the least significant non-zero bit in n.
static int FindLSBSet(uint64_t n) {
- DCHECK_NE(n, 0);
+ ABSL_DCHECK_NE(n, 0);
#if defined(__GNUC__)
return __builtin_ctzll(n);
#elif defined(_MSC_VER) && defined(_M_X64)
diff --git a/contrib/libs/re2/re2/bitstate.cc b/contrib/libs/re2/re2/bitstate.cc
index 38a0b87ccb..71f41c3838 100644
--- a/contrib/libs/re2/re2/bitstate.cc
+++ b/contrib/libs/re2/re2/bitstate.cc
@@ -20,10 +20,13 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+
#include <limits>
#include <utility>
-#include "util/logging.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/regexp.h"
@@ -107,9 +110,9 @@ void BitState::Push(int id, const char* p) {
if (njob_ >= job_.size()) {
GrowStack();
if (njob_ >= job_.size()) {
- LOG(DFATAL) << "GrowStack() failed: "
- << "njob_ = " << njob_ << ", "
- << "job_.size() = " << job_.size();
+ ABSL_LOG(DFATAL) << "GrowStack() failed: "
+ << "njob_ = " << njob_ << ", "
+ << "job_.size() = " << job_.size();
return;
}
}
@@ -167,7 +170,7 @@ bool BitState::TrySearch(int id0, const char* p0) {
Prog::Inst* ip = prog_->inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "Unexpected opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "Unexpected opcode: " << ip->opcode();
return false;
case kInstFail:
@@ -233,7 +236,7 @@ bool BitState::TrySearch(int id0, const char* p0) {
CheckAndLoop:
// Sanity check: id is the head of its list, which must
// be the case if id-1 is the last of *its* list. :)
- DCHECK(id == 0 || prog_->inst(id-1)->last());
+ ABSL_DCHECK(id == 0 || prog_->inst(id-1)->last());
if (ShouldVisit(id, p))
goto Loop;
break;
diff --git a/contrib/libs/re2/re2/compile.cc b/contrib/libs/re2/re2/compile.cc
index aa798872e4..95c1b32ddf 100644
--- a/contrib/libs/re2/re2/compile.cc
+++ b/contrib/libs/re2/re2/compile.cc
@@ -10,17 +10,20 @@
#include <stdint.h>
#include <string.h>
+
+#include <string>
#include <utility>
-#include "absl/base/macros.h"
#include "absl/container/flat_hash_map.h"
-#include "util/logging.h"
-#include "util/utf.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/regexp.h"
#include "re2/walker-inl.h"
+#include "util/utf.h"
namespace re2 {
@@ -522,8 +525,8 @@ void Compiler::AddSuffix(int id) {
}
int Compiler::AddSuffixRecursive(int root, int id) {
- DCHECK(inst_[root].opcode() == kInstAlt ||
- inst_[root].opcode() == kInstByteRange);
+ ABSL_DCHECK(inst_[root].opcode() == kInstAlt ||
+ inst_[root].opcode() == kInstByteRange);
Frag f = FindByteRange(root, id);
if (IsNoMatch(f)) {
@@ -565,7 +568,7 @@ int Compiler::AddSuffixRecursive(int root, int id) {
if (!IsCachedRuneByteSuffix(id)) {
// The head should be the instruction most recently allocated, so free it
// instead of leaving it unreachable.
- DCHECK_EQ(id, ninst_-1);
+ ABSL_DCHECK_EQ(id, ninst_-1);
inst_[id].out_opcode_ = 0;
inst_[id].out1_ = 0;
ninst_--;
@@ -613,7 +616,7 @@ Frag Compiler::FindByteRange(int root, int id) {
return NoMatch();
}
- LOG(DFATAL) << "should never happen";
+ ABSL_LOG(DFATAL) << "should never happen";
return NoMatch();
}
@@ -738,7 +741,7 @@ void Compiler::AddRuneRangeUTF8(Rune lo, Rune hi, bool foldcase) {
int n = runetochar(reinterpret_cast<char*>(ulo), &lo);
int m = runetochar(reinterpret_cast<char*>(uhi), &hi);
(void)m; // USED(m)
- DCHECK_EQ(n, m);
+ ABSL_DCHECK_EQ(n, m);
// The logic below encodes this thinking:
//
@@ -791,7 +794,7 @@ void Compiler::AddRuneRangeUTF8(Rune lo, Rune hi, bool foldcase) {
Frag Compiler::Copy(Frag arg) {
// We're using WalkExponential; there should be no copying.
failed_ = true;
- LOG(DFATAL) << "Compiler::Copy called!";
+ ABSL_LOG(DFATAL) << "Compiler::Copy called!";
return NoMatch();
}
@@ -918,7 +921,7 @@ Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
if (cc->empty()) {
// This can't happen.
failed_ = true;
- LOG(DFATAL) << "No ranges in char class";
+ ABSL_LOG(DFATAL) << "No ranges in char class";
return NoMatch();
}
@@ -976,7 +979,7 @@ Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
return EmptyWidth(kEmptyNonWordBoundary);
}
failed_ = true;
- LOG(DFATAL) << "Missing case in Compiler: " << re->op();
+ ABSL_LOG(DFATAL) << "Missing case in Compiler: " << re->op();
return NoMatch();
}
diff --git a/contrib/libs/re2/re2/dfa.cc b/contrib/libs/re2/re2/dfa.cc
index e35fcb2819..1619614ea6 100644
--- a/contrib/libs/re2/re2/dfa.cc
+++ b/contrib/libs/re2/re2/dfa.cc
@@ -25,28 +25,32 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
+
#include <algorithm>
#include <atomic>
#include <deque>
-#include <new>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
+#include "absl/base/attributes.h"
#include "absl/base/call_once.h"
-#include "absl/base/macros.h"
#include "absl/base/thread_annotations.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
+#include "absl/hash/hash.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
+#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
#include "absl/types/span.h"
-#include "util/logging.h"
-#include "util/strutil.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/sparse_set.h"
+#include "util/strutil.h"
// Silence "zero-sized array in struct/union" warning for DFA::State::next_.
#ifdef _MSC_VER
@@ -149,15 +153,15 @@ class DFA {
struct StateHash {
size_t operator()(const State* a) const {
- DCHECK(a != NULL);
+ ABSL_DCHECK(a != NULL);
return absl::Hash<State>()(*a);
}
};
struct StateEqual {
bool operator()(const State* a, const State* b) const {
- DCHECK(a != NULL);
- DCHECK(b != NULL);
+ ABSL_DCHECK(a != NULL);
+ ABSL_DCHECK(b != NULL);
return *a == *b;
}
};
@@ -659,7 +663,7 @@ DFA::State* DFA::WorkqToCachedState(Workq* q, Workq* mq, uint32_t flag) {
break;
}
}
- DCHECK_LE(n, q->size());
+ ABSL_DCHECK_LE(n, q->size());
if (n > 0 && inst[n-1] == Mark)
n--;
@@ -847,7 +851,7 @@ void DFA::AddToQueue(Workq* q, int id, uint32_t flag) {
stk[nstk++] = id;
while (nstk > 0) {
- DCHECK_LE(nstk, stack_.size());
+ ABSL_DCHECK_LE(nstk, stack_.size());
id = stk[--nstk];
Loop:
@@ -872,7 +876,7 @@ void DFA::AddToQueue(Workq* q, int id, uint32_t flag) {
Prog::Inst* ip = prog_->inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
break;
case kInstByteRange: // just save these on the queue
@@ -898,7 +902,7 @@ void DFA::AddToQueue(Workq* q, int id, uint32_t flag) {
goto Loop;
case kInstAltMatch:
- DCHECK(!ip->last());
+ ABSL_DCHECK(!ip->last());
id = id+1;
goto Loop;
@@ -961,7 +965,7 @@ void DFA::RunWorkqOnByte(Workq* oldq, Workq* newq,
Prog::Inst* ip = prog_->inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
break;
case kInstFail: // never succeeds
@@ -1029,14 +1033,14 @@ DFA::State* DFA::RunStateOnByte(State* state, int c) {
return FullMatchState;
}
if (state == DeadState) {
- LOG(DFATAL) << "DeadState in RunStateOnByte";
+ ABSL_LOG(DFATAL) << "DeadState in RunStateOnByte";
return NULL;
}
if (state == NULL) {
- LOG(DFATAL) << "NULL state in RunStateOnByte";
+ ABSL_LOG(DFATAL) << "NULL state in RunStateOnByte";
return NULL;
}
- LOG(DFATAL) << "Unexpected special state in RunStateOnByte";
+ ABSL_LOG(DFATAL) << "Unexpected special state in RunStateOnByte";
return NULL;
}
@@ -1267,7 +1271,7 @@ DFA::State* DFA::StateSaver::Restore() {
absl::MutexLock l(&dfa_->mutex_);
State* s = dfa_->CachedState(inst_, ninst_, flag_);
if (s == NULL)
- LOG(DFATAL) << "StateSaver failed to restore state.";
+ ABSL_LOG(DFATAL) << "StateSaver failed to restore state.";
return s;
}
@@ -1451,13 +1455,13 @@ inline bool DFA::InlinedSearchLoop(SearchParams* params) {
// Restore start and s so we can continue.
if ((start = save_start.Restore()) == NULL ||
(s = save_s.Restore()) == NULL) {
- // Restore already did LOG(DFATAL).
+ // Restore already did ABSL_LOG(DFATAL).
params->failed = true;
return false;
}
ns = RunStateOnByteUnlocked(s, c);
if (ns == NULL) {
- LOG(DFATAL) << "RunStateOnByteUnlocked failed after ResetCache";
+ ABSL_LOG(DFATAL) << "RunStateOnByteUnlocked failed after ResetCache";
params->failed = true;
return false;
}
@@ -1529,7 +1533,7 @@ inline bool DFA::InlinedSearchLoop(SearchParams* params) {
}
ns = RunStateOnByteUnlocked(s, lastbyte);
if (ns == NULL) {
- LOG(DFATAL) << "RunStateOnByteUnlocked failed after Reset";
+ ABSL_LOG(DFATAL) << "RunStateOnByteUnlocked failed after Reset";
params->failed = true;
return false;
}
@@ -1646,7 +1650,7 @@ bool DFA::AnalyzeSearch(SearchParams* params) {
// Sanity check: make sure that text lies within context.
if (BeginPtr(text) < BeginPtr(context) || EndPtr(text) > EndPtr(context)) {
- LOG(DFATAL) << "context does not contain text";
+ ABSL_LOG(DFATAL) << "context does not contain text";
params->start = DeadState;
return true;
}
@@ -1694,7 +1698,7 @@ bool DFA::AnalyzeSearch(SearchParams* params) {
ResetCache(params->cache_lock);
if (!AnalyzeSearchHelper(params, info, flags)) {
params->failed = true;
- LOG(DFATAL) << "Failed to analyze start state.";
+ ABSL_LOG(DFATAL) << "Failed to analyze start state.";
return false;
}
}
@@ -1768,7 +1772,7 @@ bool DFA::Search(absl::string_view text, absl::string_view context,
params.want_earliest_match = want_earliest_match;
params.run_forward = run_forward;
// matches should be null except when using RE2::Set.
- DCHECK(matches == NULL || kind_ == Prog::kManyMatch);
+ ABSL_DCHECK(matches == NULL || kind_ == Prog::kManyMatch);
params.matches = matches;
if (!AnalyzeSearch(&params)) {
diff --git a/contrib/libs/re2/re2/filtered_re2.cc b/contrib/libs/re2/re2/filtered_re2.cc
index 1ce26a38e0..f0995a10b3 100644
--- a/contrib/libs/re2/re2/filtered_re2.cc
+++ b/contrib/libs/re2/re2/filtered_re2.cc
@@ -5,10 +5,13 @@
#include "re2/filtered_re2.h"
#include <stddef.h>
+
#include <string>
#include <utility>
+#include <vector>
-#include "util/logging.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "re2/prefilter.h"
#include "re2/prefilter_tree.h"
@@ -52,8 +55,8 @@ RE2::ErrorCode FilteredRE2::Add(absl::string_view pattern,
if (!re->ok()) {
if (options.log_errors()) {
- LOG(ERROR) << "Couldn't compile regular expression, skipping: "
- << pattern << " due to error " << re->error();
+ ABSL_LOG(ERROR) << "Couldn't compile regular expression, skipping: "
+ << pattern << " due to error " << re->error();
}
delete re;
} else {
@@ -66,7 +69,7 @@ RE2::ErrorCode FilteredRE2::Add(absl::string_view pattern,
void FilteredRE2::Compile(std::vector<std::string>* atoms) {
if (compiled_) {
- LOG(ERROR) << "Compile called already.";
+ ABSL_LOG(ERROR) << "Compile called already.";
return;
}
@@ -95,7 +98,7 @@ int FilteredRE2::SlowFirstMatch(absl::string_view text) const {
int FilteredRE2::FirstMatch(absl::string_view text,
const std::vector<int>& atoms) const {
if (!compiled_) {
- LOG(DFATAL) << "FirstMatch called before Compile.";
+ ABSL_LOG(DFATAL) << "FirstMatch called before Compile.";
return -1;
}
std::vector<int> regexps;
diff --git a/contrib/libs/re2/re2/mimics_pcre.cc b/contrib/libs/re2/re2/mimics_pcre.cc
index ac0c69d7e7..1724063667 100644
--- a/contrib/libs/re2/re2/mimics_pcre.cc
+++ b/contrib/libs/re2/re2/mimics_pcre.cc
@@ -22,7 +22,7 @@
//
// Regexp::MimicsPCRE checks for any of these conditions.
-#include "util/logging.h"
+#include "absl/log/absl_log.h"
#include "re2/regexp.h"
#include "re2/walker-inl.h"
@@ -44,7 +44,7 @@ class PCREWalker : public Regexp::Walker<bool> {
virtual bool ShortVisit(Regexp* re, bool a) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "PCREWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "PCREWalker::ShortVisit called";
#endif
return a;
}
@@ -128,7 +128,7 @@ class EmptyStringWalker : public Regexp::Walker<bool> {
virtual bool ShortVisit(Regexp* re, bool a) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "EmptyStringWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "EmptyStringWalker::ShortVisit called";
#endif
return a;
}
diff --git a/contrib/libs/re2/re2/nfa.cc b/contrib/libs/re2/re2/nfa.cc
index a655884d70..a35976f250 100644
--- a/contrib/libs/re2/re2/nfa.cc
+++ b/contrib/libs/re2/re2/nfa.cc
@@ -26,14 +26,16 @@
#include <stdio.h>
#include <string.h>
+
#include <algorithm>
#include <deque>
#include <string>
#include <utility>
-#include <vector>
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/regexp.h"
@@ -172,17 +174,17 @@ NFA::Thread* NFA::AllocThread() {
}
NFA::Thread* NFA::Incref(Thread* t) {
- DCHECK(t != NULL);
+ ABSL_DCHECK(t != NULL);
t->ref++;
return t;
}
void NFA::Decref(Thread* t) {
- DCHECK(t != NULL);
+ ABSL_DCHECK(t != NULL);
t->ref--;
if (t->ref > 0)
return;
- DCHECK_EQ(t->ref, 0);
+ ABSL_DCHECK_EQ(t->ref, 0);
t->next = freelist_;
freelist_ = t;
}
@@ -208,7 +210,7 @@ void NFA::AddToThreadq(Threadq* q, int id0, int c, absl::string_view context,
stk[nstk++] = {id0, NULL};
while (nstk > 0) {
- DCHECK_LE(nstk, stack_.size());
+ ABSL_DCHECK_LE(nstk, stack_.size());
AddState a = stk[--nstk];
Loop:
@@ -238,7 +240,7 @@ void NFA::AddToThreadq(Threadq* q, int id0, int c, absl::string_view context,
Prog::Inst* ip = prog_->inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled " << ip->opcode() << " in AddToThreadq";
+ ABSL_LOG(DFATAL) << "unhandled " << ip->opcode() << " in AddToThreadq";
break;
case kInstFail:
@@ -249,7 +251,7 @@ void NFA::AddToThreadq(Threadq* q, int id0, int c, absl::string_view context,
t = Incref(t0);
*tp = t;
- DCHECK(!ip->last());
+ ABSL_DCHECK(!ip->last());
a = {id+1, NULL};
goto Loop;
@@ -350,7 +352,7 @@ int NFA::Step(Threadq* runq, Threadq* nextq, int c, absl::string_view context,
switch (ip->opcode()) {
default:
// Should only see the values handled below.
- LOG(DFATAL) << "Unhandled " << ip->opcode() << " in step";
+ ABSL_LOG(DFATAL) << "Unhandled " << ip->opcode() << " in step";
break;
case kInstByteRange:
@@ -455,7 +457,7 @@ bool NFA::Search(absl::string_view text, absl::string_view context,
// Sanity check: make sure that text lies within context.
if (BeginPtr(text) < BeginPtr(context) || EndPtr(text) > EndPtr(context)) {
- LOG(DFATAL) << "context does not contain text";
+ ABSL_LOG(DFATAL) << "context does not contain text";
return false;
}
@@ -470,7 +472,7 @@ bool NFA::Search(absl::string_view text, absl::string_view context,
}
if (nsubmatch < 0) {
- LOG(DFATAL) << "Bad args: nsubmatch=" << nsubmatch;
+ ABSL_LOG(DFATAL) << "Bad args: nsubmatch=" << nsubmatch;
return false;
}
@@ -527,7 +529,7 @@ bool NFA::Search(absl::string_view text, absl::string_view context,
// This is a no-op the first time around the loop because runq is empty.
int id = Step(runq, nextq, p < etext_ ? p[0] & 0xFF : -1, context, p);
- DCHECK_EQ(runq->size(), 0);
+ ABSL_DCHECK_EQ(runq->size(), 0);
using std::swap;
swap(nextq, runq);
nextq->clear();
@@ -538,7 +540,8 @@ bool NFA::Search(absl::string_view text, absl::string_view context,
Prog::Inst* ip = prog_->inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "Unexpected opcode in short circuit: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "Unexpected opcode in short circuit: "
+ << ip->opcode();
break;
case kInstCapture:
@@ -599,7 +602,7 @@ bool NFA::Search(absl::string_view text, absl::string_view context,
// This complements the special case in NFA::Step().
if (p == NULL) {
(void) Step(runq, nextq, -1, context, p);
- DCHECK_EQ(runq->size(), 0);
+ ABSL_DCHECK_EQ(runq->size(), 0);
using std::swap;
swap(nextq, runq);
nextq->clear();
@@ -655,7 +658,7 @@ bool Prog::SearchNFA(absl::string_view text, absl::string_view context,
// fanout holds the results and is also the work queue for the outer iteration.
// reachable holds the reached nodes for the inner iteration.
void Prog::Fanout(SparseArray<int>* fanout) {
- DCHECK_EQ(fanout->max_size(), size());
+ ABSL_DCHECK_EQ(fanout->max_size(), size());
SparseSet reachable(size());
fanout->clear();
fanout->set_new(start(), 0);
@@ -668,7 +671,8 @@ void Prog::Fanout(SparseArray<int>* fanout) {
Prog::Inst* ip = inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled " << ip->opcode() << " in Prog::Fanout()";
+ ABSL_LOG(DFATAL) << "unhandled " << ip->opcode()
+ << " in Prog::Fanout()";
break;
case kInstByteRange:
@@ -682,7 +686,7 @@ void Prog::Fanout(SparseArray<int>* fanout) {
break;
case kInstAltMatch:
- DCHECK(!ip->last());
+ ABSL_DCHECK(!ip->last());
reachable.insert(id+1);
break;
diff --git a/contrib/libs/re2/re2/onepass.cc b/contrib/libs/re2/re2/onepass.cc
index 7931cf911e..fb7f69431c 100644
--- a/contrib/libs/re2/re2/onepass.cc
+++ b/contrib/libs/re2/re2/onepass.cc
@@ -52,19 +52,21 @@
#include <stdint.h>
#include <string.h>
+
#include <algorithm>
#include <map>
#include <string>
-#include <vector>
#include "absl/container/fixed_array.h"
#include "absl/container/inlined_vector.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
-#include "util/utf.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/sparse_set.h"
+#include "util/utf.h"
// Silence "zero-sized array in struct/union" warning for OneState::action.
#ifdef _MSC_VER
@@ -215,7 +217,7 @@ bool Prog::SearchOnePass(absl::string_view text, absl::string_view context,
Anchor anchor, MatchKind kind,
absl::string_view* match, int nmatch) {
if (anchor != kAnchored && kind != kFullMatch) {
- LOG(DFATAL) << "Cannot use SearchOnePass for unanchored matches.";
+ ABSL_LOG(DFATAL) << "Cannot use SearchOnePass for unanchored matches.";
return false;
}
@@ -442,13 +444,13 @@ bool Prog::IsOnePass() {
Prog::Inst* ip = inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
break;
case kInstAltMatch:
// TODO(rsc): Ignoring kInstAltMatch optimization.
// Should implement it in this engine, but it's subtle.
- DCHECK(!ip->last());
+ ABSL_DCHECK(!ip->last());
// If already on work queue, (1) is violated: bail out.
if (!AddQ(&workq, id+1))
goto fail;
@@ -460,7 +462,7 @@ bool Prog::IsOnePass() {
if (nextindex == -1) {
if (nalloc >= maxnodes) {
if (ExtraDebug)
- LOG(ERROR) << absl::StrFormat(
+ ABSL_LOG(ERROR) << absl::StrFormat(
"Not OnePass: hit node limit %d >= %d", nalloc, maxnodes);
goto fail;
}
@@ -485,7 +487,7 @@ bool Prog::IsOnePass() {
node->action[b] = newact;
} else if (act != newact) {
if (ExtraDebug)
- LOG(ERROR) << absl::StrFormat(
+ ABSL_LOG(ERROR) << absl::StrFormat(
"Not OnePass: conflict on byte %#x at state %d", c, *it);
goto fail;
}
@@ -506,7 +508,7 @@ bool Prog::IsOnePass() {
node->action[b] = newact;
} else if (act != newact) {
if (ExtraDebug)
- LOG(ERROR) << absl::StrFormat(
+ ABSL_LOG(ERROR) << absl::StrFormat(
"Not OnePass: conflict on byte %#x at state %d", c, *it);
goto fail;
}
@@ -547,7 +549,7 @@ bool Prog::IsOnePass() {
// If already on work queue, (1) is violated: bail out.
if (!AddQ(&workq, ip->out())) {
if (ExtraDebug)
- LOG(ERROR) << absl::StrFormat(
+ ABSL_LOG(ERROR) << absl::StrFormat(
"Not OnePass: multiple paths %d -> %d", *it, ip->out());
goto fail;
}
@@ -558,7 +560,7 @@ bool Prog::IsOnePass() {
if (matched) {
// (3) is violated
if (ExtraDebug)
- LOG(ERROR) << absl::StrFormat(
+ ABSL_LOG(ERROR) << absl::StrFormat(
"Not OnePass: multiple matches from %d", *it);
goto fail;
}
@@ -579,9 +581,9 @@ bool Prog::IsOnePass() {
}
}
- if (ExtraDebug) { // For debugging, dump one-pass NFA to LOG(ERROR).
- LOG(ERROR) << "bytemap:\n" << DumpByteMap();
- LOG(ERROR) << "prog:\n" << Dump();
+ if (ExtraDebug) { // For debugging, dump one-pass NFA to ABSL_LOG(ERROR).
+ ABSL_LOG(ERROR) << "bytemap:\n" << DumpByteMap();
+ ABSL_LOG(ERROR) << "prog:\n" << Dump();
std::map<int, int> idmap;
for (int i = 0; i < size; i++)
@@ -606,7 +608,7 @@ bool Prog::IsOnePass() {
idmap[node->action[i] >> kIndexShift]);
}
}
- LOG(ERROR) << "nodes:\n" << dump;
+ ABSL_LOG(ERROR) << "nodes:\n" << dump;
}
dfa_mem_ -= nalloc*statesize;
diff --git a/contrib/libs/re2/re2/parse.cc b/contrib/libs/re2/re2/parse.cc
index a3e580f6db..a48842c3ac 100644
--- a/contrib/libs/re2/re2/parse.cc
+++ b/contrib/libs/re2/re2/parse.cc
@@ -16,24 +16,25 @@
// and recognizes the Perl escape sequences \d, \s, \w, \D, \S, and \W.
// See regexp.h for rationale.
-#include <ctype.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+
#include <algorithm>
-#include <map>
#include <string>
#include <vector>
+#include "absl/base/attributes.h"
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
-#include "util/logging.h"
-#include "util/utf.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/regexp.h"
#include "re2/unicode_casefold.h"
#include "re2/unicode_groups.h"
#include "re2/walker-inl.h"
+#include "util/utf.h"
#if defined(RE2_USE_ICU)
#error #include "unicode/uniset.h"
@@ -360,7 +361,7 @@ static void AddFoldedRange(CharClassBuilder* cc, Rune lo, Rune hi, int depth) {
// current Unicode tables. make_unicode_casefold.py checks that
// the cycles are not too long, and we double-check here using depth.
if (depth > 10) {
- LOG(DFATAL) << "AddFoldedRange recurses too much.";
+ ABSL_LOG(DFATAL) << "AddFoldedRange recurses too much.";
return;
}
@@ -579,7 +580,7 @@ int RepetitionWalker::PostVisit(Regexp* re, int parent_arg, int pre_arg,
int RepetitionWalker::ShortVisit(Regexp* re, int parent_arg) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "RepetitionWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "RepetitionWalker::ShortVisit called";
#endif
return 0;
}
@@ -867,7 +868,7 @@ void Regexp::RemoveLeadingString(Regexp* re, int n) {
case 0:
case 1:
// Impossible.
- LOG(DFATAL) << "Concat of " << re->nsub();
+ ABSL_LOG(DFATAL) << "Concat of " << re->nsub();
re->submany_ = NULL;
re->op_ = kRegexpEmptyMatch;
break;
@@ -997,7 +998,7 @@ int Regexp::FactorAlternation(Regexp** sub, int nsub, ParseFlags flags) {
i += iter->nsub;
break;
default:
- LOG(DFATAL) << "unknown round: " << round;
+ ABSL_LOG(DFATAL) << "unknown round: " << round;
break;
}
// If we are done, copy until the end of sub.
@@ -1036,7 +1037,7 @@ int Regexp::FactorAlternation(Regexp** sub, int nsub, ParseFlags flags) {
continue;
}
default:
- LOG(DFATAL) << "unknown round: " << round;
+ ABSL_LOG(DFATAL) << "unknown round: " << round;
break;
}
@@ -1213,8 +1214,8 @@ void FactorAlternationImpl::Round3(Regexp** sub, int nsub,
ccb.AddRangeFlags(re->rune(), re->rune(), re->parse_flags());
}
} else {
- LOG(DFATAL) << "RE2: unexpected op: " << re->op() << " "
- << re->ToString();
+ ABSL_LOG(DFATAL) << "RE2: unexpected op: " << re->op() << " "
+ << re->ToString();
}
re->Decref();
}
@@ -1475,7 +1476,7 @@ static int UnHex(int c) {
return c - 'A' + 10;
if ('a' <= c && c <= 'f')
return c - 'a' + 10;
- LOG(DFATAL) << "Bad hex digit " << c;
+ ABSL_LOG(DFATAL) << "Bad hex digit " << c;
return 0;
}
@@ -2095,7 +2096,7 @@ bool Regexp::ParseState::ParsePerlFlags(absl::string_view* s) {
// Caller is supposed to check this.
if (!(flags_ & PerlX) || t.size() < 2 || t[0] != '(' || t[1] != '?') {
status_->set_code(kRegexpInternalError);
- LOG(DFATAL) << "Bad call to ParseState::ParsePerlFlags";
+ ABSL_LOG(DFATAL) << "Bad call to ParseState::ParsePerlFlags";
return false;
}
diff --git a/contrib/libs/re2/re2/prefilter.cc b/contrib/libs/re2/re2/prefilter.cc
index 3c7886f834..decc412ba6 100644
--- a/contrib/libs/re2/re2/prefilter.cc
+++ b/contrib/libs/re2/re2/prefilter.cc
@@ -5,17 +5,19 @@
#include "re2/prefilter.h"
#include <stddef.h>
-#include <stdint.h>
+
#include <string>
#include <utility>
#include <vector>
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
-#include "util/utf.h"
#include "re2/re2.h"
+#include "re2/regexp.h"
#include "re2/unicode_casefold.h"
#include "re2/walker-inl.h"
+#include "util/utf.h"
namespace re2 {
@@ -300,8 +302,8 @@ void Prefilter::CrossProduct(const SSet& a, const SSet& b, SSet* dst) {
Prefilter::Info* Prefilter::Info::Concat(Info* a, Info* b) {
if (a == NULL)
return b;
- DCHECK(a->is_exact_);
- DCHECK(b && b->is_exact_);
+ ABSL_DCHECK(a->is_exact_);
+ ABSL_DCHECK(b && b->is_exact_);
Info *ab = new Info();
CrossProduct(a->exact_, b->exact_, &ab->exact_);
@@ -450,9 +452,9 @@ typedef CharClass::iterator CCIter;
Prefilter::Info* Prefilter::Info::CClass(CharClass *cc,
bool latin1) {
if (ExtraDebug) {
- LOG(ERROR) << "CharClassInfo:";
+ ABSL_LOG(ERROR) << "CharClassInfo:";
for (CCIter i = cc->begin(); i != cc->end(); ++i)
- LOG(ERROR) << " " << i->lo << "-" << i->hi;
+ ABSL_LOG(ERROR) << " " << i->lo << "-" << i->hi;
}
// If the class is too large, it's okay to overestimate.
@@ -473,7 +475,7 @@ Prefilter::Info* Prefilter::Info::CClass(CharClass *cc,
a->is_exact_ = true;
if (ExtraDebug)
- LOG(ERROR) << " = " << a->ToString();
+ ABSL_LOG(ERROR) << " = " << a->ToString();
return a;
}
@@ -501,7 +503,7 @@ class Prefilter::Info::Walker : public Regexp::Walker<Prefilter::Info*> {
Prefilter::Info* Prefilter::BuildInfo(Regexp* re) {
if (ExtraDebug)
- LOG(ERROR) << "BuildPrefilter::Info: " << re->ToString();
+ ABSL_LOG(ERROR) << "BuildPrefilter::Info: " << re->ToString();
bool latin1 = (re->parse_flags() & Regexp::Latin1) != 0;
Prefilter::Info::Walker w(latin1);
@@ -531,7 +533,7 @@ Prefilter::Info* Prefilter::Info::Walker::PostVisit(
default:
case kRegexpRepeat:
info = EmptyString();
- LOG(DFATAL) << "Bad regexp op " << re->op();
+ ABSL_LOG(DFATAL) << "Bad regexp op " << re->op();
break;
case kRegexpNoMatch:
@@ -634,8 +636,8 @@ Prefilter::Info* Prefilter::Info::Walker::PostVisit(
}
if (ExtraDebug)
- LOG(ERROR) << "BuildInfo " << re->ToString()
- << ": " << (info ? info->ToString() : "");
+ ABSL_LOG(ERROR) << "BuildInfo " << re->ToString()
+ << ": " << (info ? info->ToString() : "");
return info;
}
@@ -662,7 +664,7 @@ Prefilter* Prefilter::FromRegexp(Regexp* re) {
std::string Prefilter::DebugString() const {
switch (op_) {
default:
- LOG(DFATAL) << "Bad op in Prefilter::DebugString: " << op_;
+ ABSL_LOG(DFATAL) << "Bad op in Prefilter::DebugString: " << op_;
return absl::StrFormat("op%d", op_);
case NONE:
return "*no-matches*";
diff --git a/contrib/libs/re2/re2/prefilter.h b/contrib/libs/re2/re2/prefilter.h
index 018691dcd6..2645790cf0 100644
--- a/contrib/libs/re2/re2/prefilter.h
+++ b/contrib/libs/re2/re2/prefilter.h
@@ -13,7 +13,8 @@
#include <string>
#include <vector>
-#include "util/logging.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
namespace re2 {
@@ -42,7 +43,7 @@ class Prefilter {
// The children of the Prefilter node.
std::vector<Prefilter*>* subs() {
- DCHECK(op_ == AND || op_ == OR);
+ ABSL_DCHECK(op_ == AND || op_ == OR);
return subs_;
}
diff --git a/contrib/libs/re2/re2/prefilter_tree.cc b/contrib/libs/re2/re2/prefilter_tree.cc
index 299a680fbd..0a7bea9841 100644
--- a/contrib/libs/re2/re2/prefilter_tree.cc
+++ b/contrib/libs/re2/re2/prefilter_tree.cc
@@ -5,17 +5,17 @@
#include "re2/prefilter_tree.h"
#include <stddef.h>
+
#include <algorithm>
#include <cmath>
-#include <memory>
#include <string>
#include <utility>
#include <vector>
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
#include "re2/prefilter.h"
-#include "re2/re2.h"
namespace re2 {
@@ -38,7 +38,7 @@ PrefilterTree::~PrefilterTree() {
void PrefilterTree::Add(Prefilter* prefilter) {
if (compiled_) {
- LOG(DFATAL) << "Add called after Compile.";
+ ABSL_LOG(DFATAL) << "Add called after Compile.";
return;
}
if (prefilter != NULL && !KeepNode(prefilter)) {
@@ -51,7 +51,7 @@ void PrefilterTree::Add(Prefilter* prefilter) {
void PrefilterTree::Compile(std::vector<std::string>* atom_vec) {
if (compiled_) {
- LOG(DFATAL) << "Compile called already.";
+ ABSL_LOG(DFATAL) << "Compile called already.";
return;
}
@@ -83,7 +83,7 @@ bool PrefilterTree::KeepNode(Prefilter* node) const {
switch (node->op()) {
default:
- LOG(DFATAL) << "Unexpected op in KeepNode: " << node->op();
+ ABSL_LOG(DFATAL) << "Unexpected op in KeepNode: " << node->op();
return false;
case Prefilter::ALL:
@@ -178,7 +178,7 @@ void PrefilterTree::AssignUniqueIds(NodeSet* nodes,
int id = prefilter->unique_id();
switch (prefilter->op()) {
default:
- LOG(DFATAL) << "Unexpected op: " << prefilter->op();
+ ABSL_LOG(DFATAL) << "Unexpected op: " << prefilter->op();
return;
case Prefilter::ATOM:
@@ -212,7 +212,7 @@ void PrefilterTree::AssignUniqueIds(NodeSet* nodes,
if (prefilter_vec_[i] == NULL)
continue;
int id = CanonicalNode(nodes, prefilter_vec_[i])->unique_id();
- DCHECK_LE(0, id);
+ ABSL_DCHECK_LE(0, id);
Entry* entry = &entries_[id];
entry->regexps.push_back(static_cast<int>(i));
}
@@ -277,7 +277,7 @@ void PrefilterTree::RegexpsGivenStrings(
return;
}
- LOG(ERROR) << "RegexpsGivenStrings called before Compile.";
+ ABSL_LOG(ERROR) << "RegexpsGivenStrings called before Compile.";
for (size_t i = 0; i < prefilter_vec_.size(); i++)
regexps->push_back(static_cast<int>(i));
} else {
@@ -331,31 +331,31 @@ void PrefilterTree::PropagateMatch(const std::vector<int>& atom_ids,
// Debugging help.
void PrefilterTree::PrintPrefilter(int regexpid) {
- LOG(ERROR) << DebugNodeString(prefilter_vec_[regexpid]);
+ ABSL_LOG(ERROR) << DebugNodeString(prefilter_vec_[regexpid]);
}
void PrefilterTree::PrintDebugInfo(NodeSet* nodes) {
- LOG(ERROR) << "#Unique Atoms: " << atom_index_to_id_.size();
- LOG(ERROR) << "#Unique Nodes: " << entries_.size();
+ ABSL_LOG(ERROR) << "#Unique Atoms: " << atom_index_to_id_.size();
+ ABSL_LOG(ERROR) << "#Unique Nodes: " << entries_.size();
for (size_t i = 0; i < entries_.size(); i++) {
const std::vector<int>& parents = entries_[i].parents;
const std::vector<int>& regexps = entries_[i].regexps;
- LOG(ERROR) << "EntryId: " << i
- << " N: " << parents.size() << " R: " << regexps.size();
+ ABSL_LOG(ERROR) << "EntryId: " << i
+ << " N: " << parents.size() << " R: " << regexps.size();
for (int parent : parents)
- LOG(ERROR) << parent;
+ ABSL_LOG(ERROR) << parent;
}
- LOG(ERROR) << "Set:";
+ ABSL_LOG(ERROR) << "Set:";
for (NodeSet::const_iterator iter = nodes->begin();
iter != nodes->end(); ++iter)
- LOG(ERROR) << "NodeId: " << (*iter)->unique_id();
+ ABSL_LOG(ERROR) << "NodeId: " << (*iter)->unique_id();
}
std::string PrefilterTree::DebugNodeString(Prefilter* node) const {
std::string node_string = "";
if (node->op() == Prefilter::ATOM) {
- DCHECK(!node->atom().empty());
+ ABSL_DCHECK(!node->atom().empty());
node_string += node->atom();
} else {
// Adding the operation disambiguates AND and OR nodes.
diff --git a/contrib/libs/re2/re2/prefilter_tree.h b/contrib/libs/re2/re2/prefilter_tree.h
index 71e7a294f9..885170df8a 100644
--- a/contrib/libs/re2/re2/prefilter_tree.h
+++ b/contrib/libs/re2/re2/prefilter_tree.h
@@ -20,9 +20,10 @@
#include <vector>
#include "absl/container/flat_hash_set.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "re2/prefilter.h"
#include "re2/sparse_array.h"
-#include "util/logging.h"
namespace re2 {
@@ -62,15 +63,15 @@ class PrefilterTree {
struct PrefilterHash {
size_t operator()(const Prefilter* a) const {
- DCHECK(a != NULL);
+ ABSL_DCHECK(a != NULL);
return absl::Hash<Prefilter>()(*a);
}
};
struct PrefilterEqual {
bool operator()(const Prefilter* a, const Prefilter* b) const {
- DCHECK(a != NULL);
- DCHECK(b != NULL);
+ ABSL_DCHECK(a != NULL);
+ ABSL_DCHECK(b != NULL);
return *a == *b;
}
};
diff --git a/contrib/libs/re2/re2/prog.cc b/contrib/libs/re2/re2/prog.cc
index 6cadcfa83b..d3ff26eff3 100644
--- a/contrib/libs/re2/re2/prog.cc
+++ b/contrib/libs/re2/re2/prog.cc
@@ -7,35 +7,43 @@
#include "re2/prog.h"
-#if defined(__AVX2__)
-#include <immintrin.h>
-#ifdef _MSC_VER
-#include <intrin.h>
-#endif
-#endif
#include <stdint.h>
#include <string.h>
+
#include <algorithm>
-#include <memory>
+#include <string>
#include <utility>
+#include <vector>
-#include "absl/base/macros.h"
+#include "absl/base/attributes.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
+#include "absl/strings/string_view.h"
#include "re2/bitmap256.h"
+#include "re2/pod_array.h"
+#include "re2/sparse_array.h"
+#include "re2/sparse_set.h"
+
+#if defined(__AVX2__)
+#include <immintrin.h>
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
+#endif
namespace re2 {
// Constructors per Inst opcode
void Prog::Inst::InitAlt(uint32_t out, uint32_t out1) {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_out_opcode(out, kInstAlt);
out1_ = out1;
}
void Prog::Inst::InitByteRange(int lo, int hi, int foldcase, uint32_t out) {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_out_opcode(out, kInstByteRange);
lo_ = lo & 0xFF;
hi_ = hi & 0xFF;
@@ -43,30 +51,30 @@ void Prog::Inst::InitByteRange(int lo, int hi, int foldcase, uint32_t out) {
}
void Prog::Inst::InitCapture(int cap, uint32_t out) {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_out_opcode(out, kInstCapture);
cap_ = cap;
}
void Prog::Inst::InitEmptyWidth(EmptyOp empty, uint32_t out) {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_out_opcode(out, kInstEmptyWidth);
empty_ = empty;
}
void Prog::Inst::InitMatch(int32_t id) {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_opcode(kInstMatch);
match_id_ = id;
}
void Prog::Inst::InitNop(uint32_t out) {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_opcode(kInstNop);
}
void Prog::Inst::InitFail() {
- DCHECK_EQ(out_opcode_, 0);
+ ABSL_DCHECK_EQ(out_opcode_, 0);
set_opcode(kInstFail);
}
@@ -198,7 +206,7 @@ static bool IsMatch(Prog* prog, Prog::Inst* ip) {
for (;;) {
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "Unexpected opcode in IsMatch: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "Unexpected opcode in IsMatch: " << ip->opcode();
return false;
case kInstAlt:
@@ -362,11 +370,11 @@ class ByteMapBuilder {
};
void ByteMapBuilder::Mark(int lo, int hi) {
- DCHECK_GE(lo, 0);
- DCHECK_GE(hi, 0);
- DCHECK_LE(lo, 255);
- DCHECK_LE(hi, 255);
- DCHECK_LE(lo, hi);
+ ABSL_DCHECK_GE(lo, 0);
+ ABSL_DCHECK_GE(hi, 0);
+ ABSL_DCHECK_LE(lo, 255);
+ ABSL_DCHECK_LE(hi, 255);
+ ABSL_DCHECK_LE(lo, hi);
// Ignore any [0-255] ranges. They cause us to recolor every range, which
// has no effect on the eventual result and is therefore a waste of time.
@@ -511,7 +519,7 @@ void Prog::ComputeByteMap() {
builder.Build(bytemap_, &bytemap_range_);
if ((0)) { // For debugging, use trivial bytemap.
- LOG(ERROR) << "Using trivial bytemap.";
+ ABSL_LOG(ERROR) << "Using trivial bytemap.";
for (int i = 0; i < 256; i++)
bytemap_[i] = static_cast<uint8_t>(i);
bytemap_range_ = 256;
@@ -615,12 +623,12 @@ void Prog::Flatten() {
size_t total = 0;
for (int i = 0; i < kNumInst; i++)
total += inst_count_[i];
- CHECK_EQ(total, flat.size());
+ ABSL_CHECK_EQ(total, flat.size());
#endif
// Remap start_unanchored and start.
if (start_unanchored() == 0) {
- DCHECK_EQ(start(), 0);
+ ABSL_DCHECK_EQ(start(), 0);
} else if (start_unanchored() == start()) {
set_start_unanchored(flatmap[1]);
set_start(flatmap[1]);
@@ -677,7 +685,7 @@ void Prog::MarkSuccessors(SparseArray<int>* rootmap,
Inst* ip = inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
break;
case kInstAltMatch:
@@ -737,7 +745,7 @@ void Prog::MarkDominator(int root, SparseArray<int>* rootmap,
Inst* ip = inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
break;
case kInstAltMatch:
@@ -804,7 +812,7 @@ void Prog::EmitList(int root, SparseArray<int>* rootmap,
Inst* ip = inst(id);
switch (ip->opcode()) {
default:
- LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
+ ABSL_LOG(DFATAL) << "unhandled opcode: " << ip->opcode();
break;
case kInstAltMatch:
@@ -1105,7 +1113,7 @@ const void* Prog::PrefixAccel_ShiftDFA(const void* data, size_t size) {
#if defined(__AVX2__)
// Finds the least significant non-zero bit in n.
static int FindLSBSet(uint32_t n) {
- DCHECK_NE(n, 0);
+ ABSL_DCHECK_NE(n, 0);
#if defined(__GNUC__)
return __builtin_ctz(n);
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
@@ -1127,7 +1135,7 @@ static int FindLSBSet(uint32_t n) {
#endif
const void* Prog::PrefixAccel_FrontAndBack(const void* data, size_t size) {
- DCHECK_GE(prefix_size_, 2);
+ ABSL_DCHECK_GE(prefix_size_, 2);
if (size < prefix_size_)
return NULL;
// Don't bother searching the last prefix_size_-1 bytes for prefix_front_.
@@ -1164,7 +1172,7 @@ const void* Prog::PrefixAccel_FrontAndBack(const void* data, size_t size) {
const char* p0 = reinterpret_cast<const char*>(data);
for (const char* p = p0;; p++) {
- DCHECK_GE(size, static_cast<size_t>(p-p0));
+ ABSL_DCHECK_GE(size, static_cast<size_t>(p-p0));
p = reinterpret_cast<const char*>(memchr(p, prefix_front_, size - (p-p0)));
if (p == NULL || p[prefix_size_-1] == prefix_back_)
return p;
diff --git a/contrib/libs/re2/re2/prog.h b/contrib/libs/re2/re2/prog.h
index 41923f3142..d0889bdca7 100644
--- a/contrib/libs/re2/re2/prog.h
+++ b/contrib/libs/re2/re2/prog.h
@@ -10,14 +10,16 @@
// expression symbolically.
#include <stdint.h>
+
#include <functional>
#include <string>
-#include <vector>
#include <type_traits>
+#include <vector>
#include "absl/base/call_once.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/string_view.h"
-#include "util/logging.h"
#include "re2/pod_array.h"
#include "re2/re2.h"
#include "re2/sparse_array.h"
@@ -79,20 +81,44 @@ class Prog {
// Getters
int id(Prog* p) { return static_cast<int>(this - p->inst_.data()); }
- InstOp opcode() { return static_cast<InstOp>(out_opcode_&7); }
- int last() { return (out_opcode_>>3)&1; }
- int out() { return out_opcode_>>4; }
- int out1() { DCHECK(opcode() == kInstAlt || opcode() == kInstAltMatch); return out1_; }
- int cap() { DCHECK_EQ(opcode(), kInstCapture); return cap_; }
- int lo() { DCHECK_EQ(opcode(), kInstByteRange); return lo_; }
- int hi() { DCHECK_EQ(opcode(), kInstByteRange); return hi_; }
- int foldcase() { DCHECK_EQ(opcode(), kInstByteRange); return hint_foldcase_&1; }
- int hint() { DCHECK_EQ(opcode(), kInstByteRange); return hint_foldcase_>>1; }
- int match_id() { DCHECK_EQ(opcode(), kInstMatch); return match_id_; }
- EmptyOp empty() { DCHECK_EQ(opcode(), kInstEmptyWidth); return empty_; }
+ InstOp opcode() { return static_cast<InstOp>(out_opcode_ & 7); }
+ int last() { return (out_opcode_ >> 3) & 1; }
+ int out() { return out_opcode_ >> 4; }
+ int out1() {
+ ABSL_DCHECK(opcode() == kInstAlt || opcode() == kInstAltMatch);
+ return out1_;
+ }
+ int cap() {
+ ABSL_DCHECK_EQ(opcode(), kInstCapture);
+ return cap_;
+ }
+ int lo() {
+ ABSL_DCHECK_EQ(opcode(), kInstByteRange);
+ return lo_;
+ }
+ int hi() {
+ ABSL_DCHECK_EQ(opcode(), kInstByteRange);
+ return hi_;
+ }
+ int foldcase() {
+ ABSL_DCHECK_EQ(opcode(), kInstByteRange);
+ return hint_foldcase_ & 1;
+ }
+ int hint() {
+ ABSL_DCHECK_EQ(opcode(), kInstByteRange);
+ return hint_foldcase_ >> 1;
+ }
+ int match_id() {
+ ABSL_DCHECK_EQ(opcode(), kInstMatch);
+ return match_id_;
+ }
+ EmptyOp empty() {
+ ABSL_DCHECK_EQ(opcode(), kInstEmptyWidth);
+ return empty_;
+ }
bool greedy(Prog* p) {
- DCHECK_EQ(opcode(), kInstAltMatch);
+ ABSL_DCHECK_EQ(opcode(), kInstAltMatch);
return p->inst(out())->opcode() == kInstByteRange ||
(p->inst(out())->opcode() == kInstNop &&
p->inst(p->inst(out())->out())->opcode() == kInstByteRange);
@@ -100,7 +126,7 @@ class Prog {
// Does this inst (an kInstByteRange) match c?
inline bool Matches(int c) {
- DCHECK_EQ(opcode(), kInstByteRange);
+ ABSL_DCHECK_EQ(opcode(), kInstByteRange);
if (foldcase() && 'A' <= c && c <= 'Z')
c += 'a' - 'A';
return lo_ <= c && c <= hi_;
@@ -221,7 +247,7 @@ class Prog {
// Accelerates to the first likely occurrence of the prefix.
// Returns a pointer to the first byte or NULL if not found.
const void* PrefixAccel(const void* data, size_t size) {
- DCHECK(can_prefix_accel());
+ ABSL_DCHECK(can_prefix_accel());
if (prefix_foldcase_) {
return PrefixAccel_ShiftDFA(data, size);
} else if (prefix_size_ != 1) {
diff --git a/contrib/libs/re2/re2/re2.cc b/contrib/libs/re2/re2/re2.cc
index 83edfedea1..7efe00eb27 100644
--- a/contrib/libs/re2/re2/re2.cc
+++ b/contrib/libs/re2/re2/re2.cc
@@ -9,31 +9,36 @@
#include "re2/re2.h"
-#include <ctype.h>
#include <errno.h>
-#ifdef _MSC_VER
-#include <intrin.h>
-#endif
+#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+
#include <algorithm>
#include <atomic>
-#include <iterator>
+#include <map>
#include <string>
#include <utility>
#include <vector>
+#include "absl/base/call_once.h"
#include "absl/base/macros.h"
#include "absl/container/fixed_array.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
-#include "util/strutil.h"
-#include "util/utf.h"
+#include "absl/strings/string_view.h"
#include "re2/prog.h"
#include "re2/regexp.h"
#include "re2/sparse_array.h"
+#include "util/strutil.h"
+#include "util/utf.h"
+
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
namespace re2 {
@@ -158,7 +163,7 @@ int RE2::Options::ParseFlags() const {
switch (encoding()) {
default:
if (log_errors())
- LOG(ERROR) << "Unknown encoding " << encoding();
+ ABSL_LOG(ERROR) << "Unknown encoding " << encoding();
break;
case RE2::Options::EncodingUTF8:
break;
@@ -229,8 +234,8 @@ void RE2::Init(absl::string_view pattern, const Options& options) {
&status);
if (entire_regexp_ == NULL) {
if (options_.log_errors()) {
- LOG(ERROR) << "Error parsing '" << trunc(*pattern_) << "': "
- << status.Text();
+ ABSL_LOG(ERROR) << "Error parsing '" << trunc(*pattern_) << "': "
+ << status.Text();
}
error_ = new std::string(status.Text());
error_code_ = RegexpErrorToRE2(status.code());
@@ -254,7 +259,7 @@ void RE2::Init(absl::string_view pattern, const Options& options) {
prog_ = suffix_regexp_->CompileToProg(options_.max_mem()*2/3);
if (prog_ == NULL) {
if (options_.log_errors())
- LOG(ERROR) << "Error compiling '" << trunc(*pattern_) << "'";
+ ABSL_LOG(ERROR) << "Error compiling '" << trunc(*pattern_) << "'";
error_ = new std::string("pattern too large - compile failed");
error_code_ = RE2::ErrorPatternTooLarge;
return;
@@ -280,8 +285,8 @@ re2::Prog* RE2::ReverseProg() const {
re->suffix_regexp_->CompileToReverseProg(re->options_.max_mem() / 3);
if (re->rprog_ == NULL) {
if (re->options_.log_errors())
- LOG(ERROR) << "Error reverse compiling '" << trunc(*re->pattern_)
- << "'";
+ ABSL_LOG(ERROR) << "Error reverse compiling '" << trunc(*re->pattern_)
+ << "'";
// We no longer touch error_ and error_code_ because failing to compile
// the reverse Prog is not a showstopper: falling back to NFA execution
// is fine. More importantly, an RE2 object is supposed to be logically
@@ -327,7 +332,7 @@ int RE2::ReverseProgramSize() const {
// Finds the most significant non-zero bit in n.
static int FindMSBSet(uint32_t n) {
- DCHECK_NE(n, 0);
+ ABSL_DCHECK_NE(n, 0);
#if defined(__GNUC__)
return 31 ^ __builtin_clz(n);
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
@@ -453,8 +458,8 @@ bool RE2::Replace(std::string* str,
if (!re.Rewrite(&s, rewrite, vec, nvec))
return false;
- DCHECK_GE(vec[0].data(), str->data());
- DCHECK_LE(vec[0].data() + vec[0].size(), str->data() + str->size());
+ ABSL_DCHECK_GE(vec[0].data(), str->data());
+ ABSL_DCHECK_LE(vec[0].data() + vec[0].size(), str->data() + str->size());
str->replace(vec[0].data() - str->data(), vec[0].size(), s);
return true;
}
@@ -653,16 +658,16 @@ bool RE2::Match(absl::string_view text,
int nsubmatch) const {
if (!ok()) {
if (options_.log_errors())
- LOG(ERROR) << "Invalid RE2: " << *error_;
+ ABSL_LOG(ERROR) << "Invalid RE2: " << *error_;
return false;
}
if (startpos > endpos || endpos > text.size()) {
if (options_.log_errors())
- LOG(ERROR) << "RE2: invalid startpos, endpos pair. ["
- << "startpos: " << startpos << ", "
- << "endpos: " << endpos << ", "
- << "text size: " << text.size() << "]";
+ ABSL_LOG(ERROR) << "RE2: invalid startpos, endpos pair. ["
+ << "startpos: " << startpos << ", "
+ << "endpos: " << endpos << ", "
+ << "text size: " << text.size() << "]";
return false;
}
@@ -732,7 +737,7 @@ bool RE2::Match(absl::string_view text,
bool skipped_test = false;
switch (re_anchor) {
default:
- LOG(DFATAL) << "Unexpected re_anchor value: " << re_anchor;
+ ABSL_LOG(DFATAL) << "Unexpected re_anchor value: " << re_anchor;
return false;
case UNANCHORED: {
@@ -750,11 +755,11 @@ bool RE2::Match(absl::string_view text,
Prog::kLongestMatch, matchp, &dfa_failed, NULL)) {
if (dfa_failed) {
if (options_.log_errors())
- LOG(ERROR) << "DFA out of memory: "
- << "pattern length " << pattern_->size() << ", "
- << "program size " << prog->size() << ", "
- << "list count " << prog->list_count() << ", "
- << "bytemap range " << prog->bytemap_range();
+ ABSL_LOG(ERROR) << "DFA out of memory: "
+ << "pattern length " << pattern_->size() << ", "
+ << "program size " << prog->size() << ", "
+ << "list count " << prog->list_count() << ", "
+ << "bytemap range " << prog->bytemap_range();
// Fall back to NFA below.
skipped_test = true;
break;
@@ -770,11 +775,11 @@ bool RE2::Match(absl::string_view text,
matchp, &dfa_failed, NULL)) {
if (dfa_failed) {
if (options_.log_errors())
- LOG(ERROR) << "DFA out of memory: "
- << "pattern length " << pattern_->size() << ", "
- << "program size " << prog_->size() << ", "
- << "list count " << prog_->list_count() << ", "
- << "bytemap range " << prog_->bytemap_range();
+ ABSL_LOG(ERROR) << "DFA out of memory: "
+ << "pattern length " << pattern_->size() << ", "
+ << "program size " << prog_->size() << ", "
+ << "list count " << prog_->list_count() << ", "
+ << "bytemap range " << prog_->bytemap_range();
// Fall back to NFA below.
skipped_test = true;
break;
@@ -796,17 +801,17 @@ bool RE2::Match(absl::string_view text,
Prog::kLongestMatch, &match, &dfa_failed, NULL)) {
if (dfa_failed) {
if (options_.log_errors())
- LOG(ERROR) << "DFA out of memory: "
- << "pattern length " << pattern_->size() << ", "
- << "program size " << prog->size() << ", "
- << "list count " << prog->list_count() << ", "
- << "bytemap range " << prog->bytemap_range();
+ ABSL_LOG(ERROR) << "DFA out of memory: "
+ << "pattern length " << pattern_->size() << ", "
+ << "program size " << prog->size() << ", "
+ << "list count " << prog->list_count() << ", "
+ << "bytemap range " << prog->bytemap_range();
// Fall back to NFA below.
skipped_test = true;
break;
}
if (options_.log_errors())
- LOG(ERROR) << "SearchDFA inconsistency";
+ ABSL_LOG(ERROR) << "SearchDFA inconsistency";
return false;
}
break;
@@ -839,11 +844,11 @@ bool RE2::Match(absl::string_view text,
&match, &dfa_failed, NULL)) {
if (dfa_failed) {
if (options_.log_errors())
- LOG(ERROR) << "DFA out of memory: "
- << "pattern length " << pattern_->size() << ", "
- << "program size " << prog_->size() << ", "
- << "list count " << prog_->list_count() << ", "
- << "bytemap range " << prog_->bytemap_range();
+ ABSL_LOG(ERROR) << "DFA out of memory: "
+ << "pattern length " << pattern_->size() << ", "
+ << "program size " << prog_->size() << ", "
+ << "list count " << prog_->list_count() << ", "
+ << "bytemap range " << prog_->bytemap_range();
// Fall back to NFA below.
skipped_test = true;
break;
@@ -875,20 +880,20 @@ bool RE2::Match(absl::string_view text,
if (can_one_pass && anchor != Prog::kUnanchored) {
if (!prog_->SearchOnePass(subtext1, text, anchor, kind, submatch, ncap)) {
if (!skipped_test && options_.log_errors())
- LOG(ERROR) << "SearchOnePass inconsistency";
+ ABSL_LOG(ERROR) << "SearchOnePass inconsistency";
return false;
}
} else if (can_bit_state && subtext1.size() <= bit_state_text_max_size) {
if (!prog_->SearchBitState(subtext1, text, anchor,
kind, submatch, ncap)) {
if (!skipped_test && options_.log_errors())
- LOG(ERROR) << "SearchBitState inconsistency";
+ ABSL_LOG(ERROR) << "SearchBitState inconsistency";
return false;
}
} else {
if (!prog_->SearchNFA(subtext1, text, anchor, kind, submatch, ncap)) {
if (!skipped_test && options_.log_errors())
- LOG(ERROR) << "SearchNFA inconsistency";
+ ABSL_LOG(ERROR) << "SearchNFA inconsistency";
return false;
}
}
@@ -913,7 +918,7 @@ bool RE2::DoMatch(absl::string_view text,
int n) const {
if (!ok()) {
if (options_.log_errors())
- LOG(ERROR) << "Invalid RE2: " << *error_;
+ ABSL_LOG(ERROR) << "Invalid RE2: " << *error_;
return false;
}
@@ -1033,8 +1038,8 @@ bool RE2::Rewrite(std::string* out,
int n = (c - '0');
if (n >= veclen) {
if (options_.log_errors()) {
- LOG(ERROR) << "invalid substitution \\" << n
- << " from " << veclen << " groups";
+ ABSL_LOG(ERROR) << "invalid substitution \\" << n
+ << " from " << veclen << " groups";
}
return false;
}
@@ -1045,7 +1050,7 @@ bool RE2::Rewrite(std::string* out,
out->push_back('\\');
} else {
if (options_.log_errors())
- LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
+ ABSL_LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
return false;
}
}
diff --git a/contrib/libs/re2/re2/re2.h b/contrib/libs/re2/re2/re2.h
index 672ebf9afa..9be85cf9b3 100644
--- a/contrib/libs/re2/re2/re2.h
+++ b/contrib/libs/re2/re2/re2.h
@@ -50,10 +50,10 @@
// supplied pattern exactly.
//
// Example: successful match
-// CHECK(RE2::FullMatch("hello", "h.*o"));
+// ABSL_CHECK(RE2::FullMatch("hello", "h.*o"));
//
// Example: unsuccessful match (requires full match):
-// CHECK(!RE2::FullMatch("hello", "e"));
+// ABSL_CHECK(!RE2::FullMatch("hello", "e"));
//
// -----------------------------------------------------------------------
// UTF-8 AND THE MATCHING INTERFACE:
@@ -62,8 +62,9 @@
// The RE2::Latin1 option causes them to be interpreted as Latin-1.
//
// Example:
-// CHECK(RE2::FullMatch(utf8_string, RE2(utf8_pattern)));
-// CHECK(RE2::FullMatch(latin1_string, RE2(latin1_pattern, RE2::Latin1)));
+// ABSL_CHECK(RE2::FullMatch(utf8_string, RE2(utf8_pattern)));
+// ABSL_CHECK(RE2::FullMatch(latin1_string, RE2(latin1_pattern,
+// RE2::Latin1)));
//
// -----------------------------------------------------------------------
// SUBMATCH EXTRACTION:
@@ -83,27 +84,27 @@
// Example: extracts "ruby" into "s" and 1234 into "i"
// int i;
// std::string s;
-// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i));
+// ABSL_CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i));
//
// Example: extracts "ruby" into "s" and no value into "i"
// absl::optional<int> i;
// std::string s;
-// CHECK(RE2::FullMatch("ruby", "(\\w+)(?::(\\d+))?", &s, &i));
+// ABSL_CHECK(RE2::FullMatch("ruby", "(\\w+)(?::(\\d+))?", &s, &i));
//
// Example: fails because string cannot be stored in integer
-// CHECK(!RE2::FullMatch("ruby", "(.*)", &i));
+// ABSL_CHECK(!RE2::FullMatch("ruby", "(.*)", &i));
//
// Example: fails because there aren't enough sub-patterns
-// CHECK(!RE2::FullMatch("ruby:1234", "\\w+:\\d+", &s));
+// ABSL_CHECK(!RE2::FullMatch("ruby:1234", "\\w+:\\d+", &s));
//
// Example: does not try to extract any extra sub-patterns
-// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s));
+// ABSL_CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s));
//
// Example: does not try to extract into NULL
-// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", NULL, &i));
+// ABSL_CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", NULL, &i));
//
// Example: integer overflow causes failure
-// CHECK(!RE2::FullMatch("ruby:1234567891234", "\\w+:(\\d+)", &i));
+// ABSL_CHECK(!RE2::FullMatch("ruby:1234567891234", "\\w+:(\\d+)", &i));
//
// NOTE(rsc): Asking for submatches slows successful matches quite a bit.
// This may get a little faster in the future, but right now is slower
@@ -117,12 +118,12 @@
// to match any substring of the text.
//
// Example: simple search for a string:
-// CHECK(RE2::PartialMatch("hello", "ell"));
+// ABSL_CHECK(RE2::PartialMatch("hello", "ell"));
//
// Example: find first number in a string
// int number;
-// CHECK(RE2::PartialMatch("x*100 + 20", "(\\d+)", &number));
-// CHECK_EQ(number, 100);
+// ABSL_CHECK(RE2::PartialMatch("x*100 + 20", "(\\d+)", &number));
+// ABSL_CHECK_EQ(number, 100);
//
// -----------------------------------------------------------------------
// PRE-COMPILED REGULAR EXPRESSIONS
@@ -203,12 +204,13 @@
//
// Example:
// int a, b, c, d;
-// CHECK(RE2::FullMatch("100 40 0100 0x40", "(.*) (.*) (.*) (.*)",
+// ABSL_CHECK(RE2::FullMatch("100 40 0100 0x40", "(.*) (.*) (.*) (.*)",
// RE2::Octal(&a), RE2::Hex(&b), RE2::CRadix(&c), RE2::CRadix(&d));
// will leave 64 in a, b, c, and d.
#include <stddef.h>
#include <stdint.h>
+
#include <algorithm>
#include <map>
#include <string>
@@ -216,15 +218,15 @@
#include <vector>
#include <util/generic/string.h>
-#if defined(__APPLE__)
-#include <TargetConditionals.h>
-#endif
-
#include "absl/base/call_once.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "re2/stringpiece.h"
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#endif
+
namespace re2 {
class Prog;
class Regexp;
@@ -472,7 +474,7 @@ class RE2 {
// text. E.g.,
//
// std::string s = "yabba dabba doo";
- // CHECK(RE2::Replace(&s, "b+", "d"));
+ // ABSL_CHECK(RE2::Replace(&s, "b+", "d"));
//
// will leave "s" containing "yada dabba doo"
//
@@ -494,7 +496,7 @@ class RE2 {
// of the pattern in the string with the rewrite. E.g.
//
// std::string s = "yabba dabba doo";
- // CHECK(RE2::GlobalReplace(&s, "b+", "d"));
+ // ABSL_CHECK(RE2::GlobalReplace(&s, "b+", "d"));
//
// will leave "s" containing "yada dada doo"
// Replacements are not subject to re-matching.
@@ -936,14 +938,12 @@ class RE2::Arg {
re2_internal::Parse4ary<T>::value,
int>::type;
-#if !defined(_MSC_VER)
template <typename T>
using CanParseFrom = typename std::enable_if<
std::is_member_function_pointer<
decltype(static_cast<bool (T::*)(const char*, size_t)>(
&T::ParseFrom))>::value,
int>::type;
-#endif
public:
Arg() : Arg(nullptr) {}
@@ -955,10 +955,8 @@ class RE2::Arg {
template <typename T, CanParse4ary<T> = 0>
Arg(T* ptr) : arg_(ptr), parser_(DoParse4ary<T>) {}
-#if !defined(_MSC_VER)
template <typename T, CanParseFrom<T> = 0>
Arg(T* ptr) : arg_(ptr), parser_(DoParseFrom<T>) {}
-#endif
typedef bool (*Parser)(const char* str, size_t n, void* dest);
@@ -984,13 +982,11 @@ class RE2::Arg {
return re2_internal::Parse(str, n, reinterpret_cast<T*>(dest), 10);
}
-#if !defined(_MSC_VER)
template <typename T>
static bool DoParseFrom(const char* str, size_t n, void* dest) {
if (dest == NULL) return true;
return reinterpret_cast<T*>(dest)->ParseFrom(str, n);
}
-#endif
void* arg_;
Parser parser_;
diff --git a/contrib/libs/re2/re2/regexp.cc b/contrib/libs/re2/re2/regexp.cc
index 4ea81cfcdc..1e5ae9071d 100644
--- a/contrib/libs/re2/re2/regexp.cc
+++ b/contrib/libs/re2/re2/regexp.cc
@@ -10,6 +10,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+
#include <algorithm>
#include <map>
#include <string>
@@ -18,11 +19,12 @@
#include "absl/base/call_once.h"
#include "absl/base/macros.h"
#include "absl/container/flat_hash_map.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/synchronization/mutex.h"
-#include "util/logging.h"
-#include "util/utf.h"
#include "re2/pod_array.h"
#include "re2/walker-inl.h"
+#include "util/utf.h"
namespace re2 {
@@ -45,7 +47,7 @@ Regexp::Regexp(RegexpOp op, ParseFlags parse_flags)
// required Decref() to have handled them for us.
Regexp::~Regexp() {
if (nsub_ > 0)
- LOG(DFATAL) << "Regexp not destroyed.";
+ ABSL_LOG(DFATAL) << "Regexp not destroyed.";
switch (op_) {
default:
@@ -154,7 +156,7 @@ void Regexp::Destroy() {
Regexp* re = stack;
stack = re->down_;
if (re->ref_ != 0)
- LOG(DFATAL) << "Bad reference count " << re->ref_;
+ ABSL_LOG(DFATAL) << "Bad reference count " << re->ref_;
if (re->nsub_ > 0) {
Regexp** subs = re->sub();
for (int i = 0; i < re->nsub_; i++) {
@@ -179,7 +181,7 @@ void Regexp::Destroy() {
}
void Regexp::AddRuneToString(Rune r) {
- DCHECK(op_ == kRegexpLiteralString);
+ ABSL_DCHECK(op_ == kRegexpLiteralString);
if (nrunes_ == 0) {
// start with 8
runes_ = new Rune[8];
@@ -421,7 +423,7 @@ static bool TopEqual(Regexp* a, Regexp* b) {
}
}
- LOG(DFATAL) << "Unexpected op in Regexp::Equal: " << a->op();
+ ABSL_LOG(DFATAL) << "Unexpected op in Regexp::Equal: " << a->op();
return 0;
}
@@ -496,7 +498,7 @@ bool Regexp::Equal(Regexp* a, Regexp* b) {
if (n == 0)
break;
- DCHECK_GE(n, 2);
+ ABSL_DCHECK_GE(n, 2);
a = stk[n-2];
b = stk[n-1];
stk.resize(n-2);
@@ -562,7 +564,7 @@ class NumCapturesWalker : public Regexp::Walker<Ignored> {
virtual Ignored ShortVisit(Regexp* re, Ignored ignored) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "NumCapturesWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "NumCapturesWalker::ShortVisit called";
#endif
return ignored;
}
@@ -609,7 +611,7 @@ class NamedCapturesWalker : public Regexp::Walker<Ignored> {
virtual Ignored ShortVisit(Regexp* re, Ignored ignored) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "NamedCapturesWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "NamedCapturesWalker::ShortVisit called";
#endif
return ignored;
}
@@ -653,7 +655,7 @@ class CaptureNamesWalker : public Regexp::Walker<Ignored> {
virtual Ignored ShortVisit(Regexp* re, Ignored ignored) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "CaptureNamesWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "CaptureNamesWalker::ShortVisit called";
#endif
return ignored;
}
@@ -993,7 +995,7 @@ CharClass* CharClassBuilder::GetCharClass() {
for (iterator it = begin(); it != end(); ++it)
cc->ranges_[n++] = *it;
cc->nranges_ = n;
- DCHECK_LE(n, static_cast<int>(ranges_.size()));
+ ABSL_DCHECK_LE(n, static_cast<int>(ranges_.size()));
cc->nrunes_ = nrunes_;
cc->folds_ascii_ = FoldsASCII();
return cc;
diff --git a/contrib/libs/re2/re2/regexp.h b/contrib/libs/re2/re2/regexp.h
index df4989479a..531b42044b 100644
--- a/contrib/libs/re2/re2/regexp.h
+++ b/contrib/libs/re2/re2/regexp.h
@@ -88,12 +88,14 @@
#include <stddef.h>
#include <stdint.h>
+
#include <map>
#include <set>
#include <string>
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/string_view.h"
-#include "util/logging.h"
#include "util/utf.h"
namespace re2 {
@@ -332,15 +334,42 @@ class Regexp {
return submany_;
}
- int min() { DCHECK_EQ(op_, kRegexpRepeat); return min_; }
- int max() { DCHECK_EQ(op_, kRegexpRepeat); return max_; }
- Rune rune() { DCHECK_EQ(op_, kRegexpLiteral); return rune_; }
- CharClass* cc() { DCHECK_EQ(op_, kRegexpCharClass); return cc_; }
- int cap() { DCHECK_EQ(op_, kRegexpCapture); return cap_; }
- const std::string* name() { DCHECK_EQ(op_, kRegexpCapture); return name_; }
- Rune* runes() { DCHECK_EQ(op_, kRegexpLiteralString); return runes_; }
- int nrunes() { DCHECK_EQ(op_, kRegexpLiteralString); return nrunes_; }
- int match_id() { DCHECK_EQ(op_, kRegexpHaveMatch); return match_id_; }
+ int min() {
+ ABSL_DCHECK_EQ(op_, kRegexpRepeat);
+ return min_;
+ }
+ int max() {
+ ABSL_DCHECK_EQ(op_, kRegexpRepeat);
+ return max_;
+ }
+ Rune rune() {
+ ABSL_DCHECK_EQ(op_, kRegexpLiteral);
+ return rune_;
+ }
+ CharClass* cc() {
+ ABSL_DCHECK_EQ(op_, kRegexpCharClass);
+ return cc_;
+ }
+ int cap() {
+ ABSL_DCHECK_EQ(op_, kRegexpCapture);
+ return cap_;
+ }
+ const std::string* name() {
+ ABSL_DCHECK_EQ(op_, kRegexpCapture);
+ return name_;
+ }
+ Rune* runes() {
+ ABSL_DCHECK_EQ(op_, kRegexpLiteralString);
+ return runes_;
+ }
+ int nrunes() {
+ ABSL_DCHECK_EQ(op_, kRegexpLiteralString);
+ return nrunes_;
+ }
+ int match_id() {
+ ABSL_DCHECK_EQ(op_, kRegexpHaveMatch);
+ return match_id_;
+ }
// Increments reference count, returns object as convenience.
Regexp* Incref();
@@ -515,7 +544,7 @@ class Regexp {
// Allocate space for n sub-regexps.
void AllocSub(int n) {
- DCHECK(n >= 0 && static_cast<uint16_t>(n) == n);
+ ABSL_DCHECK(n >= 0 && static_cast<uint16_t>(n) == n);
if (n > 1)
submany_ = new Regexp*[n];
nsub_ = static_cast<uint16_t>(n);
diff --git a/contrib/libs/re2/re2/set.cc b/contrib/libs/re2/re2/set.cc
index b9c918e077..caebd24e4e 100644
--- a/contrib/libs/re2/re2/set.cc
+++ b/contrib/libs/re2/re2/set.cc
@@ -5,15 +5,20 @@
#include "re2/set.h"
#include <stddef.h>
+
#include <algorithm>
#include <memory>
+#include <string>
#include <utility>
+#include <vector>
-#include "util/logging.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/regexp.h"
+#include "re2/sparse_set.h"
namespace re2 {
@@ -52,7 +57,7 @@ RE2::Set& RE2::Set::operator=(Set&& other) {
int RE2::Set::Add(absl::string_view pattern, std::string* error) {
if (compiled_) {
- LOG(DFATAL) << "RE2::Set::Add() called after compiling";
+ ABSL_LOG(DFATAL) << "RE2::Set::Add() called after compiling";
return -1;
}
@@ -64,7 +69,7 @@ int RE2::Set::Add(absl::string_view pattern, std::string* error) {
if (error != NULL)
*error = status.Text();
if (options_.log_errors())
- LOG(ERROR) << "Error parsing '" << pattern << "': " << status.Text();
+ ABSL_LOG(ERROR) << "Error parsing '" << pattern << "': " << status.Text();
return -1;
}
@@ -91,7 +96,7 @@ int RE2::Set::Add(absl::string_view pattern, std::string* error) {
bool RE2::Set::Compile() {
if (compiled_) {
- LOG(DFATAL) << "RE2::Set::Compile() called more than once";
+ ABSL_LOG(DFATAL) << "RE2::Set::Compile() called more than once";
return false;
}
compiled_ = true;
@@ -128,7 +133,7 @@ bool RE2::Set::Match(absl::string_view text, std::vector<int>* v,
if (!compiled_) {
if (error_info != NULL)
error_info->kind = kNotCompiled;
- LOG(DFATAL) << "RE2::Set::Match() called before compiling";
+ ABSL_LOG(DFATAL) << "RE2::Set::Match() called before compiling";
return false;
}
#ifdef RE2_HAVE_THREAD_LOCAL
@@ -144,10 +149,10 @@ bool RE2::Set::Match(absl::string_view text, std::vector<int>* v,
NULL, &dfa_failed, matches.get());
if (dfa_failed) {
if (options_.log_errors())
- LOG(ERROR) << "DFA out of memory: "
- << "program size " << prog_->size() << ", "
- << "list count " << prog_->list_count() << ", "
- << "bytemap range " << prog_->bytemap_range();
+ ABSL_LOG(ERROR) << "DFA out of memory: "
+ << "program size " << prog_->size() << ", "
+ << "list count " << prog_->list_count() << ", "
+ << "bytemap range " << prog_->bytemap_range();
if (error_info != NULL)
error_info->kind = kOutOfMemory;
return false;
@@ -161,7 +166,7 @@ bool RE2::Set::Match(absl::string_view text, std::vector<int>* v,
if (matches->empty()) {
if (error_info != NULL)
error_info->kind = kInconsistent;
- LOG(DFATAL) << "RE2::Set::Match() matched, but no matches returned?!";
+ ABSL_LOG(DFATAL) << "RE2::Set::Match() matched, but no matches returned";
return false;
}
v->assign(matches->begin(), matches->end());
diff --git a/contrib/libs/re2/re2/simplify.cc b/contrib/libs/re2/re2/simplify.cc
index cea100b08a..d0524aff54 100644
--- a/contrib/libs/re2/re2/simplify.cc
+++ b/contrib/libs/re2/re2/simplify.cc
@@ -6,14 +6,17 @@
// to use simple extended regular expression features.
// Also sort and simplify character classes.
+#include <stddef.h>
+
#include <algorithm>
#include <string>
-#include "util/logging.h"
-#include "util/utf.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/regexp.h"
#include "re2/walker-inl.h"
+#include "util/utf.h"
namespace re2 {
@@ -94,7 +97,7 @@ bool Regexp::ComputeSimple() {
case kRegexpRepeat:
return false;
}
- LOG(DFATAL) << "Case not handled in ComputeSimple: " << op_;
+ ABSL_LOG(DFATAL) << "Case not handled in ComputeSimple: " << op_;
return false;
}
@@ -222,7 +225,7 @@ Regexp* CoalesceWalker::Copy(Regexp* re) {
Regexp* CoalesceWalker::ShortVisit(Regexp* re, Regexp* parent_arg) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "CoalesceWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "CoalesceWalker::ShortVisit called";
#endif
return re->Incref();
}
@@ -372,7 +375,7 @@ void CoalesceWalker::DoCoalesce(Regexp** r1ptr, Regexp** r2ptr) {
default:
nre->Decref();
- LOG(DFATAL) << "DoCoalesce failed: r1->op() is " << r1->op();
+ ABSL_LOG(DFATAL) << "DoCoalesce failed: r1->op() is " << r1->op();
return;
}
@@ -433,7 +436,7 @@ void CoalesceWalker::DoCoalesce(Regexp** r1ptr, Regexp** r2ptr) {
default:
nre->Decref();
- LOG(DFATAL) << "DoCoalesce failed: r2->op() is " << r2->op();
+ ABSL_LOG(DFATAL) << "DoCoalesce failed: r2->op() is " << r2->op();
return;
}
@@ -448,7 +451,7 @@ Regexp* SimplifyWalker::Copy(Regexp* re) {
Regexp* SimplifyWalker::ShortVisit(Regexp* re, Regexp* parent_arg) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "SimplifyWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "SimplifyWalker::ShortVisit called";
#endif
return re->Incref();
}
@@ -564,7 +567,7 @@ Regexp* SimplifyWalker::PostVisit(Regexp* re,
}
}
- LOG(ERROR) << "Simplify case not handled: " << re->op();
+ ABSL_LOG(ERROR) << "Simplify case not handled: " << re->op();
return re->Incref();
}
@@ -661,7 +664,8 @@ Regexp* SimplifyWalker::SimplifyRepeat(Regexp* re, int min, int max,
if (nre == NULL) {
// Some degenerate case, like min > max, or min < max < 0.
// This shouldn't happen, because the parser rejects such regexps.
- LOG(DFATAL) << "Malformed repeat " << re->ToString() << " " << min << " " << max;
+ ABSL_LOG(DFATAL) << "Malformed repeat of " << re->ToString()
+ << " min " << min << " max " << max;
return new Regexp(kRegexpNoMatch, f);
}
diff --git a/contrib/libs/re2/re2/sparse_array.h b/contrib/libs/re2/re2/sparse_array.h
index 09ffe086b7..8174d9a0a6 100644
--- a/contrib/libs/re2/re2/sparse_array.h
+++ b/contrib/libs/re2/re2/sparse_array.h
@@ -88,21 +88,23 @@
//
// A moved-from SparseArray will be empty.
+#include <assert.h>
+#include <stdint.h>
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+
+#include "re2/pod_array.h"
+
// Doing this simplifies the logic below.
#ifndef __has_feature
#define __has_feature(x) 0
#endif
-#include <assert.h>
-#include <stdint.h>
#if __has_feature(memory_sanitizer)
#include <sanitizer/msan_interface.h>
#endif
-#include <algorithm>
-#include <memory>
-#include <utility>
-
-#include "re2/pod_array.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/sparse_set.h b/contrib/libs/re2/re2/sparse_set.h
index 06ed88d81b..c08e93d291 100644
--- a/contrib/libs/re2/re2/sparse_set.h
+++ b/contrib/libs/re2/re2/sparse_set.h
@@ -47,21 +47,23 @@
//
// See sparse_array.h for implementation details.
+#include <assert.h>
+#include <stdint.h>
+
+#include <algorithm>
+#include <memory>
+#include <utility>
+
+#include "re2/pod_array.h"
+
// Doing this simplifies the logic below.
#ifndef __has_feature
#define __has_feature(x) 0
#endif
-#include <assert.h>
-#include <stdint.h>
#if __has_feature(memory_sanitizer)
#include <sanitizer/msan_interface.h>
#endif
-#include <algorithm>
-#include <memory>
-#include <utility>
-
-#include "re2/pod_array.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/testing/backtrack.cc b/contrib/libs/re2/re2/testing/backtrack.cc
index 90071bb0f7..7504e1a460 100644
--- a/contrib/libs/re2/re2/testing/backtrack.cc
+++ b/contrib/libs/re2/re2/testing/backtrack.cc
@@ -13,7 +13,7 @@
// THIS CODE SHOULD NEVER BE USED IN PRODUCTION:
// - It uses a ton of memory.
// - It uses a ton of stack.
-// - It uses CHECK and LOG(FATAL).
+// - It uses ABSL_CHECK() and ABSL_LOG(FATAL).
// - It implements unanchored search by repeated anchored search.
//
// On the other hand, it is very simple and a good reference
@@ -28,7 +28,9 @@
#include <string.h>
#include "absl/base/macros.h"
-#include "util/logging.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "re2/pod_array.h"
#include "re2/prog.h"
#include "re2/regexp.h"
@@ -111,7 +113,7 @@ bool Backtracker::Search(absl::string_view text, absl::string_view context,
endmatch_ = prog_->anchor_end();
submatch_ = submatch;
nsubmatch_ = nsubmatch;
- CHECK_LT(2*nsubmatch_, static_cast<int>(ABSL_ARRAYSIZE(cap_)));
+ ABSL_CHECK_LT(2*nsubmatch_, static_cast<int>(ABSL_ARRAYSIZE(cap_)));
memset(cap_, 0, sizeof cap_);
// We use submatch_[0] for our own bookkeeping,
@@ -157,10 +159,10 @@ bool Backtracker::Visit(int id, const char* p) {
// Check bitmap. If we've already explored from here,
// either it didn't match or it did but we're hoping for a better match.
// Either way, don't go down that road again.
- CHECK(p <= text_.data() + text_.size());
+ ABSL_CHECK(p <= text_.data() + text_.size());
int n = id * static_cast<int>(text_.size()+1) +
static_cast<int>(p-text_.data());
- CHECK_LT(n/32, visited_.size());
+ ABSL_CHECK_LT(n/32, visited_.size());
if (visited_[n/32] & (1 << (n&31)))
return false;
visited_[n/32] |= 1 << (n&31);
@@ -188,7 +190,7 @@ bool Backtracker::Try(int id, const char* p) {
Prog::Inst* ip = prog_->inst(id);
switch (ip->opcode()) {
default:
- LOG(FATAL) << "Unexpected opcode: " << (int)ip->opcode();
+ ABSL_LOG(FATAL) << "Unexpected opcode: " << ip->opcode();
return false; // not reached
case kInstAltMatch:
diff --git a/contrib/libs/re2/re2/testing/charclass_test.cc b/contrib/libs/re2/re2/testing/charclass_test.cc
index ad95d6c264..efe38aec1c 100644
--- a/contrib/libs/re2/re2/testing/charclass_test.cc
+++ b/contrib/libs/re2/re2/testing/charclass_test.cc
@@ -9,8 +9,8 @@
#include "absl/base/macros.h"
#include "absl/strings/str_format.h"
#include "gtest/gtest.h"
-#include "util/utf.h"
#include "re2/regexp.h"
+#include "util/utf.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/testing/compile_test.cc b/contrib/libs/re2/re2/testing/compile_test.cc
index f6899d3d27..7ac01f9b10 100644
--- a/contrib/libs/re2/re2/testing/compile_test.cc
+++ b/contrib/libs/re2/re2/testing/compile_test.cc
@@ -4,13 +4,16 @@
// Test prog.cc, compile.cc
+#include <stddef.h>
+
#include <string>
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
+#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "re2/regexp.h"
#include "re2/prog.h"
+#include "re2/regexp.h"
namespace re2 {
@@ -132,13 +135,13 @@ TEST(TestRegexpCompileToProg, Simple) {
const re2::Test& t = tests[i];
Regexp* re = Regexp::Parse(t.regexp, Regexp::PerlX|Regexp::Latin1, NULL);
if (re == NULL) {
- LOG(ERROR) << "Cannot parse: " << t.regexp;
+ ABSL_LOG(ERROR) << "Cannot parse: " << t.regexp;
failed++;
continue;
}
Prog* prog = re->CompileToProg(0);
if (prog == NULL) {
- LOG(ERROR) << "Cannot compile: " << t.regexp;
+ ABSL_LOG(ERROR) << "Cannot compile: " << t.regexp;
re->Decref();
failed++;
continue;
@@ -146,9 +149,9 @@ TEST(TestRegexpCompileToProg, Simple) {
ASSERT_TRUE(re->CompileToProg(1) == NULL);
std::string s = prog->Dump();
if (s != t.code) {
- LOG(ERROR) << "Incorrect compiled code for: " << t.regexp;
- LOG(ERROR) << "Want:\n" << t.code;
- LOG(ERROR) << "Got:\n" << s;
+ ABSL_LOG(ERROR) << "Incorrect compiled code for: " << t.regexp;
+ ABSL_LOG(ERROR) << "Want:\n" << t.code;
+ ABSL_LOG(ERROR) << "Got:\n" << s;
failed++;
}
delete prog;
diff --git a/contrib/libs/re2/re2/testing/dfa_test.cc b/contrib/libs/re2/re2/testing/dfa_test.cc
index b0759f7c7d..a8178c889a 100644
--- a/contrib/libs/re2/re2/testing/dfa_test.cc
+++ b/contrib/libs/re2/re2/testing/dfa_test.cc
@@ -2,22 +2,24 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include <stddef.h>
#include <stdint.h>
+
#include <string>
#include <thread>
#include <vector>
#include "absl/base/macros.h"
#include "absl/flags/flag.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
+#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "util/malloc_counter.h"
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/regexp.h"
-#include "re2/testing/regexp_generator.h"
#include "re2/testing/string_generator.h"
+#include "util/malloc_counter.h"
static const bool UsingMallocCounter = false;
@@ -111,10 +113,10 @@ TEST(SingleThreaded, BuildEntireDFA) {
delete prog;
}
if (UsingMallocCounter) {
- //LOG(INFO) << "limit " << limit << ", "
- // << "prog usage " << progusage << ", "
- // << "DFA budget " << dfamem << ", "
- // << "total " << usage;
+ //ABSL_LOG(INFO) << "limit " << limit << ", "
+ // << "prog usage " << progusage << ", "
+ // << "DFA budget " << dfamem << ", "
+ // << "total " << usage;
// Tolerate +/- 10%.
ASSERT_GT(usage, limit*9/10);
ASSERT_LT(usage, limit*11/10);
@@ -189,8 +191,8 @@ TEST(SingleThreaded, SearchDFA) {
delete prog;
}
if (UsingMallocCounter) {
- //LOG(INFO) << "usage " << usage << ", "
- // << "peak usage " << peak_usage;
+ //ABSL_LOG(INFO) << "usage " << usage << ", "
+ // << "peak usage " << peak_usage;
ASSERT_LT(usage, 1<<n);
ASSERT_LT(peak_usage, 1<<n);
}
@@ -297,7 +299,7 @@ TEST(DFA, ReverseMatch) {
prog->SearchDFA(t.text, absl::string_view(), Prog::kUnanchored,
Prog::kFirstMatch, NULL, &failed, NULL);
if (matched != t.match) {
- LOG(ERROR) << t.regexp << " on " << t.text << ": want " << t.match;
+ ABSL_LOG(ERROR) << t.regexp << " on " << t.text << ": want " << t.match;
nfail++;
}
delete prog;
@@ -360,8 +362,9 @@ TEST(DFA, Callback) {
dump += match ? "]]" : "]";
});
if (dump != t.dump) {
- LOG(ERROR) << t.regexp << " bytemap:\n" << prog->DumpByteMap();
- LOG(ERROR) << t.regexp << " dump:\ngot " << dump << "\nwant " << t.dump;
+ ABSL_LOG(ERROR) << t.regexp << " bytemap:\n" << prog->DumpByteMap();
+ ABSL_LOG(ERROR) << t.regexp << " dump:\n" << "got " << dump << "\n"
+ << "want " << t.dump;
nfail++;
}
delete prog;
diff --git a/contrib/libs/re2/re2/testing/dump.cc b/contrib/libs/re2/re2/testing/dump.cc
index 9e3c94a696..382ac208a0 100644
--- a/contrib/libs/re2/re2/testing/dump.cc
+++ b/contrib/libs/re2/re2/testing/dump.cc
@@ -19,11 +19,12 @@
#include <string>
#include "absl/base/macros.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "util/utf.h"
#include "re2/regexp.h"
+#include "util/utf.h"
namespace re2 {
@@ -129,7 +130,7 @@ static void DumpRegexpAppending(Regexp* re, std::string* s) {
break;
case kRegexpCapture:
if (re->cap() == 0)
- LOG(DFATAL) << "kRegexpCapture cap() == 0";
+ ABSL_LOG(DFATAL) << "kRegexpCapture cap() == 0";
if (re->name()) {
s->append(*re->name());
s->append(":");
@@ -161,7 +162,7 @@ static void DumpRegexpAppending(Regexp* re, std::string* s) {
std::string Regexp::Dump() {
// Make sure that we are being called from a unit test.
// Should cause a link error if used outside of testing.
- CHECK(!::testing::TempDir().empty());
+ ABSL_CHECK(!::testing::TempDir().empty());
std::string s;
DumpRegexpAppending(this, &s);
diff --git a/contrib/libs/re2/re2/testing/exhaustive_tester.cc b/contrib/libs/re2/re2/testing/exhaustive_tester.cc
index a57f700bcd..d8fa1ffa81 100644
--- a/contrib/libs/re2/re2/testing/exhaustive_tester.cc
+++ b/contrib/libs/re2/re2/testing/exhaustive_tester.cc
@@ -11,14 +11,23 @@
// the NFA, DFA, and a trivial backtracking implementation agree about
// the location of the match.
+#include "re2/testing/exhaustive_tester.h"
+
#include <stdio.h>
+#include <string>
+#include <vector>
+
#include "absl/base/macros.h"
#include "absl/flags/flag.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
+#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "re2/testing/exhaustive_tester.h"
+#include "re2/prog.h"
+#include "re2/re2.h"
+#include "re2/testing/regexp_generator.h"
#include "re2/testing/tester.h"
// For target `log' in the Makefile.
@@ -40,7 +49,7 @@ static char* escape(absl::string_view sp) {
*p++ = '\"';
for (size_t i = 0; i < sp.size(); i++) {
if(p+5 >= buf+sizeof buf)
- LOG(FATAL) << "ExhaustiveTester escape: too long";
+ ABSL_LOG(FATAL) << "ExhaustiveTester escape: too long";
if(sp[i] == '\\' || sp[i] == '\"') {
*p++ = '\\';
*p++ = sp[i];
@@ -82,7 +91,7 @@ void ExhaustiveTester::HandleRegexp(const std::string& const_regexp) {
std::string regexp = const_regexp;
if (!topwrapper_.empty()) {
auto fmt = absl::ParsedFormat<'s'>::New(topwrapper_);
- CHECK(fmt != nullptr);
+ ABSL_CHECK(fmt != nullptr);
regexp = absl::StrFormat(*fmt, regexp);
}
@@ -95,7 +104,7 @@ void ExhaustiveTester::HandleRegexp(const std::string& const_regexp) {
// Write out test cases and answers for use in testing
// other implementations, such as Go's regexp package.
if (randomstrings_)
- LOG(ERROR) << "Cannot log with random strings.";
+ ABSL_LOG(ERROR) << "Cannot log with random strings.";
if (regexps_ == 1) { // first
absl::PrintF("strings\n");
strgen_.Reset();
diff --git a/contrib/libs/re2/re2/testing/exhaustive_tester.h b/contrib/libs/re2/re2/testing/exhaustive_tester.h
index 906be0c8c7..8b0421d712 100644
--- a/contrib/libs/re2/re2/testing/exhaustive_tester.h
+++ b/contrib/libs/re2/re2/testing/exhaustive_tester.h
@@ -6,6 +6,7 @@
#define RE2_TESTING_EXHAUSTIVE_TESTER_H_
#include <stdint.h>
+
#include <string>
#include <vector>
diff --git a/contrib/libs/re2/re2/testing/filtered_re2_test.cc b/contrib/libs/re2/re2/testing/filtered_re2_test.cc
index a8d2dfc72a..b951d7c7f0 100644
--- a/contrib/libs/re2/re2/testing/filtered_re2_test.cc
+++ b/contrib/libs/re2/re2/testing/filtered_re2_test.cc
@@ -2,17 +2,18 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "re2/filtered_re2.h"
+
#include <stddef.h>
+
#include <algorithm>
-#include <memory>
#include <string>
-#include <vector>
#include <utility>
+#include <vector>
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "re2/filtered_re2.h"
#include "re2/re2.h"
namespace re2 {
@@ -172,13 +173,13 @@ bool CheckExpectedAtoms(const char* atoms[],
pass = pass && expected[i] == v->atoms[i];
if (!pass) {
- LOG(ERROR) << "Failed " << testname;
- LOG(ERROR) << "Expected #atoms = " << expected.size();
+ ABSL_LOG(ERROR) << "Failed " << testname;
+ ABSL_LOG(ERROR) << "Expected #atoms = " << expected.size();
for (size_t i = 0; i < expected.size(); i++)
- LOG(ERROR) << expected[i];
- LOG(ERROR) << "Found #atoms = " << v->atoms.size();
+ ABSL_LOG(ERROR) << expected[i];
+ ABSL_LOG(ERROR) << "Found #atoms = " << v->atoms.size();
for (size_t i = 0; i < v->atoms.size(); i++)
- LOG(ERROR) << v->atoms[i];
+ ABSL_LOG(ERROR) << v->atoms[i];
}
return pass;
@@ -273,9 +274,9 @@ TEST(FilteredRE2Test, MatchTests) {
atoms.push_back("yyy");
atoms.push_back("yyyzzz");
FindAtomIndices(v.atoms, atoms, &atom_ids);
- LOG(INFO) << "S: " << atom_ids.size();
+ ABSL_LOG(INFO) << "S: " << atom_ids.size();
for (size_t i = 0; i < atom_ids.size(); i++)
- LOG(INFO) << "i: " << i << " : " << atom_ids[i];
+ ABSL_LOG(INFO) << "i: " << i << " : " << atom_ids[i];
v.f.AllMatches(text, atom_ids, &matching_regexps);
EXPECT_EQ(2, matching_regexps.size());
}
diff --git a/contrib/libs/re2/re2/testing/mimics_pcre_test.cc b/contrib/libs/re2/re2/testing/mimics_pcre_test.cc
index 829659d679..36a348f02b 100644
--- a/contrib/libs/re2/re2/testing/mimics_pcre_test.cc
+++ b/contrib/libs/re2/re2/testing/mimics_pcre_test.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include <stddef.h>
+
#include "absl/base/macros.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/prog.h"
#include "re2/regexp.h"
diff --git a/contrib/libs/re2/re2/testing/null_walker.cc b/contrib/libs/re2/re2/testing/null_walker.cc
index 745364b3c9..3e17bc39e3 100644
--- a/contrib/libs/re2/re2/testing/null_walker.cc
+++ b/contrib/libs/re2/re2/testing/null_walker.cc
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#include "gtest/gtest.h"
-#include "util/logging.h"
+#include "absl/log/absl_log.h"
#include "re2/regexp.h"
#include "re2/walker-inl.h"
@@ -21,7 +20,7 @@ class NullWalker : public Regexp::Walker<bool> {
virtual bool ShortVisit(Regexp* re, bool a) {
// Should never be called: we use Walk(), not WalkExponential().
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
- LOG(DFATAL) << "NullWalker::ShortVisit called";
+ ABSL_LOG(DFATAL) << "NullWalker::ShortVisit called";
#endif
return a;
}
diff --git a/contrib/libs/re2/re2/testing/parse_test.cc b/contrib/libs/re2/re2/testing/parse_test.cc
index 95294d5fff..53ef24ec74 100644
--- a/contrib/libs/re2/re2/testing/parse_test.cc
+++ b/contrib/libs/re2/re2/testing/parse_test.cc
@@ -4,11 +4,13 @@
// Test parse.cc, dump.cc, and tostring.cc.
+#include <stddef.h>
+
#include <string>
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/regexp.h"
namespace re2 {
@@ -520,7 +522,7 @@ TEST(TestToString, EquivalentParse) {
std::string ss = nre->Dump();
std::string tt = nre->ToString();
if (s != ss || t != tt)
- LOG(INFO) << "ToString(" << tests[i].regexp << ") = " << t;
+ ABSL_LOG(INFO) << "ToString(" << tests[i].regexp << ") = " << t;
EXPECT_EQ(s, ss);
EXPECT_EQ(t, tt);
nre->Decref();
diff --git a/contrib/libs/re2/re2/testing/possible_match_test.cc b/contrib/libs/re2/re2/testing/possible_match_test.cc
index fe199c6629..f217947d69 100644
--- a/contrib/libs/re2/re2/testing/possible_match_test.cc
+++ b/contrib/libs/re2/re2/testing/possible_match_test.cc
@@ -3,13 +3,15 @@
// license that can be found in the LICENSE file.
#include <string.h>
+
#include <string>
#include <vector>
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/escaping.h"
+#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/regexp.h"
@@ -113,7 +115,7 @@ TEST(PossibleMatchRange, HandWritten) {
const PrefixTest& t = tests[i];
std::string min, max;
if (j == 0) {
- LOG(INFO) << "Checking regexp=" << absl::CEscape(t.regexp);
+ ABSL_LOG(INFO) << "Checking regexp=" << absl::CEscape(t.regexp);
Regexp* re = Regexp::Parse(t.regexp, Regexp::LikePerl, NULL);
ASSERT_TRUE(re != NULL);
Prog* prog = re->CompileToProg(0);
@@ -202,7 +204,7 @@ class PossibleMatchTester : public RegexpGenerator {
void PossibleMatchTester::HandleRegexp(const std::string& regexp) {
regexps_++;
- VLOG(3) << absl::CEscape(regexp);
+ ABSL_VLOG(3) << absl::CEscape(regexp);
RE2 re(regexp, RE2::Latin1);
ASSERT_EQ(re.error(), "");
@@ -214,7 +216,8 @@ void PossibleMatchTester::HandleRegexp(const std::string& regexp) {
// complicated expressions.
if(strstr(regexp.c_str(), "\\C*"))
return;
- LOG(QFATAL) << "PossibleMatchRange failed on: " << absl::CEscape(regexp);
+ ABSL_LOG(QFATAL) << "PossibleMatchRange failed on: "
+ << absl::CEscape(regexp);
}
strgen_.Reset();
@@ -241,8 +244,8 @@ TEST(PossibleMatchRange, Exhaustive) {
RegexpGenerator::EgrepOps(),
stringlen, Explode("ab4"));
t.Generate();
- LOG(INFO) << t.regexps() << " regexps, "
- << t.tests() << " tests";
+ ABSL_LOG(INFO) << t.regexps() << " regexps, "
+ << t.tests() << " tests";
}
} // namespace re2
diff --git a/contrib/libs/re2/re2/testing/re2_arg_test.cc b/contrib/libs/re2/re2/testing/re2_arg_test.cc
index 4b00be3589..c895c30a98 100644
--- a/contrib/libs/re2/re2/testing/re2_arg_test.cc
+++ b/contrib/libs/re2/re2/testing/re2_arg_test.cc
@@ -11,8 +11,9 @@
#include <string.h>
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
+#include "absl/types/optional.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/re2.h"
namespace re2 {
@@ -135,10 +136,9 @@ TEST(RE2ArgTest, Uint64Test) {
}
TEST(RE2ArgTest, ParseFromTest) {
-#if !defined(_MSC_VER)
struct {
bool ParseFrom(const char* str, size_t n) {
- LOG(INFO) << "str = " << str << ", n = " << n;
+ ABSL_LOG(INFO) << "str = " << str << ", n = " << n;
return true;
}
} obj1;
@@ -147,7 +147,7 @@ TEST(RE2ArgTest, ParseFromTest) {
struct {
bool ParseFrom(const char* str, size_t n) {
- LOG(INFO) << "str = " << str << ", n = " << n;
+ ABSL_LOG(INFO) << "str = " << str << ", n = " << n;
return false;
}
// Ensure that RE2::Arg works even with overloaded ParseFrom().
@@ -155,7 +155,6 @@ TEST(RE2ArgTest, ParseFromTest) {
} obj2;
RE2::Arg arg2(&obj2);
EXPECT_FALSE(arg2.Parse("two", 3));
-#endif
}
TEST(RE2ArgTest, OptionalDoubleTest) {
diff --git a/contrib/libs/re2/re2/testing/re2_test.cc b/contrib/libs/re2/re2/testing/re2_test.cc
index ddf8dbf8fb..d46666bea9 100644
--- a/contrib/libs/re2/re2/testing/re2_test.cc
+++ b/contrib/libs/re2/re2/testing/re2_test.cc
@@ -5,26 +5,30 @@
// TODO: Test extractions for PartialMatch/Consume
+#include "re2/re2.h"
+
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+
#include <map>
#include <string>
#include <utility>
#include <vector>
-#if !defined(_MSC_VER) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-#include <sys/mman.h>
-#include <unistd.h> /* for sysconf */
-#endif
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
+#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "re2/re2.h"
#include "re2/regexp.h"
+#if !defined(_MSC_VER) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#include <sys/mman.h>
+#include <unistd.h>
+#endif
+
namespace re2 {
TEST(RE2, HexTests) {
@@ -773,7 +777,7 @@ TEST(RE2, NULTerminated) {
v = static_cast<char*>(mmap(NULL, 2*pagesize, PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0));
ASSERT_TRUE(v != reinterpret_cast<char*>(-1));
- LOG(INFO) << "Memory at " << (void*)v;
+ ABSL_LOG(INFO) << "Memory at " << reinterpret_cast<void*>(v);
ASSERT_EQ(munmap(v + pagesize, pagesize), 0) << " error " << errno;
v[pagesize - 1] = '1';
@@ -1562,7 +1566,7 @@ TEST(RE2, Bug18391750) {
TEST(RE2, Bug18458852) {
// Bug in parser accepting invalid (too large) rune,
- // causing compiler to fail in DCHECK in UTF-8
+ // causing compiler to fail in ABSL_DCHECK() in UTF-8
// character class code.
const char b[] = {
(char)0x28, (char)0x05, (char)0x05, (char)0x41, (char)0x41, (char)0x28,
@@ -1598,7 +1602,7 @@ TEST(RE2, Bug18523943) {
TEST(RE2, Bug21371806) {
// Bug in parser accepting Unicode groups in Latin-1 mode,
- // causing compiler to fail in DCHECK in prog.cc.
+ // causing compiler to fail in ABSL_DCHECK() in prog.cc.
RE2::Options opt;
opt.set_encoding(RE2::Options::EncodingLatin1);
diff --git a/contrib/libs/re2/re2/testing/regexp_generator.cc b/contrib/libs/re2/re2/testing/regexp_generator.cc
index b1761ed937..a702e7d839 100644
--- a/contrib/libs/re2/re2/testing/regexp_generator.cc
+++ b/contrib/libs/re2/re2/testing/regexp_generator.cc
@@ -20,22 +20,26 @@
// Then RunPostfix turns each sequence into a regular expression
// and passes the regexp to HandleRegexp.
+#include "re2/testing/regexp_generator.h"
+
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
+
#include <memory>
+#include <random>
#include <stack>
#include <string>
#include <vector>
#include "absl/base/macros.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_format.h"
-#include "gtest/gtest.h"
-#include "util/logging.h"
+#include "absl/strings/string_view.h"
#include "util/utf.h"
-#include "re2/testing/regexp_generator.h"
namespace re2 {
@@ -196,13 +200,13 @@ void RegexpGenerator::RunPostfix(const std::vector<std::string>& post) {
for (size_t i = 0; i < post.size(); i++) {
switch (CountArgs(post[i])) {
default:
- LOG(FATAL) << "Bad operator: " << post[i];
+ ABSL_LOG(FATAL) << "Bad operator: " << post[i];
case 0:
regexps.push(post[i]);
break;
case 1: {
auto fmt = absl::ParsedFormat<'s'>::New(post[i]);
- CHECK(fmt != nullptr);
+ ABSL_CHECK(fmt != nullptr);
std::string a = regexps.top();
regexps.pop();
regexps.push("(?:" + absl::StrFormat(*fmt, a) + ")");
@@ -210,7 +214,7 @@ void RegexpGenerator::RunPostfix(const std::vector<std::string>& post) {
}
case 2: {
auto fmt = absl::ParsedFormat<'s', 's'>::New(post[i]);
- CHECK(fmt != nullptr);
+ ABSL_CHECK(fmt != nullptr);
std::string b = regexps.top();
regexps.pop();
std::string a = regexps.top();
@@ -232,7 +236,7 @@ void RegexpGenerator::RunPostfix(const std::vector<std::string>& post) {
absl::PrintF(" %s\n", absl::CEscape(regexps.top()));
regexps.pop();
}
- LOG(FATAL) << "Bad regexp program.";
+ ABSL_LOG(FATAL) << "Bad regexp program.";
}
HandleRegexp(regexps.top());
diff --git a/contrib/libs/re2/re2/testing/regexp_generator.h b/contrib/libs/re2/re2/testing/regexp_generator.h
index e1be1a93da..bb2128da8d 100644
--- a/contrib/libs/re2/re2/testing/regexp_generator.h
+++ b/contrib/libs/re2/re2/testing/regexp_generator.h
@@ -9,6 +9,7 @@
// regular expressions within given parameters (see below for details).
#include <stdint.h>
+
#include <random>
#include <string>
#include <vector>
diff --git a/contrib/libs/re2/re2/testing/regexp_test.cc b/contrib/libs/re2/re2/testing/regexp_test.cc
index ef8f59d363..e971bd0b36 100644
--- a/contrib/libs/re2/re2/testing/regexp_test.cc
+++ b/contrib/libs/re2/re2/testing/regexp_test.cc
@@ -4,14 +4,15 @@
// Test parse.cc, dump.cc, and tostring.cc.
+#include "re2/regexp.h"
+
#include <stddef.h>
+
#include <map>
#include <string>
#include <vector>
#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "re2/regexp.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/testing/required_prefix_test.cc b/contrib/libs/re2/re2/testing/required_prefix_test.cc
index 231fd34856..ab7f4121f8 100644
--- a/contrib/libs/re2/re2/testing/required_prefix_test.cc
+++ b/contrib/libs/re2/re2/testing/required_prefix_test.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include <stddef.h>
+
#include <string>
#include "absl/base/macros.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/prog.h"
#include "re2/regexp.h"
diff --git a/contrib/libs/re2/re2/testing/search_test.cc b/contrib/libs/re2/re2/testing/search_test.cc
index 166652a2db..0d0cb78b1d 100644
--- a/contrib/libs/re2/re2/testing/search_test.cc
+++ b/contrib/libs/re2/re2/testing/search_test.cc
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include <stddef.h>
+
+#include <string>
+#include <vector>
+
#include "absl/base/macros.h"
#include "gtest/gtest.h"
-#include "re2/prog.h"
-#include "re2/regexp.h"
-#include "re2/testing/tester.h"
#include "re2/testing/exhaustive_tester.h"
+#include "re2/testing/tester.h"
// For target `log' in the Makefile.
#ifndef LOGGING
diff --git a/contrib/libs/re2/re2/testing/set_test.cc b/contrib/libs/re2/re2/testing/set_test.cc
index fdbc0b2c74..5962295e28 100644
--- a/contrib/libs/re2/re2/testing/set_test.cc
+++ b/contrib/libs/re2/re2/testing/set_test.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "re2/set.h"
+
#include <stddef.h>
-#include <string>
-#include <vector>
+
#include <utility>
+#include <vector>
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/re2.h"
-#include "re2/set.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/testing/simplify_test.cc b/contrib/libs/re2/re2/testing/simplify_test.cc
index 5b683f580c..efbe967458 100644
--- a/contrib/libs/re2/re2/testing/simplify_test.cc
+++ b/contrib/libs/re2/re2/testing/simplify_test.cc
@@ -5,11 +5,10 @@
// Test simplify.cc.
#include <string.h>
-#include <string>
#include "absl/base/macros.h"
+#include "absl/log/absl_log.h"
#include "gtest/gtest.h"
-#include "util/logging.h"
#include "re2/regexp.h"
namespace re2 {
@@ -264,7 +263,7 @@ static Test tests[] = {
TEST(TestSimplify, SimpleRegexps) {
for (size_t i = 0; i < ABSL_ARRAYSIZE(tests); i++) {
RegexpStatus status;
- VLOG(1) << "Testing " << tests[i].regexp;
+ ABSL_VLOG(1) << "Testing " << tests[i].regexp;
Regexp* re = Regexp::Parse(tests[i].regexp,
Regexp::MatchNL | (Regexp::LikePerl &
~Regexp::OneLine),
diff --git a/contrib/libs/re2/re2/testing/string_generator.cc b/contrib/libs/re2/re2/testing/string_generator.cc
index 1891b14a7a..6e450a9429 100644
--- a/contrib/libs/re2/re2/testing/string_generator.cc
+++ b/contrib/libs/re2/re2/testing/string_generator.cc
@@ -6,14 +6,17 @@
// maxlen letters using the set of letters in alpha.
// Fetch strings using a Java-like Next()/HasNext() interface.
+#include "re2/testing/string_generator.h"
+
#include <stddef.h>
#include <stdint.h>
+
+#include <random>
#include <string>
#include <vector>
-#include "gtest/gtest.h"
-#include "util/logging.h"
-#include "re2/testing/string_generator.h"
+#include "absl/log/absl_check.h"
+#include "absl/strings/string_view.h"
namespace re2 {
@@ -82,7 +85,7 @@ bool StringGenerator::RandomDigits() {
// after computing the string, so that it knows the answer
// for subsequent HasNext() calls.
absl::string_view StringGenerator::Next() {
- CHECK(hasnext_);
+ ABSL_CHECK(hasnext_);
if (generate_null_) {
generate_null_ = false;
sp_ = absl::string_view();
@@ -112,8 +115,8 @@ void StringGenerator::GenerateNULL() {
}
std::string DeBruijnString(int n) {
- CHECK_GE(n, 1);
- CHECK_LE(n, 29);
+ ABSL_CHECK_GE(n, 1);
+ ABSL_CHECK_LE(n, 29);
const size_t size = size_t{1} << static_cast<size_t>(n);
const size_t mask = size - 1;
std::vector<bool> did(size, false);
@@ -131,10 +134,10 @@ std::string DeBruijnString(int n) {
} else {
s += '0';
}
- CHECK(!did[bits]);
+ ABSL_CHECK(!did[bits]);
did[bits] = true;
}
- CHECK_EQ(s.size(), static_cast<size_t>(n - 1) + size);
+ ABSL_CHECK_EQ(s.size(), static_cast<size_t>(n - 1) + size);
return s;
}
diff --git a/contrib/libs/re2/re2/testing/string_generator.h b/contrib/libs/re2/re2/testing/string_generator.h
index 0d6f5fcbad..acdb3d5f1f 100644
--- a/contrib/libs/re2/re2/testing/string_generator.h
+++ b/contrib/libs/re2/re2/testing/string_generator.h
@@ -10,6 +10,7 @@
// Fetch strings using a Java-like Next()/HasNext() interface.
#include <stdint.h>
+
#include <random>
#include <string>
#include <vector>
diff --git a/contrib/libs/re2/re2/testing/string_generator_test.cc b/contrib/libs/re2/re2/testing/string_generator_test.cc
index b1273d9f62..62868d5074 100644
--- a/contrib/libs/re2/re2/testing/string_generator_test.cc
+++ b/contrib/libs/re2/re2/testing/string_generator_test.cc
@@ -4,13 +4,17 @@
// Test StringGenerator.
+#include "re2/testing/string_generator.h"
+
+#include <stddef.h>
#include <stdint.h>
+
#include <string>
+#include "absl/strings/string_view.h"
#include "gtest/gtest.h"
-#include "util/utf.h"
-#include "re2/testing/string_generator.h"
#include "re2/testing/regexp_generator.h"
+#include "util/utf.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/testing/tester.cc b/contrib/libs/re2/re2/testing/tester.cc
index a094cb4ff6..72925e392d 100644
--- a/contrib/libs/re2/re2/testing/tester.cc
+++ b/contrib/libs/re2/re2/testing/tester.cc
@@ -4,20 +4,25 @@
// Regular expression engine tester -- test all the implementations against each other.
+#include "re2/testing/tester.h"
+
#include <stddef.h>
#include <stdint.h>
#include <string.h>
+
#include <string>
#include "absl/base/macros.h"
#include "absl/flags/flag.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
-#include "re2/testing/tester.h"
+#include "absl/strings/string_view.h"
#include "re2/prog.h"
#include "re2/re2.h"
#include "re2/regexp.h"
+#include "util/pcre.h"
ABSL_FLAG(bool, dump_prog, false, "dump regexp program");
ABSL_FLAG(bool, log_okay, false, "log successful runs");
@@ -50,9 +55,9 @@ const char* engine_names[kEngineMax] = {
// Returns the name of the engine.
static const char* EngineName(Engine e) {
- CHECK_GE(e, 0);
- CHECK_LT(e, ABSL_ARRAYSIZE(engine_names));
- CHECK(engine_names[e] != NULL);
+ ABSL_CHECK_GE(e, 0);
+ ABSL_CHECK_LT(e, ABSL_ARRAYSIZE(engine_names));
+ ABSL_CHECK(engine_names[e] != NULL);
return engine_names[e];
}
@@ -73,12 +78,12 @@ static uint32_t Engines() {
}
if (cached_engines == 0)
- LOG(INFO) << "Warning: no engines enabled.";
+ ABSL_LOG(INFO) << "Warning: no engines enabled.";
if (!UsingPCRE)
cached_engines &= ~(1<<kEnginePCRE);
for (Engine i = static_cast<Engine>(0); i < kEngineMax; i++) {
if (cached_engines & (1<<i))
- LOG(INFO) << EngineName(i) << " enabled";
+ ABSL_LOG(INFO) << EngineName(i) << " enabled";
}
did_parse = true;
@@ -196,45 +201,46 @@ TestInstance::TestInstance(absl::string_view regexp_str, Prog::MatchKind kind,
re_(NULL),
re2_(NULL) {
- VLOG(1) << absl::CEscape(regexp_str);
+ ABSL_VLOG(1) << absl::CEscape(regexp_str);
// Compile regexp to prog.
// Always required - needed for backtracking (reference implementation).
RegexpStatus status;
regexp_ = Regexp::Parse(regexp_str, flags, &status);
if (regexp_ == NULL) {
- LOG(INFO) << "Cannot parse: " << absl::CEscape(regexp_str_)
- << " mode: " << FormatMode(flags);
+ ABSL_LOG(INFO) << "Cannot parse: " << absl::CEscape(regexp_str_)
+ << " mode: " << FormatMode(flags);
error_ = true;
return;
}
num_captures_ = regexp_->NumCaptures();
prog_ = regexp_->CompileToProg(0);
if (prog_ == NULL) {
- LOG(INFO) << "Cannot compile: " << absl::CEscape(regexp_str_);
+ ABSL_LOG(INFO) << "Cannot compile: " << absl::CEscape(regexp_str_);
error_ = true;
return;
}
if (absl::GetFlag(FLAGS_dump_prog)) {
- LOG(INFO) << "Prog for "
- << " regexp "
- << absl::CEscape(regexp_str_)
- << " (" << FormatKind(kind_)
- << ", " << FormatMode(flags_)
- << ")\n"
- << prog_->Dump();
+ ABSL_LOG(INFO) << "Prog for "
+ << " regexp "
+ << absl::CEscape(regexp_str_)
+ << " (" << FormatKind(kind_)
+ << ", " << FormatMode(flags_)
+ << ")\n"
+ << prog_->Dump();
}
// Compile regexp to reversed prog. Only needed for DFA engines.
if (Engines() & ((1<<kEngineDFA)|(1<<kEngineDFA1))) {
rprog_ = regexp_->CompileToReverseProg(0);
if (rprog_ == NULL) {
- LOG(INFO) << "Cannot reverse compile: " << absl::CEscape(regexp_str_);
+ ABSL_LOG(INFO) << "Cannot reverse compile: "
+ << absl::CEscape(regexp_str_);
error_ = true;
return;
}
if (absl::GetFlag(FLAGS_dump_rprog))
- LOG(INFO) << rprog_->Dump();
+ ABSL_LOG(INFO) << rprog_->Dump();
}
// Create re string that will be used for RE and RE2.
@@ -257,7 +263,7 @@ TestInstance::TestInstance(absl::string_view regexp_str, Prog::MatchKind kind,
options.set_longest_match(true);
re2_ = new RE2(re, options);
if (!re2_->error().empty()) {
- LOG(INFO) << "Cannot RE2: " << absl::CEscape(re);
+ ABSL_LOG(INFO) << "Cannot RE2: " << absl::CEscape(re);
error_ = true;
return;
}
@@ -283,7 +289,7 @@ TestInstance::TestInstance(absl::string_view regexp_str, Prog::MatchKind kind,
// add one more layer of parens.
re_ = new PCRE("("+re+")", o);
if (!re_->error().empty()) {
- LOG(INFO) << "Cannot PCRE: " << absl::CEscape(re);
+ ABSL_LOG(INFO) << "Cannot PCRE: " << absl::CEscape(re);
error_ = true;
return;
}
@@ -318,7 +324,7 @@ void TestInstance::RunSearch(Engine type, absl::string_view orig_text,
switch (type) {
default:
- LOG(FATAL) << "Bad RunSearch type: " << (int)type;
+ ABSL_LOG(FATAL) << "Bad RunSearch type: " << (int)type;
case kEngineBacktrack:
if (prog_ == NULL) {
@@ -366,9 +372,9 @@ void TestInstance::RunSearch(Engine type, absl::string_view orig_text,
Prog::kAnchored, Prog::kLongestMatch,
result->submatch,
&result->skipped, NULL)) {
- LOG(ERROR) << "Reverse DFA inconsistency: "
- << absl::CEscape(regexp_str_)
- << " on " << absl::CEscape(text);
+ ABSL_LOG(ERROR) << "Reverse DFA inconsistency: "
+ << absl::CEscape(regexp_str_)
+ << " on " << absl::CEscape(text);
result->matched = false;
}
}
@@ -520,16 +526,16 @@ bool TestInstance::RunCase(absl::string_view text, absl::string_view context,
if (correct.skipped) {
if (regexp_ == NULL)
return true;
- LOG(ERROR) << "Skipped backtracking! " << absl::CEscape(regexp_str_)
- << " " << FormatMode(flags_);
+ ABSL_LOG(ERROR) << "Skipped backtracking! " << absl::CEscape(regexp_str_)
+ << " " << FormatMode(flags_);
return false;
}
- VLOG(1) << "Try: regexp " << absl::CEscape(regexp_str_)
- << " text " << absl::CEscape(text)
- << " (" << FormatKind(kind_)
- << ", " << FormatAnchor(anchor)
- << ", " << FormatMode(flags_)
- << ")";
+ ABSL_VLOG(1) << "Try: regexp " << absl::CEscape(regexp_str_)
+ << " text " << absl::CEscape(text)
+ << " (" << FormatKind(kind_)
+ << ", " << FormatAnchor(anchor)
+ << ", " << FormatMode(flags_)
+ << ")";
// Compare the others.
bool all_okay = true;
@@ -560,22 +566,22 @@ bool TestInstance::RunCase(absl::string_view text, absl::string_view context,
context, anchor);
if (r.matched != correct.matched) {
if (r.matched) {
- LOG(INFO) << " Should not match (but does).";
+ ABSL_LOG(INFO) << " Should not match (but does).";
} else {
- LOG(INFO) << " Should match (but does not).";
+ ABSL_LOG(INFO) << " Should match (but does not).";
continue;
}
}
for (int i = 0; i < 1+num_captures_; i++) {
if (r.submatch[i].data() != correct.submatch[i].data() ||
r.submatch[i].size() != correct.submatch[i].size()) {
- LOG(INFO) <<
+ ABSL_LOG(INFO) <<
absl::StrFormat(" $%d: should be %s is %s",
i,
FormatCapture(text, correct.submatch[i]),
FormatCapture(text, r.submatch[i]));
} else {
- LOG(INFO) <<
+ ABSL_LOG(INFO) <<
absl::StrFormat(" $%d: %s ok", i,
FormatCapture(text, r.submatch[i]));
}
@@ -587,7 +593,7 @@ bool TestInstance::RunCase(absl::string_view text, absl::string_view context,
// and that is desirable because we want to enforce a global limit.
static int max_regexp_failures = absl::GetFlag(FLAGS_max_regexp_failures);
if (max_regexp_failures > 0 && --max_regexp_failures == 0)
- LOG(QFATAL) << "Too many regexp failures.";
+ ABSL_LOG(QFATAL) << "Too many regexp failures.";
}
return all_okay;
@@ -596,7 +602,7 @@ bool TestInstance::RunCase(absl::string_view text, absl::string_view context,
void TestInstance::LogMatch(const char* prefix, Engine e,
absl::string_view text, absl::string_view context,
Prog::Anchor anchor) {
- LOG(INFO) << prefix
+ ABSL_LOG(INFO) << prefix
<< EngineName(e)
<< " regexp "
<< absl::CEscape(regexp_str_)
diff --git a/contrib/libs/re2/re2/testing/tester.h b/contrib/libs/re2/re2/testing/tester.h
index 59be5ea0af..9a87138e83 100644
--- a/contrib/libs/re2/re2/testing/tester.h
+++ b/contrib/libs/re2/re2/testing/tester.h
@@ -12,8 +12,8 @@
#include "absl/strings/string_view.h"
#include "re2/prog.h"
-#include "re2/regexp.h"
#include "re2/re2.h"
+#include "re2/regexp.h"
#include "util/pcre.h"
namespace re2 {
diff --git a/contrib/libs/re2/re2/testing/ya.make b/contrib/libs/re2/re2/testing/ya.make
index 362d1b018b..35e2e70096 100644
--- a/contrib/libs/re2/re2/testing/ya.make
+++ b/contrib/libs/re2/re2/testing/ya.make
@@ -10,6 +10,7 @@ PEERDIR(
contrib/libs/re2
contrib/restricted/abseil-cpp/absl/base
contrib/restricted/abseil-cpp/absl/flags
+ contrib/restricted/abseil-cpp/absl/log
contrib/restricted/abseil-cpp/absl/strings
)
diff --git a/contrib/libs/re2/re2/tostring.cc b/contrib/libs/re2/re2/tostring.cc
index 33179fdeb8..24a530e643 100644
--- a/contrib/libs/re2/re2/tostring.cc
+++ b/contrib/libs/re2/re2/tostring.cc
@@ -6,13 +6,14 @@
// Tested by parse_test.cc
#include <string.h>
+
#include <string>
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
-#include "util/utf.h"
#include "re2/regexp.h"
#include "re2/walker-inl.h"
+#include "util/utf.h"
namespace re2 {
@@ -101,7 +102,7 @@ int ToStringWalker::PreVisit(Regexp* re, int parent_arg, bool* stop) {
case kRegexpCapture:
t_->append("(");
if (re->cap() == 0)
- LOG(DFATAL) << "kRegexpCapture cap() == 0";
+ ABSL_LOG(DFATAL) << "kRegexpCapture cap() == 0";
if (re->name()) {
t_->append("?P<");
t_->append(*re->name());
@@ -184,7 +185,7 @@ int ToStringWalker::PostVisit(Regexp* re, int parent_arg, int pre_arg,
if ((*t_)[t_->size()-1] == '|')
t_->erase(t_->size()-1);
else
- LOG(DFATAL) << "Bad final char: " << t_;
+ ABSL_LOG(DFATAL) << "Bad final char: " << t_;
if (prec < PrecAlternate)
t_->append(")");
break;
diff --git a/contrib/libs/re2/re2/walker-inl.h b/contrib/libs/re2/re2/walker-inl.h
index 45763a7b26..2283d6daf4 100644
--- a/contrib/libs/re2/re2/walker-inl.h
+++ b/contrib/libs/re2/re2/walker-inl.h
@@ -16,7 +16,8 @@
#include <stack>
#include "absl/base/macros.h"
-#include "util/logging.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "re2/regexp.h"
namespace re2 {
@@ -147,7 +148,7 @@ template<typename T> Regexp::Walker<T>::~Walker() {
// Logs DFATAL if stack is not already clear.
template<typename T> void Regexp::Walker<T>::Reset() {
if (!stack_.empty()) {
- LOG(DFATAL) << "Stack not empty.";
+ ABSL_LOG(DFATAL) << "Stack not empty.";
while (!stack_.empty()) {
if (stack_.top().re->nsub_ > 1)
delete[] stack_.top().child_args;
@@ -161,7 +162,7 @@ template<typename T> T Regexp::Walker<T>::WalkInternal(Regexp* re, T top_arg,
Reset();
if (re == NULL) {
- LOG(DFATAL) << "Walk NULL";
+ ABSL_LOG(DFATAL) << "Walk NULL";
return top_arg;
}
diff --git a/contrib/libs/re2/util/logging.h b/contrib/libs/re2/util/logging.h
deleted file mode 100644
index 946962b39b..0000000000
--- a/contrib/libs/re2/util/logging.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2009 The RE2 Authors. All Rights Reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#ifndef UTIL_LOGGING_H_
-#define UTIL_LOGGING_H_
-
-// Simplified version of Google's logging.
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ostream>
-#include <sstream>
-
-#include "absl/base/attributes.h"
-
-// Debug-only checking.
-#define DCHECK(condition) assert(condition)
-#define DCHECK_EQ(val1, val2) assert((val1) == (val2))
-#define DCHECK_NE(val1, val2) assert((val1) != (val2))
-#define DCHECK_LE(val1, val2) assert((val1) <= (val2))
-#define DCHECK_LT(val1, val2) assert((val1) < (val2))
-#define DCHECK_GE(val1, val2) assert((val1) >= (val2))
-#define DCHECK_GT(val1, val2) assert((val1) > (val2))
-
-// Always-on checking
-#define CHECK(x) if(x){}else LogMessageFatal(__FILE__, __LINE__).stream() << "Check failed: " #x
-#define CHECK_LT(x, y) CHECK((x) < (y))
-#define CHECK_GT(x, y) CHECK((x) > (y))
-#define CHECK_LE(x, y) CHECK((x) <= (y))
-#define CHECK_GE(x, y) CHECK((x) >= (y))
-#define CHECK_EQ(x, y) CHECK((x) == (y))
-#define CHECK_NE(x, y) CHECK((x) != (y))
-
-#define LOG_INFO LogMessage(__FILE__, __LINE__)
-#define LOG_WARNING LogMessage(__FILE__, __LINE__)
-#define LOG_ERROR LogMessage(__FILE__, __LINE__)
-#define LOG_FATAL LogMessageFatal(__FILE__, __LINE__)
-#define LOG_QFATAL LOG_FATAL
-
-// It seems that one of the Windows header files defines ERROR as 0.
-#ifdef _WIN32
-#define LOG_0 LOG_INFO
-#endif
-
-#ifdef NDEBUG
-#define LOG_DFATAL LOG_ERROR
-#else
-#define LOG_DFATAL LOG_FATAL
-#endif
-
-#define LOG(severity) LOG_ ## severity.stream()
-
-#define VLOG(x) if((x)>0){}else LOG_INFO.stream()
-
-class LogMessage {
- public:
- LogMessage(const char* file, int line)
- : flushed_(false) {
- stream() << file << ":" << line << ": ";
- }
- void Flush() {
- stream() << "\n";
- std::string s = str_.str();
- size_t n = s.size();
- if (fwrite(s.data(), 1, n, stderr) < n) {} // shut up gcc
- flushed_ = true;
- }
- ~LogMessage() {
- if (!flushed_) {
- Flush();
- }
- }
- std::ostream& stream() { return str_; }
-
- private:
- bool flushed_;
- std::ostringstream str_;
-
- LogMessage(const LogMessage&) = delete;
- LogMessage& operator=(const LogMessage&) = delete;
-};
-
-// Silence "destructor never returns" warning for ~LogMessageFatal().
-// Since this is a header file, push and then pop to limit the scope.
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4722)
-#endif
-
-class LogMessageFatal : public LogMessage {
- public:
- LogMessageFatal(const char* file, int line)
- : LogMessage(file, line) {}
- ABSL_ATTRIBUTE_NORETURN ~LogMessageFatal() {
- Flush();
- abort();
- }
- private:
- LogMessageFatal(const LogMessageFatal&) = delete;
- LogMessageFatal& operator=(const LogMessageFatal&) = delete;
-};
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif // UTIL_LOGGING_H_
diff --git a/contrib/libs/re2/util/pcre.cc b/contrib/libs/re2/util/pcre.cc
index 27aee3dc48..94a88b7c94 100644
--- a/contrib/libs/re2/util/pcre.cc
+++ b/contrib/libs/re2/util/pcre.cc
@@ -16,8 +16,9 @@
#include <utility>
#include "absl/flags/flag.h"
+#include "absl/log/absl_check.h"
+#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h"
-#include "util/logging.h"
#include "util/pcre.h"
// Silence warnings about the wacky formatting in the operator() functions.
@@ -25,7 +26,7 @@
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#endif
-#define PCREPORT(level) LOG(level)
+#define PCREPORT(level) ABSL_LOG(level)
// Default PCRE limits.
// Defaults chosen to allow a plausible amount of CPU and
diff --git a/contrib/libs/re2/util/pcre.h b/contrib/libs/re2/util/pcre.h
index 72c02bf8e1..aa63c7db79 100644
--- a/contrib/libs/re2/util/pcre.h
+++ b/contrib/libs/re2/util/pcre.h
@@ -39,10 +39,10 @@
// supplied pattern exactly.
//
// Example: successful match
-// CHECK(PCRE::FullMatch("hello", "h.*o"));
+// ABSL_CHECK(PCRE::FullMatch("hello", "h.*o"));
//
// Example: unsuccessful match (requires full match):
-// CHECK(!PCRE::FullMatch("hello", "e"));
+// ABSL_CHECK(!PCRE::FullMatch("hello", "e"));
//
// -----------------------------------------------------------------------
// UTF-8 AND THE MATCHING INTERFACE:
@@ -58,7 +58,7 @@
//
// Example:
// PCRE re(utf8_pattern, PCRE::UTF8);
-// CHECK(PCRE::FullMatch(utf8_string, re));
+// ABSL_CHECK(PCRE::FullMatch(utf8_string, re));
//
// -----------------------------------------------------------------------
// MATCHING WITH SUBSTRING EXTRACTION:
@@ -68,22 +68,22 @@
// Example: extracts "ruby" into "s" and 1234 into "i"
// int i;
// std::string s;
-// CHECK(PCRE::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i));
+// ABSL_CHECK(PCRE::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i));
//
// Example: fails because string cannot be stored in integer
-// CHECK(!PCRE::FullMatch("ruby", "(.*)", &i));
+// ABSL_CHECK(!PCRE::FullMatch("ruby", "(.*)", &i));
//
// Example: fails because there aren't enough sub-patterns:
-// CHECK(!PCRE::FullMatch("ruby:1234", "\\w+:\\d+", &s));
+// ABSL_CHECK(!PCRE::FullMatch("ruby:1234", "\\w+:\\d+", &s));
//
// Example: does not try to extract any extra sub-patterns
-// CHECK(PCRE::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s));
+// ABSL_CHECK(PCRE::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s));
//
// Example: does not try to extract into NULL
-// CHECK(PCRE::FullMatch("ruby:1234", "(\\w+):(\\d+)", NULL, &i));
+// ABSL_CHECK(PCRE::FullMatch("ruby:1234", "(\\w+):(\\d+)", NULL, &i));
//
// Example: integer overflow causes failure
-// CHECK(!PCRE::FullMatch("ruby:1234567891234", "\\w+:(\\d+)", &i));
+// ABSL_CHECK(!PCRE::FullMatch("ruby:1234567891234", "\\w+:(\\d+)", &i));
//
// -----------------------------------------------------------------------
// PARTIAL MATCHES
@@ -92,12 +92,12 @@
// to match any substring of the text.
//
// Example: simple search for a string:
-// CHECK(PCRE::PartialMatch("hello", "ell"));
+// ABSL_CHECK(PCRE::PartialMatch("hello", "ell"));
//
// Example: find first number in a string
// int number;
-// CHECK(PCRE::PartialMatch("x*100 + 20", "(\\d+)", &number));
-// CHECK_EQ(number, 100);
+// ABSL_CHECK(PCRE::PartialMatch("x*100 + 20", "(\\d+)", &number));
+// ABSL_CHECK_EQ(number, 100);
//
// -----------------------------------------------------------------------
// PPCRE-COMPILED PCREGULAR EXPPCRESSIONS
@@ -157,7 +157,7 @@
//
// Example:
// int a, b, c, d;
-// CHECK(PCRE::FullMatch("100 40 0100 0x40", "(.*) (.*) (.*) (.*)",
+// ABSL_CHECK(PCRE::FullMatch("100 40 0100 0x40", "(.*) (.*) (.*) (.*)",
// Octal(&a), Hex(&b), CRadix(&c), CRadix(&d));
// will leave 64 in a, b, c, and d.
@@ -379,7 +379,7 @@ class PCRE {
// text. E.g.,
//
// std::string s = "yabba dabba doo";
- // CHECK(PCRE::Replace(&s, "b+", "d"));
+ // ABSL_CHECK(PCRE::Replace(&s, "b+", "d"));
//
// will leave "s" containing "yada dabba doo"
//
@@ -393,7 +393,7 @@ class PCRE {
// re-matching. E.g.,
//
// std::string s = "yabba dabba doo";
- // CHECK(PCRE::GlobalReplace(&s, "b+", "d"));
+ // ABSL_CHECK(PCRE::GlobalReplace(&s, "b+", "d"));
//
// will leave "s" containing "yada dada doo"
//
@@ -417,7 +417,7 @@ class PCRE {
// * The @p rewrite string doesn't have any syntax errors
// ('\' followed by anything besides [0-9] and '\').
// Making this test will guarantee that "replace" and "extract"
- // operations won't LOG(ERROR) or fail because of a bad rewrite
+ // operations won't ABSL_LOG(ERROR) or fail because of a bad rewrite
// string.
// @param rewrite The proposed rewrite string.
// @param error An error message is recorded here, iff we return false.
diff --git a/contrib/libs/re2/ya.make b/contrib/libs/re2/ya.make
index e734e2c462..4f1feda74b 100644
--- a/contrib/libs/re2/ya.make
+++ b/contrib/libs/re2/ya.make
@@ -1,4 +1,4 @@
-# Generated by devtools/yamaker from nixpkgs 22.11.
+# Generated by devtools/yamaker from nixpkgs 24.05.
LIBRARY()
@@ -9,14 +9,15 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2024-05-01)
+VERSION(2024-06-01)
-ORIGINAL_SOURCE(https://github.com/google/re2/archive/2024-05-01.tar.gz)
+ORIGINAL_SOURCE(https://github.com/google/re2/archive/2024-06-01.tar.gz)
PEERDIR(
contrib/restricted/abseil-cpp/absl/base
contrib/restricted/abseil-cpp/absl/container
contrib/restricted/abseil-cpp/absl/hash
+ contrib/restricted/abseil-cpp/absl/log
contrib/restricted/abseil-cpp/absl/strings
contrib/restricted/abseil-cpp/absl/synchronization
library/cpp/sanitizer/include