From: Ulya Trofimovich Date: Wed, 18 May 2016 15:57:40 +0000 (+0100) Subject: There's no use in looping twice when tracing default paths. X-Git-Tag: 1.0~39^2~292 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=312a54ba949dff8bb39eb6eeead9310200671ce7;p=re2c There's no use in looping twice when tracing default paths. --- diff --git a/re2c/src/ir/skeleton/control_flow.cc b/re2c/src/ir/skeleton/control_flow.cc index 36a0956d..7124c1a7 100644 --- a/re2c/src/ir/skeleton/control_flow.cc +++ b/re2c/src/ir/skeleton/control_flow.cc @@ -1,3 +1,4 @@ +#include #include #include "src/conf/warn.h" @@ -19,7 +20,7 @@ typedef u32lim_t<1024> ucf_size_t; // ~1Kb // UCF stands for 'undefined control flow' struct ucf_t { - std::vector loops; + std::valarray loops; std::vector paths; path_t prefix; ucf_size_t size; @@ -36,7 +37,7 @@ static void naked_paths( size_t i) { const Node &node = skel.nodes[i]; - uint8_t &loop = ucf.loops[i]; + bool &loop = ucf.loops[i]; path_t &prefix = ucf.prefix; ucf_size_t &size = ucf.size; @@ -45,8 +46,8 @@ static void naked_paths( } else if (node.end()) { ucf.paths.push_back(prefix); size = size + ucf_size_t::from64(prefix.len()); - } else if (loop < 2) { - local_inc _(loop); + } else if (!loop) { + loop = true; Node::arcsets_t::const_iterator arc = node.arcsets.begin(), end = node.arcsets.end(); diff --git a/re2c/test/input2.b.c b/re2c/test/input2.b.c index a4cf343a..f04e9543 100644 --- a/re2c/test/input2.b.c +++ b/re2c/test/input2.b.c @@ -65,7 +65,5 @@ yy3: re2c: warning: line 5: control flow is undefined for strings that match '[\x0-\x60\x62-\xFF]' '\x61 [\x0-\x60\x63-\xFF]' - '\x61 \x61 [\x0-\x60\x63-\xFF]' '\x61 \x62 [\x0-\x61\x63-\xFF]' - '\x61 \x61 \x62 [\x0-\x61\x63-\xFF]' , use default rule '*' [-Wundefined-control-flow] diff --git a/re2c/test/input2.c b/re2c/test/input2.c index 4304bc3b..c93767ac 100644 --- a/re2c/test/input2.c +++ b/re2c/test/input2.c @@ -37,7 +37,5 @@ yy6: re2c: warning: line 5: control flow is undefined for strings that match '[\x0-\x60\x62-\xFF]' '\x61 [\x0-\x60\x63-\xFF]' - '\x61 \x61 [\x0-\x60\x63-\xFF]' '\x61 \x62 [\x0-\x61\x63-\xFF]' - '\x61 \x61 \x62 [\x0-\x61\x63-\xFF]' , use default rule '*' [-Wundefined-control-flow] diff --git a/re2c/test/input3.c b/re2c/test/input3.c index f3871c1d..163aeee5 100644 --- a/re2c/test/input3.c +++ b/re2c/test/input3.c @@ -37,7 +37,5 @@ yy6: re2c: warning: line 5: control flow is undefined for strings that match '[\x0-\x60\x62-\xFF]' '\x61 [\x0-\x60\x63-\xFF]' - '\x61 \x61 [\x0-\x60\x63-\xFF]' '\x61 \x62 [\x0-\x61\x63-\xFF]' - '\x61 \x61 \x62 [\x0-\x61\x63-\xFF]' , use default rule '*' [-Wundefined-control-flow]