Paul Wankadia has uploaded this change for review.
Address some more `-Wunreachable-code` warnings.
Fixes #384.
Change-Id: I6b9e6e84017f78338ea0f916932a1af0c2668fa6
---
M re2/dfa.cc
M re2/parse.cc
M re2/prefilter.cc
M re2/prog.cc
M re2/set.cc
M re2/simplify.cc
6 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/re2/dfa.cc b/re2/dfa.cc
index 57256e4..334732e 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -1677,8 +1677,8 @@
if (!AnalyzeSearchHelper(params, info, flags)) {
ResetCache(params->cache_lock);
if (!AnalyzeSearchHelper(params, info, flags)) {
- LOG(DFATAL) << "Failed to analyze start state.";
params->failed = true;
+ LOG(DFATAL) << "Failed to analyze start state.";
return false;
}
}
diff --git a/re2/parse.cc b/re2/parse.cc
index bce76fb..67a4857 100644
--- a/re2/parse.cc
+++ b/re2/parse.cc
@@ -1586,8 +1586,6 @@
// return true;
}
- LOG(DFATAL) << "Not reached in ParseEscape.";
-
BadEscape:
// Unrecognized escape sequence.
status->set_code(kRegexpBadEscape);
@@ -2056,8 +2054,8 @@
// Caller is supposed to check this.
if (!(flags_ & PerlX) || t.size() < 2 || t[0] != '(' || t[1] != '?') {
- LOG(DFATAL) << "Bad call to ParseState::ParsePerlFlags";
status_->set_code(kRegexpInternalError);
+ LOG(DFATAL) << "Bad call to ParseState::ParsePerlFlags";
return false;
}
diff --git a/re2/prefilter.cc b/re2/prefilter.cc
index 0780d00..bb59619 100644
--- a/re2/prefilter.cc
+++ b/re2/prefilter.cc
@@ -531,8 +531,8 @@
switch (re->op()) {
default:
case kRegexpRepeat:
- LOG(DFATAL) << "Bad regexp op " << re->op();
info = EmptyString();
+ LOG(DFATAL) << "Bad regexp op " << re->op();
break;
case kRegexpNoMatch:
diff --git a/re2/prog.cc b/re2/prog.cc
index 9959f7c..6cadcfa 100644
--- a/re2/prog.cc
+++ b/re2/prog.cc
@@ -510,7 +510,7 @@
builder.Build(bytemap_, &bytemap_range_);
- if (0) { // For debugging, use trivial bytemap.
+ if ((0)) { // For debugging, use trivial bytemap.
LOG(ERROR) << "Using trivial bytemap.";
for (int i = 0; i < 256; i++)
bytemap_[i] = static_cast<uint8_t>(i);
diff --git a/re2/set.cc b/re2/set.cc
index c14ef29..b9c918e 100644
--- a/re2/set.cc
+++ b/re2/set.cc
@@ -126,9 +126,9 @@
bool RE2::Set::Match(absl::string_view text, std::vector<int>* v,
ErrorInfo* error_info) const {
if (!compiled_) {
- LOG(DFATAL) << "RE2::Set::Match() called before compiling";
if (error_info != NULL)
error_info->kind = kNotCompiled;
+ LOG(DFATAL) << "RE2::Set::Match() called before compiling";
return false;
}
#ifdef RE2_HAVE_THREAD_LOCAL
@@ -159,9 +159,9 @@
}
if (v != NULL) {
if (matches->empty()) {
- LOG(DFATAL) << "RE2::Set::Match() matched, but no matches returned?!";
if (error_info != NULL)
error_info->kind = kInconsistent;
+ LOG(DFATAL) << "RE2::Set::Match() matched, but no matches returned?!";
return false;
}
v->assign(matches->begin(), matches->end());
diff --git a/re2/simplify.cc b/re2/simplify.cc
index eea3bd7..8cd10cf 100644
--- a/re2/simplify.cc
+++ b/re2/simplify.cc
@@ -370,8 +370,8 @@
break;
default:
- LOG(DFATAL) << "DoCoalesce failed: r1->op() is " << r1->op();
nre->Decref();
+ LOG(DFATAL) << "DoCoalesce failed: r1->op() is " << r1->op();
return;
}
@@ -431,8 +431,8 @@
}
default:
- LOG(DFATAL) << "DoCoalesce failed: r2->op() is " << r2->op();
nre->Decref();
+ LOG(DFATAL) << "DoCoalesce failed: r2->op() is " << r2->op();
return;
}
To view, visit change 60371. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Paul Wankadia.
Patch set 1:Code-Review +1
Patch set 1:Code-Review +2
Paul Wankadia submitted this change.
Address some more `-Wunreachable-code` warnings.
Fixes #384.
Change-Id: I6b9e6e84017f78338ea0f916932a1af0c2668fa6
Reviewed-on: https://code-review.googlesource.com/c/re2/+/60371
Reviewed-by: Perry Lorier <per...@google.com>
Reviewed-by: Paul Wankadia <jun...@google.com>
---
M re2/dfa.cc
M re2/parse.cc
M re2/prefilter.cc
M re2/prog.cc
M re2/set.cc
M re2/simplify.cc
6 files changed, 22 insertions(+), 10 deletions(-)
To view, visit change 60371. To unsubscribe, or for help writing mail filters, visit settings.