]> granicus.if.org Git - re2c/commitdiff
Eh, some of the asserts were doing useful work and affecting control flow.
authorUlya Trofimovich <skvadrik@gmail.com>
Sun, 30 Dec 2018 23:30:28 +0000 (23:30 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Sun, 30 Dec 2018 23:30:28 +0000 (23:30 +0000)
re2c/src/dfa/determinization.cc
re2c/src/dfa/tcmd.cc
re2c/src/skeleton/skeleton.cc

index 93174f20ac94fb106b829973550c16666899754c..c06eef6fb4bc9b1dc81035c46079af65f35ee11e 100644 (file)
@@ -113,10 +113,11 @@ uint32_t init_tag_versions(determ_context_t &ctx)
     const size_t ntags = dfa.tags.size();
 
     // all-zero tag configuration must have static number zero
+    ctx.dc_tagvertbl.insert_const(TAGVER_ZERO);
     DASSERT(ZERO_TAGS == ctx.dc_tagvertbl.insert_const(TAGVER_ZERO));
 
     // initial tag versions: [1 .. N]
-    const uint32_t INITIAL_TAGS = ctx.dc_tagvertbl.insert_succ(1);
+    const tcid_t INITIAL_TAGS = ctx.dc_tagvertbl.insert_succ(1);
 
     // other versions: [ .. -(N + 1)] and [N + 1 .. ]
     dfa.maxtagver = static_cast<tagver_t>(ntags);
index 216d6b403efcae7e404e098f5ae8763bcdefb860..5c6a87f7dd718a3e1b629888862d8970852b14d2 100644 (file)
@@ -128,6 +128,7 @@ tcpool_t::tcpool_t()
     , index()
 {
     // empty command must have static number zero
+    insert(NULL);
     DASSERT(TCID0 == insert(NULL));
 }
 
index 817c7a72c35e86af17a4b841400e0af25cb20c50..52529ecb7237d29f7c59a7a336f3042c64febecd 100644 (file)
@@ -96,12 +96,14 @@ Skeleton::~Skeleton()
 uint64_t rule2key(size_t rule, size_t key, size_t def)
 {
     switch (key) {
-        default: DASSERT(false); // shouldn't happen
         case 8: return rule2key<uint64_t>(rule, def);
         case 4: return rule2key<uint32_t>(rule, def);
         case 2: return rule2key<uint16_t>(rule, def);
         case 1: return rule2key<uint8_t>(rule, def);
     }
+    // shouldn't happen
+    DASSERT(false);
+    return 0;
 }
 
 } // namespace re2c