diff --git a/BUILD.bazel b/BUILD.bazel index c765cfd51..643d71f3f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -135,6 +135,7 @@ cc_library( ":re2", "@abseil-cpp//absl/base", "@abseil-cpp//absl/base:core_headers", + "@abseil-cpp//absl/container:flat_hash_set", "@abseil-cpp//absl/flags:flag", "@abseil-cpp//absl/log:absl_check", "@abseil-cpp//absl/log:absl_log", diff --git a/re2/bitmap256.h b/re2/bitmap256.h index e16a570a5..e303e7155 100644 --- a/re2/bitmap256.h +++ b/re2/bitmap256.h @@ -51,7 +51,7 @@ class Bitmap256 { private: // Finds the least significant non-zero bit in n. static int FindLSBSet(uint64_t n) { - ABSL_DCHECK_NE(n, 0); + ABSL_DCHECK_NE(n, uint64_t{0}); #if defined(__GNUC__) return __builtin_ctzll(n); #elif defined(_MSC_VER) && defined(_M_X64) diff --git a/re2/prog.cc b/re2/prog.cc index d3ff26eff..9f1cc0082 100644 --- a/re2/prog.cc +++ b/re2/prog.cc @@ -37,13 +37,13 @@ namespace re2 { // Constructors per Inst opcode void Prog::Inst::InitAlt(uint32_t out, uint32_t out1) { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_out_opcode(out, kInstAlt); out1_ = out1; } void Prog::Inst::InitByteRange(int lo, int hi, int foldcase, uint32_t out) { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_out_opcode(out, kInstByteRange); lo_ = lo & 0xFF; hi_ = hi & 0xFF; @@ -51,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) { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_out_opcode(out, kInstCapture); cap_ = cap; } void Prog::Inst::InitEmptyWidth(EmptyOp empty, uint32_t out) { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_out_opcode(out, kInstEmptyWidth); empty_ = empty; } void Prog::Inst::InitMatch(int32_t id) { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_opcode(kInstMatch); match_id_ = id; } void Prog::Inst::InitNop(uint32_t out) { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_opcode(kInstNop); } void Prog::Inst::InitFail() { - ABSL_DCHECK_EQ(out_opcode_, 0); + ABSL_DCHECK_EQ(out_opcode_, uint32_t{0}); set_opcode(kInstFail); } @@ -1113,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) { - ABSL_DCHECK_NE(n, 0); + ABSL_DCHECK_NE(n, uint32_t{0}); #if defined(__GNUC__) return __builtin_ctz(n); #elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) @@ -1135,7 +1135,7 @@ static int FindLSBSet(uint32_t n) { #endif const void* Prog::PrefixAccel_FrontAndBack(const void* data, size_t size) { - ABSL_DCHECK_GE(prefix_size_, 2); + ABSL_DCHECK_GE(prefix_size_, size_t{2}); if (size < prefix_size_) return NULL; // Don't bother searching the last prefix_size_-1 bytes for prefix_front_. diff --git a/re2/re2.cc b/re2/re2.cc index 2e25b64f3..5978035ea 100644 --- a/re2/re2.cc +++ b/re2/re2.cc @@ -332,7 +332,7 @@ int RE2::ReverseProgramSize() const { // Finds the most significant non-zero bit in n. static int FindMSBSet(uint32_t n) { - ABSL_DCHECK_NE(n, 0); + ABSL_DCHECK_NE(n, uint32_t{0}); #if defined(__GNUC__) return 31 ^ __builtin_clz(n); #elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) diff --git a/re2/regexp.cc b/re2/regexp.cc index 1e5ae9071..f7e5ba297 100644 --- a/re2/regexp.cc +++ b/re2/regexp.cc @@ -498,7 +498,7 @@ bool Regexp::Equal(Regexp* a, Regexp* b) { if (n == 0) break; - ABSL_DCHECK_GE(n, 2); + ABSL_DCHECK_GE(n, size_t{2}); a = stk[n-2]; b = stk[n-1]; stk.resize(n-2);