From: Ulya Trofimovich Date: Sun, 30 Dec 2018 23:30:28 +0000 (+0000) Subject: Eh, some of the asserts were doing useful work and affecting control flow. X-Git-Tag: 1.2~265 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f66853e57d33f1612517e0b22621f4aa798cf500;p=re2c Eh, some of the asserts were doing useful work and affecting control flow. --- diff --git a/re2c/src/dfa/determinization.cc b/re2c/src/dfa/determinization.cc index 93174f20..c06eef6f 100644 --- a/re2c/src/dfa/determinization.cc +++ b/re2c/src/dfa/determinization.cc @@ -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(ntags); diff --git a/re2c/src/dfa/tcmd.cc b/re2c/src/dfa/tcmd.cc index 216d6b40..5c6a87f7 100644 --- a/re2c/src/dfa/tcmd.cc +++ b/re2c/src/dfa/tcmd.cc @@ -128,6 +128,7 @@ tcpool_t::tcpool_t() , index() { // empty command must have static number zero + insert(NULL); DASSERT(TCID0 == insert(NULL)); } diff --git a/re2c/src/skeleton/skeleton.cc b/re2c/src/skeleton/skeleton.cc index 817c7a72..52529ecb 100644 --- a/re2c/src/skeleton/skeleton.cc +++ b/re2c/src/skeleton/skeleton.cc @@ -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(rule, def); case 4: return rule2key(rule, def); case 2: return rule2key(rule, def); case 1: return rule2key(rule, def); } + // shouldn't happen + DASSERT(false); + return 0; } } // namespace re2c