mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-16 09:21:52 +03:00
Fix unreadVariable warning
This commit is contained in:
@@ -304,6 +304,7 @@ void minimize_hopcroft(raw_dfa &rdfa, const Grey &grey) {
|
||||
DEBUG_PRINTF("dfa is empty\n");
|
||||
}
|
||||
|
||||
// cppcheck-suppress unreadVariable
|
||||
UNUSED const size_t states_before = rdfa.states.size();
|
||||
|
||||
HopcroftInfo info(rdfa);
|
||||
|
||||
@@ -802,7 +802,7 @@ private:
|
||||
|
||||
static
|
||||
void prep_joins_for_generation(const GoughGraph &g, GoughVertex v,
|
||||
map<GoughEdge, edge_join_info> *edge_info) {
|
||||
map<GoughEdge, edge_join_info> &edge_info) {
|
||||
DEBUG_PRINTF("writing out joins for %u\n", g[v].state_id);
|
||||
for (const auto &var : g[v].vars) {
|
||||
u32 dest_slot = var->slot;
|
||||
@@ -813,7 +813,7 @@ void prep_joins_for_generation(const GoughGraph &g, GoughVertex v,
|
||||
}
|
||||
|
||||
for (const GoughEdge &incoming_edge : var_edges.second) {
|
||||
(*edge_info)[incoming_edge].insert(input, dest_slot);
|
||||
edge_info[incoming_edge].insert(input, dest_slot);
|
||||
DEBUG_PRINTF("need %u<-%u\n", dest_slot, input);
|
||||
}
|
||||
}
|
||||
@@ -911,7 +911,7 @@ void build_blocks(const GoughGraph &g,
|
||||
}
|
||||
|
||||
map<GoughEdge, edge_join_info> eji;
|
||||
prep_joins_for_generation(g, t, &eji);
|
||||
prep_joins_for_generation(g, t, eji);
|
||||
|
||||
for (auto &m : eji) {
|
||||
vector<gough_ins> &block = (*blocks)[gough_edge_id(g, m.first)];
|
||||
|
||||
@@ -1018,12 +1018,16 @@ bytecode_ptr<NFA> mcshengCompile16(dfa_info &info, dstate_id_t sheng_end,
|
||||
|
||||
// Sherman optimization
|
||||
if (info.impl_alpha_size > 16) {
|
||||
#ifdef DEBUG
|
||||
u16 total_daddy = 0;
|
||||
#endif // DEBUG
|
||||
for (u32 i = 0; i < info.size(); i++) {
|
||||
find_better_daddy(info, i,
|
||||
is_cyclic_near(info.raw, info.raw.start_anchored),
|
||||
grey);
|
||||
#ifdef DEBUG
|
||||
total_daddy += info.extra[i].daddytaken;
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
|
||||
@@ -1172,12 +1176,16 @@ bytecode_ptr<NFA> mcsheng64Compile16(dfa_info&info, dstate_id_t sheng_end,
|
||||
|
||||
// Sherman optimization
|
||||
if (info.impl_alpha_size > 16) {
|
||||
#ifdef DEBUG
|
||||
u16 total_daddy = 0;
|
||||
#endif // DEBUG
|
||||
for (u32 i = 0; i < info.size(); i++) {
|
||||
find_better_daddy(info, i,
|
||||
is_cyclic_near(info.raw, info.raw.start_anchored),
|
||||
grey);
|
||||
#ifdef DEBUG
|
||||
total_daddy += info.extra[i].daddytaken;
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
|
||||
@@ -1430,11 +1438,9 @@ bytecode_ptr<NFA> mcshengCompile(raw_dfa &raw, const CompileContext &cc,
|
||||
|
||||
map<dstate_id_t, AccelScheme> accel_escape_info
|
||||
= info.strat.getAccelInfo(cc.grey);
|
||||
auto old_states = info.states;
|
||||
dstate_id_t sheng_end = find_sheng_states(info, accel_escape_info, MAX_SHENG_STATES);
|
||||
|
||||
if (sheng_end <= DEAD_STATE + 1) {
|
||||
info.states = old_states;
|
||||
return bytecode_ptr<NFA>(nullptr);
|
||||
}
|
||||
|
||||
@@ -1447,7 +1453,6 @@ bytecode_ptr<NFA> mcshengCompile(raw_dfa &raw, const CompileContext &cc,
|
||||
}
|
||||
|
||||
if (!nfa) {
|
||||
info.states = old_states;
|
||||
return nfa;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,10 @@ void q_skip_forward_to(struct mq *q, s64a min_loc) {
|
||||
// Dump the contents of the given queue.
|
||||
static never_inline UNUSED
|
||||
void debugQueue(const struct mq *q) {
|
||||
if (q == nullptr) {
|
||||
DEBUG_PRINTF("q=NULL!\n");
|
||||
return;
|
||||
}
|
||||
DEBUG_PRINTF("q=%p, nfa=%p\n", q, q->nfa);
|
||||
DEBUG_PRINTF("q offset=%llu, buf={%p, len=%zu}, history={%p, len=%zu}\n",
|
||||
q->offset, q->buffer, q->length, q->history, q->hlength);
|
||||
|
||||
@@ -800,7 +800,7 @@ bytecode_ptr<NFA> sheng64Compile(raw_dfa &raw, const CompileContext &cc,
|
||||
old_states = info.states;
|
||||
auto nfa = shengCompile_int<sheng64>(raw, cc, accel_states, strat, info);
|
||||
if (!nfa) {
|
||||
info.states = old_states;
|
||||
info.states = old_states; // cppcheck-suppress unreadVariable
|
||||
}
|
||||
return nfa;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user