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 d47c7d5..55def2b 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -1675,8 +1675,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 85f16f0..d7a9fe5 100644
--- a/re2/parse.cc
+++ b/re2/parse.cc
@@ -1589,8 +1589,6 @@
// return true;
}
- LOG(DFATAL) << "Not reached in ParseEscape.";
-
BadEscape:
// Unrecognized escape sequence.
status->set_code(kRegexpBadEscape);
@@ -2059,8 +2057,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 a47b312..a8af821 100644
--- a/re2/prefilter.cc
+++ b/re2/prefilter.cc
@@ -532,8 +532,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 a700d35..3b9596a 100644
--- a/re2/prog.cc
+++ b/re2/prog.cc
@@ -511,7 +511,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 1870566..fe0ea05 100644
--- a/re2/set.cc
+++ b/re2/set.cc
@@ -128,9 +128,9 @@
bool RE2::Set::Match(const StringPiece& 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
@@ -161,9 +161,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 663d5fc..0df9051 100644
--- a/re2/simplify.cc
+++ b/re2/simplify.cc
@@ -371,8 +371,8 @@
break;
default:
- LOG(DFATAL) << "DoCoalesce failed: r1->op() is " << r1->op();
nre->Decref();
+ LOG(DFATAL) << "DoCoalesce failed: r1->op() is " << r1->op();
return;
}
@@ -432,8 +432,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 60370. 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/+/60370
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 60370. To unsubscribe, or for help writing mail filters, visit settings.