]> granicus.if.org Git - re2c/commitdiff
Fixed Clang warnings -Wswitch-enum and -Wcovered-switch-default.
authorUlya Trofimovich <skvadrik@gmail.com>
Sat, 13 Jul 2019 10:09:39 +0000 (11:09 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Sat, 13 Jul 2019 10:09:39 +0000 (11:09 +0100)
lib/regex_impl.h
lib/regexec_nfa_posix_backward.cc
src/dfa/closure_leftmost.h
src/dfa/closure_posix.h

index 02b4a976264d35183337a834906cd0a2fabb2e0e..23f1d75f6230990cc26c3f798af5fa362c626dd7 100644 (file)
@@ -351,11 +351,8 @@ void update_offsets(simctx_t<history_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()
index 42713ca47ca288b8743fb9d0f67dba99f679215c..14e95642317bde7e298bc2c5af500356546396f2 100644 (file)
@@ -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;
         }
     }
index d830378e29efc84ae590cb3f4901fcec628b194a..09ecfa50e5cf28a49e2a9bca8538293c03bc9147 100644 (file)
@@ -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;
         }
     }
index e4245e0207ce06af2a51932ca357a0980d1fba4c..776b04e06eaf724f3327d52b9473f42e9ed68037 100644 (file)
@@ -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;
         }
     }