From: Ulya Trofimovich Date: Sat, 13 Jul 2019 10:09:39 +0000 (+0100) Subject: Fixed Clang warnings -Wswitch-enum and -Wcovered-switch-default. X-Git-Tag: 1.2~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb5fee06678cb2552989f0ab83d521def385ed36;p=re2c Fixed Clang warnings -Wswitch-enum and -Wcovered-switch-default. --- diff --git a/lib/regex_impl.h b/lib/regex_impl.h index 02b4a976..23f1d75f 100644 --- a/lib/regex_impl.h +++ b/lib/regex_impl.h @@ -351,11 +351,8 @@ void update_offsets(simctx_t &ctx, const conf_t &c, uint32_t id) bool ran_or_fin_t::operator()(const conf_t &c) { - switch (c.state->type) { - case nfa_state_t::RAN: - case nfa_state_t::FIN: return true; - default: return false; - } + return c.state->type == nfa_state_t::RAN + || c.state->type == nfa_state_t::FIN; } void khistory_t::init() diff --git a/lib/regexec_nfa_posix_backward.cc b/lib/regexec_nfa_posix_backward.cc index 42713ca4..14e95642 100644 --- a/lib/regexec_nfa_posix_backward.cc +++ b/lib/regexec_nfa_posix_backward.cc @@ -213,7 +213,8 @@ void closure_simple(psimctx_t &ctx) case nfa_state_t::TAG: stack.push_back(conf_t(x, n->tag.out, 0)); break; - default: + case nfa_state_t::RAN: + case nfa_state_t::FIN: break; } } @@ -383,7 +384,8 @@ bool scan(psimctx_t &ctx, nfa_state_t *q, bool all) ++q->arcidx; } break; - default: + case nfa_state_t::RAN: + case nfa_state_t::FIN: break; } @@ -471,7 +473,8 @@ void closure_posix_gtop(psimctx_t &ctx) copy_offs(ctx, q, q->tag.out, q->tag.info); relax_gtop(ctx, conf_t(x, q->tag.out, 0)); break; - default: + case nfa_state_t::RAN: + case nfa_state_t::FIN: break; } } diff --git a/src/dfa/closure_leftmost.h b/src/dfa/closure_leftmost.h index d830378e..09ecfa50 100644 --- a/src/dfa/closure_leftmost.h +++ b/src/dfa/closure_leftmost.h @@ -44,7 +44,8 @@ void closure_leftmost_dfs(ctx_t &ctx) case nfa_state_t::TAG: stack.push_back(conf_t(x, n->tag.out, ctx.history.link(ctx, x))); break; - default: + case nfa_state_t::RAN: + case nfa_state_t::FIN: break; } } diff --git a/src/dfa/closure_posix.h b/src/dfa/closure_posix.h index e4245e02..776b04e0 100644 --- a/src/dfa/closure_posix.h +++ b/src/dfa/closure_posix.h @@ -37,7 +37,6 @@ inline void closure_posix(pdetctx_t &ctx) switch (ctx.dc_opts->posix_closure) { case POSIX_CLOSURE_GOR1: closure_posix_gor1(ctx); break; case POSIX_CLOSURE_GTOP: closure_posix_gtop(ctx); break; - default: DASSERT(false); break; } DDUMP_CLSTATS(ctx); @@ -170,7 +169,8 @@ bool scan(ctx_t &ctx, nfa_state_t *q, bool all) ++q->arcidx; } break; - default: + case nfa_state_t::RAN: + case nfa_state_t::FIN: break; } @@ -266,7 +266,8 @@ void closure_posix_gtop(ctx_t &ctx) case nfa_state_t::TAG: relax_gtop(ctx, conf_t(x, q->tag.out, ctx.history.link(ctx, x))); break; - default: + case nfa_state_t::RAN: + case nfa_state_t::FIN: break; } }