Merge pull request #262 from isildur-g/wip-isildur-g-cppcheck-47-48-58

addressing 47,48,58
This commit is contained in:
Konstantinos Margaritis 2024-05-01 17:39:42 +03:00 committed by GitHub
commit 9fdbdac06c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 147 additions and 147 deletions

View File

@ -129,8 +129,8 @@ static void run_benchmarks(int size, int loops, int max_matches,
} }
} }
int main() { int main(){
int matches[] = {0, MAX_MATCHES}; const int matches[] = {0, MAX_MATCHES};
std::vector<size_t> sizes; std::vector<size_t> sizes;
for (size_t i = 0; i < N; i++) for (size_t i = 0; i < N; i++)
sizes.push_back(16000 << i * 2); sizes.push_back(16000 << i * 2);

View File

@ -389,7 +389,7 @@ public:
// Close all open Hyperscan streams (potentially generating any // Close all open Hyperscan streams (potentially generating any
// end-anchored matches) // end-anchored matches)
void closeStreams() { void closeStreams() {
for (auto &stream : streams) { for (const auto &stream : streams) {
hs_error_t err = hs_error_t err =
hs_close_stream(stream, scratch, onMatch, &matchCount); hs_close_stream(stream, scratch, onMatch, &matchCount);
if (err != HS_SUCCESS) { if (err != HS_SUCCESS) {
@ -565,7 +565,7 @@ double measure_block_time(Benchmark &bench, unsigned int repeatCount) {
} }
static static
double eval_set(Benchmark &bench, Sigdata &sigs, unsigned int mode, double eval_set(Benchmark &bench, const Sigdata &sigs, unsigned int mode,
unsigned repeatCount, Criterion criterion, unsigned repeatCount, Criterion criterion,
bool diagnose = true) { bool diagnose = true) {
double compileTime = 0; double compileTime = 0;

View File

@ -281,7 +281,7 @@ public:
// Close all open Hyperscan streams (potentially generating any // Close all open Hyperscan streams (potentially generating any
// end-anchored matches) // end-anchored matches)
void closeStreams() { void closeStreams() {
for (auto &stream : streams) { for (const auto &stream : streams) {
hs_error_t err = hs_close_stream(stream, scratch, onMatch, hs_error_t err = hs_close_stream(stream, scratch, onMatch,
&matchCount); &matchCount);
if (err != HS_SUCCESS) { if (err != HS_SUCCESS) {

View File

@ -159,7 +159,7 @@ bytecode_ptr<FDRConfirm> getFDRConfirm(const vector<hwlmLiteral> &lits,
map<u32, vector<LiteralIndex> > res2lits; map<u32, vector<LiteralIndex> > res2lits;
hwlm_group_t gm = 0; hwlm_group_t gm = 0;
for (LiteralIndex i = 0; i < lits.size(); i++) { for (LiteralIndex i = 0; i < lits.size(); i++) {
LitInfo & li = tmpLitInfo[i]; const LitInfo & li = tmpLitInfo[i];
u32 hash = CONF_HASH_CALL(li.v, andmsk, mult, nBits); u32 hash = CONF_HASH_CALL(li.v, andmsk, mult, nBits);
DEBUG_PRINTF("%016llx --> %u\n", li.v, hash); DEBUG_PRINTF("%016llx --> %u\n", li.v, hash);
res2lits[hash].emplace_back(i); res2lits[hash].emplace_back(i);

View File

@ -622,7 +622,7 @@ bytecode_ptr<FDR> TeddyCompiler::build() {
static static
bool assignStringsToBuckets( bool assignStringsToBuckets(
const vector<hwlmLiteral> &lits, const vector<hwlmLiteral> &lits,
TeddyEngineDescription &eng, const TeddyEngineDescription &eng,
map<BucketIndex, vector<LiteralIndex>> &bucketToLits) { map<BucketIndex, vector<LiteralIndex>> &bucketToLits) {
assert(eng.numMasks <= MAX_NUM_MASKS); assert(eng.numMasks <= MAX_NUM_MASKS);
if (lits.size() > eng.getNumBuckets() * TEDDY_BUCKET_LOAD) { if (lits.size() > eng.getNumBuckets() * TEDDY_BUCKET_LOAD) {

View File

@ -1017,7 +1017,7 @@ void update_accel_prog_offset(const gough_build_strat &gbs,
verts[gbs.gg[v].state_id] = v; verts[gbs.gg[v].state_id] = v;
} }
for (auto &m : gbs.built_accel) { for (const auto &m : gbs.built_accel) {
gough_accel *ga = m.first; gough_accel *ga = m.first;
assert(!ga->prog_offset); assert(!ga->prog_offset);
GoughVertex v = verts[m.second]; GoughVertex v = verts[m.second];

View File

@ -438,7 +438,7 @@ void create_slot_mapping(const GoughGraph &cfg, UNUSED u32 old_slot_count,
} }
static static
void update_local_slots(GoughGraph &g, set<GoughSSAVar *> &locals, void update_local_slots(GoughGraph &g, const set<GoughSSAVar *> &locals,
u32 local_base) { u32 local_base) {
DEBUG_PRINTF("%zu local variables\n", locals.size()); DEBUG_PRINTF("%zu local variables\n", locals.size());
/* local variables only occur on edges (joins are never local) */ /* local variables only occur on edges (joins are never local) */

View File

@ -361,7 +361,7 @@ struct raw_report_list {
raw_report_list(const flat_set<ReportID> &reports_in, raw_report_list(const flat_set<ReportID> &reports_in,
const ReportManager &rm, bool do_remap) { const ReportManager &rm, bool do_remap) {
if (do_remap) { if (do_remap) {
for (auto &id : reports_in) { for (const auto &id : reports_in) {
reports.insert(rm.getProgramOffset(id)); reports.insert(rm.getProgramOffset(id));
} }
} else { } else {
@ -540,7 +540,7 @@ size_t calcWideRegionSize(const dfa_info &info) {
static static
void fillInAux(mstate_aux *aux, dstate_id_t i, const dfa_info &info, void fillInAux(mstate_aux *aux, dstate_id_t i, const dfa_info &info,
const vector<u32> &reports, const vector<u32> &reports_eod, const vector<u32> &reports, const vector<u32> &reports_eod,
vector<u32> &reportOffsets) { const vector<u32> &reportOffsets) {
const dstate &raw_state = info.states[i]; const dstate &raw_state = info.states[i];
aux->accept = raw_state.reports.empty() ? 0 : reportOffsets[reports[i]]; aux->accept = raw_state.reports.empty() ? 0 : reportOffsets[reports[i]];
aux->accept_eod = raw_state.reports_eod.empty() ? 0 aux->accept_eod = raw_state.reports_eod.empty() ? 0
@ -794,8 +794,8 @@ bytecode_ptr<NFA> mcclellanCompile16(dfa_info &info, const CompileContext &cc,
} }
for (size_t i : order) { for (size_t i : order) {
vector<dstate_id_t> &state_chain = info.wide_state_chain[i]; const vector<dstate_id_t> &state_chain = info.wide_state_chain[i];
vector<symbol_t> &symbol_chain = info.wide_symbol_chain[i]; const vector<symbol_t> &symbol_chain = info.wide_symbol_chain[i];
u16 width = verify_u16(symbol_chain.size()); u16 width = verify_u16(symbol_chain.size());
*(u16 *)(curr_wide_entry + WIDE_WIDTH_OFFSET) = width; *(u16 *)(curr_wide_entry + WIDE_WIDTH_OFFSET) = width;
@ -1367,11 +1367,11 @@ bool store_chain_longest(vector<vector<dstate_id_t>> &candidate_chain,
/* \brief Generate wide_symbol_chain from wide_state_chain. */ /* \brief Generate wide_symbol_chain from wide_state_chain. */
static static
void generate_symbol_chain(dfa_info &info, vector<symbol_t> &chain_tail) { void generate_symbol_chain(dfa_info &info, vector<symbol_t> &chain_tail) {
raw_dfa &rdfa = info.raw; const raw_dfa &rdfa = info.raw;
assert(chain_tail.size() == info.wide_state_chain.size()); assert(chain_tail.size() == info.wide_state_chain.size());
for (size_t i = 0; i < info.wide_state_chain.size(); i++) { for (size_t i = 0; i < info.wide_state_chain.size(); i++) {
vector<dstate_id_t> &state_chain = info.wide_state_chain[i]; const vector<dstate_id_t> &state_chain = info.wide_state_chain[i];
vector<symbol_t> symbol_chain; vector<symbol_t> symbol_chain;
info.extra[state_chain[0]].wideHead = true; info.extra[state_chain[0]].wideHead = true;

View File

@ -955,7 +955,7 @@ bool is_cyclic_near(const raw_dfa &raw, dstate_id_t root) {
} }
static static
void fill_in_sherman(NFA *nfa, dfa_info &info, UNUSED u16 sherman_limit) { void fill_in_sherman(NFA *nfa, const dfa_info &info, UNUSED u16 sherman_limit) {
char *nfa_base = (char *)nfa; char *nfa_base = (char *)nfa;
mcsheng *m = (mcsheng *)getMutableImplNfa(nfa); mcsheng *m = (mcsheng *)getMutableImplNfa(nfa);
char *sherman_table = nfa_base + m->sherman_offset; char *sherman_table = nfa_base + m->sherman_offset;
@ -1109,7 +1109,7 @@ void fill_in_succ_table_8(NFA *nfa, const dfa_info &info,
} }
static static
void fill_in_sherman64(NFA *nfa, dfa_info &info, UNUSED u16 sherman_limit) { void fill_in_sherman64(NFA *nfa, const dfa_info &info, UNUSED u16 sherman_limit) {
char *nfa_base = (char *)nfa; char *nfa_base = (char *)nfa;
mcsheng64 *m = (mcsheng64 *)getMutableImplNfa(nfa); mcsheng64 *m = (mcsheng64 *)getMutableImplNfa(nfa);
char *sherman_table = nfa_base + m->sherman_offset; char *sherman_table = nfa_base + m->sherman_offset;

View File

@ -99,7 +99,7 @@ struct dfa_info {
return next(idx, TOP); return next(idx, TOP);
} }
dstate &next(dstate_id_t idx, u16 chr) { dstate &next(dstate_id_t idx, u16 chr) {
auto &src = (*this)[idx]; const auto &src = (*this)[idx];
auto next_id = src.next[raw.alpha_remap[chr]]; auto next_id = src.next[raw.alpha_remap[chr]];
return states[next_id]; return states[next_id];
} }
@ -109,7 +109,7 @@ struct dfa_info {
// if DFA can't die, shift all indices left by 1 // if DFA can't die, shift all indices left by 1
return can_die ? idx : idx + 1; return can_die ? idx : idx + 1;
} }
bool isDead(dstate &state) { bool isDead(const dstate &state) {
return raw_id(state.impl_id) == DEAD_STATE; return raw_id(state.impl_id) == DEAD_STATE;
} }
bool isDead(dstate_id_t idx) { bool isDead(dstate_id_t idx) {
@ -117,7 +117,7 @@ struct dfa_info {
} }
private: private:
static bool dfaCanDie(raw_dfa &rdfa) { static bool dfaCanDie(const raw_dfa &rdfa) {
for (unsigned chr = 0; chr < 256; chr++) { for (unsigned chr = 0; chr < 256; chr++) {
for (dstate_id_t state = 0; state < rdfa.states.size(); state++) { for (dstate_id_t state = 0; state < rdfa.states.size(); state++) {
auto succ = rdfa.states[state].next[rdfa.alpha_remap[chr]]; auto succ = rdfa.states[state].next[rdfa.alpha_remap[chr]];
@ -138,7 +138,7 @@ struct raw_report_list {
raw_report_list(const flat_set<ReportID> &reports_in, raw_report_list(const flat_set<ReportID> &reports_in,
const ReportManager &rm, bool do_remap) { const ReportManager &rm, bool do_remap) {
if (do_remap) { if (do_remap) {
for (auto &id : reports_in) { for (const auto &id : reports_in) {
reports.insert(rm.getProgramOffset(id)); reports.insert(rm.getProgramOffset(id));
} }
} else { } else {

View File

@ -227,7 +227,7 @@ const u8 *fwdBlock(SuperVector<S> shuf_mask_lo_highclear, SuperVector<S> shuf_ma
} }
template <uint16_t S> template <uint16_t S>
const u8 *truffleExecReal(m128 &shuf_mask_lo_highclear, m128 shuf_mask_lo_highset, const u8 *buf, const u8 *buf_end) { const u8 *truffleExecReal(const m128 &shuf_mask_lo_highclear, m128 shuf_mask_lo_highset, const u8 *buf, const u8 *buf_end) {
assert(buf && buf_end); assert(buf && buf_end);
assert(buf < buf_end); assert(buf < buf_end);
DEBUG_PRINTF("truffle %p len %zu\n", buf, buf_end - buf); DEBUG_PRINTF("truffle %p len %zu\n", buf, buf_end - buf);
@ -349,4 +349,4 @@ const u8 *rtruffleExecReal(m128 shuf_mask_lo_highclear, m128 shuf_mask_lo_highse
return buf - 1; return buf - 1;
} }
#endif //HAVE_SVE #endif //HAVE_SVE

View File

@ -289,7 +289,7 @@ bool addComponent(NG &ng, NGHolder &g, const ExpressionInfo &expr,
// Returns true if all components have been added. // Returns true if all components have been added.
static static
bool processComponents(NG &ng, ExpressionInfo &expr, bool processComponents(NG &ng, const ExpressionInfo &expr,
deque<unique_ptr<NGHolder>> &g_comp, deque<unique_ptr<NGHolder>> &g_comp,
const som_type som) { const som_type som) {
const u32 num_components = g_comp.size(); const u32 num_components = g_comp.size();

View File

@ -257,7 +257,7 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
static static
void reformUnanchoredRepeatsComponent(NGHolder &g, void reformUnanchoredRepeatsComponent(NGHolder &g,
set<NFAVertex> &compAnchoredStarts, const set<NFAVertex> &compAnchoredStarts,
set<NFAVertex> &compUnanchoredStarts, set<NFAVertex> &compUnanchoredStarts,
set<NFAVertex> &dead, set<NFAVertex> &dead,
depth *startBegin, depth *startEnd) { depth *startBegin, depth *startEnd) {
@ -555,7 +555,7 @@ void collapseVariableRepeats(NGHolder &g, depth *startBegin, depth *startEnd) {
} }
static static
void addDotsBetween(NGHolder &g, NFAVertex lhs, vector<NFAVertex> &rhs, void addDotsBetween(NGHolder &g, NFAVertex lhs, const vector<NFAVertex> &rhs,
depth min_repeat, depth max_repeat) { depth min_repeat, depth max_repeat) {
const bool unbounded = max_repeat.is_infinite(); const bool unbounded = max_repeat.is_infinite();
if (unbounded) { if (unbounded) {

View File

@ -159,7 +159,7 @@ public:
return id; return id;
} }
void append(WorkQueue &other) { void append(const WorkQueue &other) {
for (const auto &e : other) { for (const auto &e : other) {
push(e); push(e);
} }
@ -193,7 +193,7 @@ private:
} }
static static
bool outIsIrreducible(NFAVertex &v, const NGHolder &g) { bool outIsIrreducible(const NFAVertex &v, const NGHolder &g) {
unsigned nonSpecialVertices = 0; unsigned nonSpecialVertices = 0;
for (auto w : adjacent_vertices_range(v, g)) { for (auto w : adjacent_vertices_range(v, g)) {
if (!is_special(w, g) && w != v) { if (!is_special(w, g) && w != v) {
@ -204,7 +204,7 @@ bool outIsIrreducible(NFAVertex &v, const NGHolder &g) {
} }
static static
bool inIsIrreducible(NFAVertex &v, const NGHolder &g) { bool inIsIrreducible(const NFAVertex &v, const NGHolder &g) {
unsigned nonSpecialVertices = 0; unsigned nonSpecialVertices = 0;
for (auto u : inv_adjacent_vertices_range(v, g)) { for (auto u : inv_adjacent_vertices_range(v, g)) {
if (!is_special(u, g) && u != v) { if (!is_special(u, g) && u != v) {

View File

@ -430,7 +430,7 @@ NFAVertex findSingleCyclic(const NGHolder &g) {
} }
static static
bool hasOffsetAdjust(const ReportManager &rm, NGHolder &g, bool hasOffsetAdjust(const ReportManager &rm, const NGHolder &g,
int *adjust) { int *adjust) {
const auto &reports = all_reports(g); const auto &reports = all_reports(g);
if (reports.empty()) { if (reports.empty()) {

View File

@ -582,7 +582,7 @@ private:
// set up all reports // set up all reports
bool clone = false; bool clone = false;
for (auto &pair : reports_to_vertices) { for (const auto &pair : reports_to_vertices) {
const auto &reports = pair.first; const auto &reports = pair.first;
const auto &vertices = pair.second; const auto &vertices = pair.second;

View File

@ -98,7 +98,7 @@ void addToString(string &s, const NGHolder &g, NFAVertex v) {
} }
static static
bool splitOffLiteral(NG &ng, NGHolder &g, NFAVertex v, const bool anchored, bool splitOffLiteral(NG &ng, const NGHolder &g, NFAVertex v, const bool anchored,
set<NFAVertex> &dead) { set<NFAVertex> &dead) {
DEBUG_PRINTF("examine vertex %zu\n", g[v].index); DEBUG_PRINTF("examine vertex %zu\n", g[v].index);
bool nocase = false, casefixed = false; bool nocase = false, casefixed = false;

View File

@ -241,7 +241,7 @@ u32 allowedSquashDistance(const CharReach &cr, u32 min_width, const NGHolder &g,
/** Gives a stronger puff trigger when the trigger is connected to a wide /** Gives a stronger puff trigger when the trigger is connected to a wide
* cyclic state (aside from sds) */ * cyclic state (aside from sds) */
static static
void improveHead(NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) { void improveHead(const NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
DEBUG_PRINTF("attempting to improve puff trigger\n"); DEBUG_PRINTF("attempting to improve puff trigger\n");
assert(!nodes->empty()); assert(!nodes->empty());
const CharReach &puff_cr = g[nodes->back()].char_reach; const CharReach &puff_cr = g[nodes->back()].char_reach;
@ -260,7 +260,7 @@ void improveHead(NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
} }
static static
void constructPuff(NGHolder &g, const NFAVertex a, const NFAVertex puffv, void constructPuff(const NGHolder &g, const NFAVertex a, const NFAVertex puffv,
const CharReach &cr, const ReportID report, u32 width, const CharReach &cr, const ReportID report, u32 width,
bool fixed_depth, bool unbounded, bool auto_restart, bool fixed_depth, bool unbounded, bool auto_restart,
RoseBuild &rose, ReportManager &rm, RoseBuild &rose, ReportManager &rm,

View File

@ -323,7 +323,7 @@ bool doUselessMergePass(NGHolder &g, som_type som, VertexInfoMap &infoMap,
bool changed = false; bool changed = false;
for (auto v : vertices_range(g)) { for (auto v : vertices_range(g)) {
VertexInfo &info = infoMap[v]; const VertexInfo &info = infoMap[v];
if (info.isRemoved) { if (info.isRemoved) {
continue; continue;
@ -439,7 +439,7 @@ bool doUselessMergePass(NGHolder &g, som_type som, VertexInfoMap &infoMap,
continue; // Conservatively skip anything with nonzero tops. continue; // Conservatively skip anything with nonzero tops.
} }
CharReach &otherReach = g[t].char_reach; const CharReach &otherReach = g[t].char_reach;
if (currReach.isSubsetOf(otherReach)) { if (currReach.isSubsetOf(otherReach)) {
DEBUG_PRINTF("removing redundant vertex %zu (keeping %zu)\n", DEBUG_PRINTF("removing redundant vertex %zu (keeping %zu)\n",
g[v].index, g[t].index); g[v].index, g[t].index);
@ -745,7 +745,7 @@ u32 findCyclic(const NGHolder &g, vector<bool> &cyclic) {
} }
static static
void findCyclicDom(NGHolder &g, vector<bool> &cyclic, void findCyclicDom(const NGHolder &g, vector<bool> &cyclic,
set<NFAEdge> &dead, som_type som) { set<NFAEdge> &dead, som_type som) {
auto dominators = findDominators(g); auto dominators = findDominators(g);
@ -789,7 +789,7 @@ void findCyclicDom(NGHolder &g, vector<bool> &cyclic,
} }
static static
void findCyclicPostDom(NGHolder &g, vector<bool> &cyclic, void findCyclicPostDom(const NGHolder &g, vector<bool> &cyclic,
set<NFAEdge> &dead) { set<NFAEdge> &dead) {
auto postdominators = findPostDominators(g); auto postdominators = findPostDominators(g);

View File

@ -1874,7 +1874,7 @@ void buildFeeder(NGHolder &g, const BoundedRepeatData &rd,
* offset. * offset.
*/ */
static static
bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd, bool improveLeadingRepeat(NGHolder &g, const BoundedRepeatData &rd,
unordered_set<NFAVertex> &created, unordered_set<NFAVertex> &created,
const vector<BoundedRepeatData> &all_repeats) { const vector<BoundedRepeatData> &all_repeats) {
assert(edge(g.startDs, g.startDs, g).second); assert(edge(g.startDs, g.startDs, g).second);
@ -1944,7 +1944,7 @@ bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd,
} }
static static
vector<NFAVertex> makeOwnStraw(NGHolder &g, BoundedRepeatData &rd, vector<NFAVertex> makeOwnStraw(NGHolder &g, const BoundedRepeatData &rd,
const vector<NFAVertex> &straw) { const vector<NFAVertex> &straw) {
// Straw runs from startDs to our pos trigger. // Straw runs from startDs to our pos trigger.
assert(!straw.empty()); assert(!straw.empty());

View File

@ -1177,7 +1177,7 @@ void expandGraph(NGHolder &g, unordered_map<NFAVertex, u32> &regions,
} }
static static
bool doTreePlanningIntl(NGHolder &g, bool doTreePlanningIntl(const NGHolder &g,
const unordered_map<NFAVertex, u32> &regions, const unordered_map<NFAVertex, u32> &regions,
const map<u32, region_info> &info, const map<u32, region_info> &info,
map<u32, region_info>::const_iterator picked, u32 bad_region, map<u32, region_info>::const_iterator picked, u32 bad_region,
@ -1855,7 +1855,7 @@ bool doSomRevNfa(NG &ng, NGHolder &g, const CompileContext &cc) {
} }
static static
u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, NGHolder &g, u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, const NGHolder &g,
const CompileContext &cc) { const CompileContext &cc) {
depth maxWidth = findMaxWidth(g); depth maxWidth = findMaxWidth(g);
@ -2011,7 +2011,7 @@ void setReportOnHaigPrefix(RoseBuild &rose, NGHolder &h) {
} }
static static
bool tryHaig(RoseBuild &rose, NGHolder &g, bool tryHaig(RoseBuild &rose, const NGHolder &g,
const unordered_map<NFAVertex, u32> &regions, const unordered_map<NFAVertex, u32> &regions,
som_type som, u32 somPrecision, som_type som, u32 somPrecision,
map<u32, region_info>::const_iterator picked, map<u32, region_info>::const_iterator picked,
@ -2442,7 +2442,7 @@ void makeReportsSomPass(ReportManager &rm, NGHolder &g) {
} }
static static
bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) { bool doLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
ue2_literal lit; ue2_literal lit;
shared_ptr<NGHolder> rhs = make_shared<NGHolder>(); shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
if (!rhs) { if (!rhs) {
@ -2659,7 +2659,7 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
} }
static static
bool doMultiLitHaigSom(NG &ng, NGHolder &g, som_type som) { bool doMultiLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
set<ue2_literal> lits; set<ue2_literal> lits;
shared_ptr<NGHolder> rhs = make_shared<NGHolder>(); shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
if (!ng.cc.grey.allowLitHaig) { if (!ng.cc.grey.allowLitHaig) {

View File

@ -112,7 +112,7 @@ bool forkVertex(NFAVertex v, NGHolder &g, vector<DepthMinMax> &depths,
} }
*numNewVertices += predGroups.size(); *numNewVertices += predGroups.size();
for (auto &group : predGroups) { for (const auto &group : predGroups) {
const depth &predDepth = group.first; const depth &predDepth = group.first;
const vector<NFAEdge> &preds = group.second; const vector<NFAEdge> &preds = group.second;

View File

@ -454,8 +454,8 @@ void buildNfaMergeQueue(const vector<NGHolder *> &cluster,
} }
} }
NGHolder &g_i = *(cluster[ci]); const NGHolder &g_i = *(cluster[ci]);
NGHolder &g_j = *(cluster[cj]); const NGHolder &g_j = *(cluster[cj]);
if (!compatibleStarts(g_i, g_j)) { if (!compatibleStarts(g_i, g_j)) {
continue; continue;

View File

@ -687,7 +687,7 @@ unique_ptr<VertLitInfo> findBestSplit(const NGHolder &g,
} }
if (seeking_transient) { if (seeking_transient) {
for (auto &a : lits) { for (const auto &a : lits) {
a->creates_transient a->creates_transient
= createsTransientLHS(g, a->vv, *depths, cc.grey); = createsTransientLHS(g, a->vv, *depths, cc.grey);
} }
@ -696,7 +696,7 @@ unique_ptr<VertLitInfo> findBestSplit(const NGHolder &g,
if (last_chance) { if (last_chance) {
const size_t num_verts = num_vertices(g); const size_t num_verts = num_vertices(g);
auto color_map = make_small_color_map(g); auto color_map = make_small_color_map(g);
for (auto &a : lits) { for (const auto &a : lits) {
size_t num_reachable = count_reachable(g, a->vv, color_map); size_t num_reachable = count_reachable(g, a->vv, color_map);
double ratio = (double)num_reachable / (double)num_verts; double ratio = (double)num_reachable / (double)num_verts;
a->split_ratio = ratio > 0.5 ? 1 - ratio : ratio; a->split_ratio = ratio > 0.5 ? 1 - ratio : ratio;
@ -1171,7 +1171,7 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
#define MAX_LEN_2_LITERALS_PER_CUT 3 #define MAX_LEN_2_LITERALS_PER_CUT 3
static static
bool checkValidNetflowLits(NGHolder &h, const vector<u64a> &scores, bool checkValidNetflowLits(const NGHolder &h, const vector<u64a> &scores,
const map<NFAEdge, set<ue2_literal>> &cut_lits, const map<NFAEdge, set<ue2_literal>> &cut_lits,
u32 min_allowed_length) { u32 min_allowed_length) {
DEBUG_PRINTF("cut width %zu; min allowed %u\n", cut_lits.size(), DEBUG_PRINTF("cut width %zu; min allowed %u\n", cut_lits.size(),
@ -1208,7 +1208,7 @@ bool checkValidNetflowLits(NGHolder &h, const vector<u64a> &scores,
} }
static static
void splitEdgesByCut(NGHolder &h, RoseInGraph &vg, void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
const vector<RoseInEdge> &to_cut, const vector<RoseInEdge> &to_cut,
const vector<NFAEdge> &cut, const vector<NFAEdge> &cut,
const map<NFAEdge, set<ue2_literal>> &cut_lits) { const map<NFAEdge, set<ue2_literal>> &cut_lits) {
@ -1804,7 +1804,7 @@ void removeRedundantLiterals(RoseInGraph &g, const CompileContext &cc) {
} }
static static
RoseInVertex getStart(RoseInGraph &vg) { RoseInVertex getStart(const RoseInGraph &vg) {
for (RoseInVertex v : vertices_range(vg)) { for (RoseInVertex v : vertices_range(vg)) {
if (vg[v].type == RIV_START || vg[v].type == RIV_ANCHORED_START) { if (vg[v].type == RIV_START || vg[v].type == RIV_ANCHORED_START) {
return v; return v;
@ -1869,7 +1869,7 @@ unique_ptr<NGHolder> make_chain(u32 count) {
#define SHORT_TRIGGER_LEN 16 #define SHORT_TRIGGER_LEN 16
static static
bool makeTransientFromLongLiteral(NGHolder &h, RoseInGraph &vg, bool makeTransientFromLongLiteral(const NGHolder &h, RoseInGraph &vg,
const vector<RoseInEdge> &ee, const vector<RoseInEdge> &ee,
const CompileContext &cc) { const CompileContext &cc) {
/* check max width and literal lengths to see if possible */ /* check max width and literal lengths to see if possible */
@ -2149,7 +2149,7 @@ void findBetterPrefixes(RoseInGraph &vg, const CompileContext &cc) {
#define MAX_EXTRACT_STRONG_LITERAL_GRAPHS 10 #define MAX_EXTRACT_STRONG_LITERAL_GRAPHS 10
static static
bool extractStrongLiteral(NGHolder &h, RoseInGraph &vg, bool extractStrongLiteral(const NGHolder &h, RoseInGraph &vg,
const vector<RoseInEdge> &ee, const vector<RoseInEdge> &ee,
const CompileContext &cc) { const CompileContext &cc) {
DEBUG_PRINTF("looking for string literal\n"); DEBUG_PRINTF("looking for string literal\n");
@ -2804,7 +2804,7 @@ bool tryForEarlyDfa(const NGHolder &h, const CompileContext &cc) {
} }
static static
vector<vector<CharReach>> getDfaTriggers(RoseInGraph &vg, vector<vector<CharReach>> getDfaTriggers(const RoseInGraph &vg,
const vector<RoseInEdge> &edges, const vector<RoseInEdge> &edges,
bool *single_trigger) { bool *single_trigger) {
vector<vector<CharReach>> triggers; vector<vector<CharReach>> triggers;
@ -2926,7 +2926,7 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
vector<RoseInEdge>> edges_by_graph; vector<RoseInEdge>> edges_by_graph;
for (const RoseInEdge &ve : edges_range(vg)) { for (const RoseInEdge &ve : edges_range(vg)) {
if (vg[ve].graph && !vg[ve].dfa) { if (vg[ve].graph && !vg[ve].dfa) {
auto &h = vg[ve].graph; const auto &h = vg[ve].graph;
edges_by_graph[h].emplace_back(ve); edges_by_graph[h].emplace_back(ve);
} }
} }

View File

@ -110,7 +110,7 @@ void addBase(Position base, vector<PositionInfo> &firsts,
} }
static static
void checkPositions(vector<PositionInfo> &v, const GlushkovBuildState &bs) { void checkPositions(const vector<PositionInfo> &v, const GlushkovBuildState &bs) {
const NFABuilder& builder = bs.getBuilder(); const NFABuilder& builder = bs.getBuilder();
for (const auto &e : v) { for (const auto &e : v) {
if (builder.isSpecialState(e.pos)) { if (builder.isSpecialState(e.pos)) {

View File

@ -242,7 +242,7 @@ Position makeNewlineAssertPos(GlushkovBuildState &bs) {
static static
void generateAccepts(GlushkovBuildStateImpl &bs, const PositionInfo &from, void generateAccepts(GlushkovBuildStateImpl &bs, const PositionInfo &from,
vector<PositionInfo> *tolist) { vector<PositionInfo> *tolist) {
NFABuilder &builder = bs.getBuilder(); const NFABuilder &builder = bs.getBuilder();
u32 flags = from.flags; u32 flags = from.flags;
bool require_eod = flags & POS_FLAG_WIRE_EOD; bool require_eod = flags & POS_FLAG_WIRE_EOD;

View File

@ -353,7 +353,7 @@ void createVertices(RoseBuildImpl *tbi,
edge_props.minBound, edge_props.maxBound); edge_props.minBound, edge_props.maxBound);
} }
for (auto &m : created) { for (const auto &m : created) {
tbi->ghost[m.second] = g_v; tbi->ghost[m.second] = g_v;
} }
} }
@ -938,7 +938,7 @@ void shift_accepts_to_end(const RoseInGraph &ig,
} }
static static
void populateRoseGraph(RoseBuildImpl *tbi, RoseBuildData &bd) { void populateRoseGraph(RoseBuildImpl *tbi, const RoseBuildData &bd) {
const RoseInGraph &ig = bd.ig; const RoseInGraph &ig = bd.ig;
/* add the pattern in to the main rose graph */ /* add the pattern in to the main rose graph */

View File

@ -674,7 +674,7 @@ buildSuffix(const ReportManager &rm, const SomSlotManager &ssm,
} }
assert(suff.graph()); assert(suff.graph());
NGHolder &holder = *suff.graph(); const NGHolder &holder = *suff.graph();
assert(holder.kind == NFA_SUFFIX); assert(holder.kind == NFA_SUFFIX);
const bool oneTop = onlyOneTop(holder); const bool oneTop = onlyOneTop(holder);
bool compress_state = cc.streaming; bool compress_state = cc.streaming;
@ -1378,7 +1378,7 @@ void updateExclusiveSuffixProperties(const RoseBuildImpl &build,
const vector<ExclusiveInfo> &exclusive_info, const vector<ExclusiveInfo> &exclusive_info,
set<u32> *no_retrigger_queues) { set<u32> *no_retrigger_queues) {
const RoseGraph &g = build.g; const RoseGraph &g = build.g;
for (auto &info : exclusive_info) { for (const auto &info : exclusive_info) {
const auto &qi = info.queue; const auto &qi = info.queue;
const auto &subengines = info.subengines; const auto &subengines = info.subengines;
bool no_retrigger = true; bool no_retrigger = true;
@ -1627,11 +1627,11 @@ public:
build.rm); build.rm);
} }
bytecode_ptr<NFA> operator()(unique_ptr<NGHolder> &holder) const { bytecode_ptr<NFA> operator()(const unique_ptr<NGHolder> &holder) const {
const CompileContext &cc = build.cc; const CompileContext &cc = build.cc;
const ReportManager &rm = build.rm; const ReportManager &rm = build.rm;
NGHolder &h = *holder; const NGHolder &h = *holder;
assert(h.kind == NFA_OUTFIX); assert(h.kind == NFA_OUTFIX);
// Build NFA. // Build NFA.
@ -1657,7 +1657,7 @@ public:
return n; return n;
} }
bytecode_ptr<NFA> operator()(UNUSED MpvProto &mpv) const { bytecode_ptr<NFA> operator()(UNUSED const MpvProto &mpv) const {
// MPV construction handled separately. // MPV construction handled separately.
assert(mpv.puffettes.empty()); assert(mpv.puffettes.empty());
return nullptr; return nullptr;
@ -2727,7 +2727,7 @@ void buildLeftInfoTable(const RoseBuildImpl &tbi, build_context &bc,
} }
static static
RoseProgram makeLiteralProgram(const RoseBuildImpl &build, build_context &bc, RoseProgram makeLiteralProgram(const RoseBuildImpl &build, const build_context &bc,
ProgramBuild &prog_build, u32 lit_id, ProgramBuild &prog_build, u32 lit_id,
const vector<vector<RoseEdge>> &lit_edge_map, const vector<vector<RoseEdge>> &lit_edge_map,
bool is_anchored_replay_program) { bool is_anchored_replay_program) {
@ -2972,7 +2972,7 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
pfrag.lit_ids, lit_edge_map); pfrag.lit_ids, lit_edge_map);
if (pfrag.included_frag_id != INVALID_FRAG_ID && if (pfrag.included_frag_id != INVALID_FRAG_ID &&
!lit_prog.empty()) { !lit_prog.empty()) {
auto &cfrag = fragments[pfrag.included_frag_id]; const auto &cfrag = fragments[pfrag.included_frag_id];
assert(pfrag.s.length() >= cfrag.s.length() && assert(pfrag.s.length() >= cfrag.s.length() &&
!pfrag.s.any_nocase() == !cfrag.s.any_nocase()); !pfrag.s.any_nocase() == !cfrag.s.any_nocase());
/** !pfrag.s.any_nocase() >= !cfrag.s.any_nocase()); **/ /** !pfrag.s.any_nocase() >= !cfrag.s.any_nocase()); **/
@ -2992,7 +2992,7 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
pfrag.lit_ids); pfrag.lit_ids);
if (pfrag.included_delay_frag_id != INVALID_FRAG_ID && if (pfrag.included_delay_frag_id != INVALID_FRAG_ID &&
!rebuild_prog.empty()) { !rebuild_prog.empty()) {
auto &cfrag = fragments[pfrag.included_delay_frag_id]; const auto &cfrag = fragments[pfrag.included_frag_id];
/** assert(pfrag.s.length() >= cfrag.s.length() && **/ /** assert(pfrag.s.length() >= cfrag.s.length() && **/
assert(pfrag.s.length() == cfrag.s.length() && assert(pfrag.s.length() == cfrag.s.length() &&
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase()); !pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
@ -3012,7 +3012,7 @@ void updateLitProtoProgramOffset(vector<LitFragment> &fragments,
auto &proto = *litProto.hwlmProto; auto &proto = *litProto.hwlmProto;
for (auto &lit : proto.lits) { for (auto &lit : proto.lits) {
auto fragId = lit.id; auto fragId = lit.id;
auto &frag = fragments[fragId]; const auto &frag = fragments[fragId];
if (delay) { if (delay) {
DEBUG_PRINTF("delay_program_offset:%u\n", DEBUG_PRINTF("delay_program_offset:%u\n",
frag.delay_program_offset); frag.delay_program_offset);

View File

@ -118,7 +118,7 @@ bool addPrefixLiterals(NGHolder &h, unordered_set<u32> &tailId,
for (auto v : adjacent_vertices_range(start, h)) { for (auto v : adjacent_vertices_range(start, h)) {
if (v != h.startDs) { if (v != h.startDs) {
for (auto &t : tails) { for (const auto &t : tails) {
add_edge(t, v, h); add_edge(t, v, h);
} }
} }
@ -126,7 +126,7 @@ bool addPrefixLiterals(NGHolder &h, unordered_set<u32> &tailId,
clear_out_edges(start, h); clear_out_edges(start, h);
add_edge(h.start, h.start, h); add_edge(h.start, h.start, h);
for (auto &t : heads) { for (const auto &t : heads) {
add_edge(start, t, h); add_edge(start, t, h);
} }

View File

@ -275,7 +275,7 @@ void assignGroupsToLiterals(RoseBuildImpl &build) {
// Second pass: the other literals. // Second pass: the other literals.
for (u32 id = 0; id < literals.size(); id++) { for (u32 id = 0; id < literals.size(); id++) {
const rose_literal_id &lit = literals.at(id); const rose_literal_id &lit = literals.at(id);
rose_literal_info &info = literal_info[id]; const rose_literal_info &info = literal_info[id];
if (!requires_group_assignment(lit, info)) { if (!requires_group_assignment(lit, info)) {
continue; continue;

View File

@ -1338,7 +1338,7 @@ void chunk(vector<T> in, vector<vector<T>> *out, size_t chunk_size) {
} }
static static
insertion_ordered_map<left_id, vector<RoseVertex>> get_eng_verts(RoseGraph &g) { insertion_ordered_map<left_id, vector<RoseVertex>> get_eng_verts(const RoseGraph &g) {
insertion_ordered_map<left_id, vector<RoseVertex>> eng_verts; insertion_ordered_map<left_id, vector<RoseVertex>> eng_verts;
for (auto v : vertices_range(g)) { for (auto v : vertices_range(g)) {
const auto &left = g[v].left; const auto &left = g[v].left;
@ -1925,7 +1925,7 @@ void mergeSmallLeftfixes(RoseBuildImpl &tbi) {
} }
assert(left.graph()); assert(left.graph());
NGHolder &h = *left.graph(); const NGHolder &h = *left.graph();
/* Ensure that kind on the graph is correct */ /* Ensure that kind on the graph is correct */
assert(h.kind == (tbi.isRootSuccessor(v) ? NFA_PREFIX : NFA_INFIX)); assert(h.kind == (tbi.isRootSuccessor(v) ? NFA_PREFIX : NFA_INFIX));
@ -2025,7 +2025,7 @@ void mergeCastleLeftfixes(RoseBuildImpl &build) {
return; return;
} }
RoseGraph &g = build.g; const RoseGraph &g = build.g;
insertion_ordered_map<left_id, vector<RoseVertex>> eng_verts; insertion_ordered_map<left_id, vector<RoseVertex>> eng_verts;
@ -2307,7 +2307,7 @@ void mergeOutfixInfo(OutfixInfo &winner, const OutfixInfo &victim) {
} }
static static
map<NGHolder *, NGHolder *> chunkedNfaMerge(RoseBuildImpl &build, map<NGHolder *, NGHolder *> chunkedNfaMerge(const RoseBuildImpl &build,
const vector<NGHolder *> &nfas) { const vector<NGHolder *> &nfas) {
map<NGHolder *, NGHolder *> merged; map<NGHolder *, NGHolder *> merged;

View File

@ -1352,8 +1352,8 @@ bool attemptRoseMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
assert(a != b); assert(a != b);
RoseGraph &g = build.g; RoseGraph &g = build.g;
LeftEngInfo &a_left = g[a].left; const LeftEngInfo &a_left = g[a].left;
LeftEngInfo &b_left = g[b].left; const LeftEngInfo &b_left = g[b].left;
// Trivial case. // Trivial case.
if (a_left == b_left) { if (a_left == b_left) {
@ -1601,7 +1601,7 @@ void diamondMergePass(CandidateSet &candidates, RoseBuildImpl &build,
vector<RoseVertex> *dead, bool mergeRoses, vector<RoseVertex> *dead, bool mergeRoses,
RoseAliasingInfo &rai) { RoseAliasingInfo &rai) {
DEBUG_PRINTF("begin\n"); DEBUG_PRINTF("begin\n");
RoseGraph &g = build.g; const RoseGraph &g = build.g;
if (candidates.empty()) { if (candidates.empty()) {
return; return;
@ -1972,7 +1972,7 @@ bool hasNoDiamondSiblings(const RoseGraph &g, RoseVertex v) {
* merge. * merge.
*/ */
static static
void filterDiamondCandidates(RoseGraph &g, CandidateSet &candidates) { void filterDiamondCandidates(const RoseGraph &g, CandidateSet &candidates) {
DEBUG_PRINTF("%zu candidates enter\n", candidates.size()); DEBUG_PRINTF("%zu candidates enter\n", candidates.size());
vector<RoseVertex> dead; vector<RoseVertex> dead;

View File

@ -187,7 +187,7 @@ u32 SomSlotManager::getInitialResetSomSlot(const NGHolder &prefix,
find_if(reset.entries.begin(), reset.entries.end(), find_if(reset.entries.begin(), reset.entries.end(),
has_prefix_func) != reset.entries.end(); has_prefix_func) != reset.entries.end();
for (auto &e : reset.entries) { for (const auto &e : reset.entries) {
u32 temp = 0; u32 temp = 0;
/* we don't need to test against sentinels which are identical to /* we don't need to test against sentinels which are identical to
* our current one as races don't matter and we know it clears * our current one as races don't matter and we know it clears

View File

@ -79,7 +79,7 @@ vector<u32> findCliqueGroup(CliqueGraph &cg) {
// Choose a vertex from the graph // Choose a vertex from the graph
u32 id = g[0]; u32 id = g[0];
CliqueVertex &n = vertexMap.at(id); const CliqueVertex &n = vertexMap.at(id);
clique.emplace_back(id); clique.emplace_back(id);
// Corresponding vertex in the original graph // Corresponding vertex in the original graph
set<u32> subgraphId(g.begin(), g.end()); set<u32> subgraphId(g.begin(), g.end());

View File

@ -132,7 +132,7 @@ void EngineHyperscan::scan(const char *data, unsigned int len, unsigned int id,
ResultEntry &result, EngineContext &ectx) const { ResultEntry &result, EngineContext &ectx) const {
assert(data); assert(data);
EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx); const EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx);
ScanHSContext sc(id, result, nullptr); ScanHSContext sc(id, result, nullptr);
auto callback = echo_matches ? onMatchEcho : onMatch; auto callback = echo_matches ? onMatchEcho : onMatch;
hs_error_t rv = hs_scan(db, data, len, 0, ctx.scratch, callback, &sc); hs_error_t rv = hs_scan(db, data, len, 0, ctx.scratch, callback, &sc);
@ -150,7 +150,7 @@ void EngineHyperscan::scan_vectored(const char *const *data,
assert(data); assert(data);
assert(len); assert(len);
EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx); const EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx);
ScanHSContext sc(streamId, result, nullptr); ScanHSContext sc(streamId, result, nullptr);
auto callback = echo_matches ? onMatchEcho : onMatch; auto callback = echo_matches ? onMatchEcho : onMatch;
hs_error_t rv = hs_error_t rv =
@ -198,8 +198,8 @@ void EngineHyperscan::streamScan(EngineStream &stream, const char *data,
ResultEntry &result) const { ResultEntry &result) const {
assert(data); assert(data);
auto &s = static_cast<EngineHSStream &>(stream); const auto &s = static_cast<EngineHSStream &>(stream);
EngineHSContext &ctx = *s.ctx; const EngineHSContext &ctx = *s.ctx;
ScanHSContext sc(id, result, &s); ScanHSContext sc(id, result, &s);
auto callback = echo_matches ? onMatchEcho : onMatch; auto callback = echo_matches ? onMatchEcho : onMatch;
@ -215,7 +215,7 @@ void EngineHyperscan::streamScan(EngineStream &stream, const char *data,
void EngineHyperscan::streamCompressExpand(EngineStream &stream, void EngineHyperscan::streamCompressExpand(EngineStream &stream,
vector<char> &temp) const { vector<char> &temp) const {
size_t used = 0; size_t used = 0;
auto &s = static_cast<EngineHSStream &>(stream); const auto &s = static_cast<EngineHSStream &>(stream);
hs_error_t err = hs_compress_stream(s.id, temp.data(), temp.size(), hs_error_t err = hs_compress_stream(s.id, temp.data(), temp.size(),
&used); &used);
if (err == HS_INSUFFICIENT_SPACE) { if (err == HS_INSUFFICIENT_SPACE) {

View File

@ -45,8 +45,8 @@ TEST(LogicalCombination, SingleComb1) {
string data = "abcdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef"; string data = "abcdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)"}; "ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)"};
unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION}; const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 1001}; const unsigned ids[] = {101, 102, 103, 104, 105, 1001};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -92,9 +92,9 @@ TEST(LogicalCombination, SingleCombQuietSub1) {
string data = "abcdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef"; string data = "abcdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)"}; "ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)"};
unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION}; HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 1001}; const unsigned ids[] = {101, 102, 103, 104, 105, 1001};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -133,11 +133,11 @@ TEST(LogicalCombination, MultiCombQuietSub1) {
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)", "ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)",
"!101 & 102", "!(!101 | 102)", "101 & !102"}; "!101 & 102", "!(!101 | 102)", "101 & !102"};
unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION, HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004}; const unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -178,13 +178,13 @@ TEST(LogicalCombination, MultiHighlanderCombQuietSub1) {
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)", "ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)",
"!101 & 102", "!(!101 | 102)", "101 & !102"}; "!101 & 102", "!(!101 | 102)", "101 & !102"};
unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0,
HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH, HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH, HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH,
HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH}; HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH};
unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004}; const unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -219,11 +219,11 @@ TEST(LogicalCombination, MultiQuietCombQuietSub1) {
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)", "ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)",
"!101 & 102", "!(!101 | 102)", "101 & !102"}; "!101 & 102", "!(!101 | 102)", "101 & !102"};
unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION | HS_FLAG_QUIET}; HS_FLAG_COMBINATION | HS_FLAG_QUIET};
unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004}; const unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -255,8 +255,8 @@ TEST(LogicalCombination, SingleComb2) {
string data = "abbdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef"; string data = "abbdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(201 | 202 & 203) & (!204 | 205)"}; "ijkl[mMn]", "(201 | 202 & 203) & (!204 | 205)"};
unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION}; const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
unsigned ids[] = {201, 202, 203, 204, 205, 1002}; const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -299,9 +299,9 @@ TEST(LogicalCombination, SingleCombQuietSub2) {
string data = "abbdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef"; string data = "abbdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(201 | 202 & 203) & (!204 | 205)"}; "ijkl[mMn]", "(201 | 202 & 203) & (!204 | 205)"};
unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, const unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION};
unsigned ids[] = {201, 202, 203, 204, 205, 1002}; const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -339,8 +339,8 @@ TEST(LogicalCombination, SingleComb3) {
string data = "abcijklndefxxfoobarrrghabcxdefxteakettleeeeexxxxijklnxxdef"; string data = "abcijklndefxxfoobarrrghabcxdefxteakettleeeeexxxxijklnxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "((301 | 302) & 303) & (304 | 305)"}; "ijkl[mMn]", "((301 | 302) & 303) & (304 | 305)"};
unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION}; const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
unsigned ids[] = {301, 302, 303, 304, 305, 1003}; const unsigned ids[] = {301, 302, 303, 304, 305, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -387,9 +387,9 @@ TEST(LogicalCombination, SingleCombQuietSub3) {
string data = "abcijklndefxxfoobarrrghabcxdefxteakettleeeeexxxxijklnxxdef"; string data = "abcijklndefxxfoobarrrghabcxdefxteakettleeeeexxxxijklnxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "((301 | 302) & 303) & (304 | 305)"}; "ijkl[mMn]", "((301 | 302) & 303) & (304 | 305)"};
unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
HS_FLAG_QUIET, HS_FLAG_COMBINATION}; HS_FLAG_QUIET, HS_FLAG_COMBINATION};
unsigned ids[] = {301, 302, 303, 304, 305, 1003}; const unsigned ids[] = {301, 302, 303, 304, 305, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -429,9 +429,9 @@ TEST(LogicalCombination, MultiCombDupSub4) {
"ijkl[mMn]", "(201 & 202 & 203) | (204 & !205)", "ijkl[mMn]", "(201 & 202 & 203) | (204 & !205)",
"(201 | 202 & 203) & (!204 | 205)", "(201 | 202 & 203) & (!204 | 205)",
"((201 | 202) & 203) & (204 | 205)"}; "((201 | 202) & 203) & (204 | 205)"};
unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION, const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003}; const unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 8, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 8, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -486,10 +486,10 @@ TEST(LogicalCombination, MultiCombQuietDupSub4) {
"ijkl[mMn]", "(201 & 202 & 203) | (204 & !205)", "ijkl[mMn]", "(201 & 202 & 203) | (204 & !205)",
"(201 | 202 & 203) & (!204 | 205)", "(201 | 202 & 203) & (!204 | 205)",
"((201 | 202) & 203) & (204 | 205)"}; "((201 | 202) & 203) & (204 | 205)"};
unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0,
HS_FLAG_QUIET, HS_FLAG_COMBINATION, HS_FLAG_QUIET, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003}; const unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 8, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 8, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -546,10 +546,10 @@ TEST(LogicalCombination, MultiCombUniSub5) {
"(101 & 102 & 103) | (104 & !105)", "(101 & 102 & 103) | (104 & !105)",
"(201 | 202 & 203) & (!204 | 205)", "(201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"}; "((301 | 302) & 303) & (304 | 305)"};
unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, const unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301, const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003}; 302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -636,12 +636,12 @@ TEST(LogicalCombination, MultiCombQuietUniSub5) {
"(101 & 102 & 103) | (104 & !105)", "(101 & 102 & 103) | (104 & !105)",
"(201 | 202 & 203) & (!204 | 205)", "(201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"}; "((301 | 302) & 303) & (304 | 305)"};
unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, const unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0,
HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301, const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003}; 302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -702,8 +702,8 @@ TEST(LogicalCombination, SingleCombPurelyNegative6) {
string data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; string data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(!201 | 202 & 203) & (!204 | 205)"}; "ijkl[mMn]", "(!201 | 202 & 203) & (!204 | 205)"};
unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION}; const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
unsigned ids[] = {201, 202, 203, 204, 205, 1002}; const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -734,8 +734,8 @@ TEST(LogicalCombination, SingleCombQuietPurelyNegative6) {
string data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; string data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}", const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(!201 | 202 & 203) & (!204 | 205)"}; "ijkl[mMn]", "(!201 | 202 & 203) & (!204 | 205)"};
unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET}; const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET};
unsigned ids[] = {201, 202, 203, 204, 205, 1002}; const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -775,10 +775,10 @@ TEST(LogicalCombination, MultiCombPurelyNegativeUniSub6) {
"(101 & 102 & 103) | (!104 & !105)", "(101 & 102 & 103) | (!104 & !105)",
"(!201 | 202 & 203) & (!204 | 205)", "(!201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"}; "((301 | 302) & 303) & (304 | 305)"};
unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, const unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301, const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003}; 302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -822,11 +822,11 @@ TEST(LogicalCombination, MultiCombPurelyNegativeUniSubEOD6) {
"(101 & 102 & 103) | (!104 & !105)", "(101 & 102 & 103) | (!104 & !105)",
"(!201 | 202 & 203) & (!204 | 205)", "(!201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"}; "((301 | 302) & 303) & (304 | 305)"};
unsigned flags[] = {0, 0, 0, 0, 0, 0, HS_FLAG_MULTILINE, const unsigned flags[] = {0, 0, 0, 0, 0, 0, HS_FLAG_MULTILINE,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION}; HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301, const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003}; 302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -875,8 +875,8 @@ TEST(LogicalCombination, MultiCombStream1) {
"z"}; "z"};
const char *expr[] = {"abc", "def", "xyz", "zxyz", const char *expr[] = {"abc", "def", "xyz", "zxyz",
"101 & 102", "201 & !202"}; "101 & 102", "201 & !202"};
unsigned flags[] = {0, 0, 0, 0, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION}; const unsigned flags[] = {0, 0, 0, 0, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
unsigned ids[] = {101, 102, 201, 202, 1001, 1002}; const unsigned ids[] = {101, 102, 201, 202, 1001, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_STREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_STREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);

View File

@ -44,8 +44,8 @@ TEST(MMAdaptor, norm_cont1) { // UE-901
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ"; string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"}; const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
unsigned flags[] = {0, 0}; const unsigned flags[] = {0, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -77,8 +77,8 @@ TEST(MMAdaptor, norm_cont2) {
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ "; string data = "aooAaooAbarZ ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"}; const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
unsigned flags[] = {0, 0}; const unsigned flags[] = {0, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -110,8 +110,8 @@ TEST(MMAdaptor, norm_halt1) {
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ"; string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"}; const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
unsigned flags[] = {0, 0}; const unsigned flags[] = {0, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -141,8 +141,8 @@ TEST(MMAdaptor, norm_halt2) { // UE-901
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ "; string data = "aooAaooAbarZ ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"}; const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
unsigned flags[] = {0, 0}; const unsigned flags[] = {0, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -172,8 +172,8 @@ TEST(MMAdaptor, high_cont1) { // UE-901
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ"; string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"}; const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0}; const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -204,8 +204,8 @@ TEST(MMAdaptor, high_cont2) {
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ "; string data = "aooAaooAbarZ ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"}; const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0}; const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -236,8 +236,8 @@ TEST(MMAdaptor, high_halt1) {
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZ"; string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"}; const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0}; const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -267,8 +267,8 @@ TEST(MMAdaptor, high_halt2) {
CallBackContext c; CallBackContext c;
string data = "aooAaooAbarZbarZaooA "; string data = "aooAaooAbarZbarZaooA ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"}; const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0}; const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
unsigned ids[] = {30, 31}; const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM, hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err); nullptr, &db, &compile_err);
@ -342,7 +342,7 @@ TEST(MMRoseLiteralPath, issue_141) {
const char *expr[] = {"/odezhda-dlya-bega/", const char *expr[] = {"/odezhda-dlya-bega/",
"kurtki-i-vetrovki-dlya-bega", "kurtki-i-vetrovki-dlya-bega",
"futbolki-i-mayki-dlya-bega"}; "futbolki-i-mayki-dlya-bega"};
unsigned flags[] = {HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH, const unsigned flags[] = {HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH,
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH, HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH,
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH}; HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH};
hs_error_t err = hs_compile_multi(expr, flags, nullptr, 3, HS_MODE_BLOCK, hs_error_t err = hs_compile_multi(expr, flags, nullptr, 3, HS_MODE_BLOCK,

View File

@ -41,7 +41,7 @@ namespace ue2 {
// Helper function: construct a graph from an expression, flags and context. // Helper function: construct a graph from an expression, flags and context.
inline inline
std::unique_ptr<NGHolder> constructGraphWithCC(const std::string &expr, std::unique_ptr<NGHolder> constructGraphWithCC(const std::string &expr,
CompileContext &cc, const CompileContext &cc,
unsigned flags) { unsigned flags) {
ReportManager rm(cc.grey); ReportManager rm(cc.grey);
ParsedExpression parsed(0, expr.c_str(), flags, 0); ParsedExpression parsed(0, expr.c_str(), flags, 0);

View File

@ -152,7 +152,7 @@ TEST(state_compress, m128_1) {
TEST(state_compress, m128_2) { TEST(state_compress, m128_2) {
char buf[sizeof(m128)] = { 0 }; char buf[sizeof(m128)] = { 0 };
char val_raw[16] = { '0', '1', '2', '3', '4', '5', '6', '7', const char val_raw[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
m128 val; m128 val;
memcpy(&val, val_raw, sizeof(val)); memcpy(&val, val_raw, sizeof(val));
@ -228,7 +228,7 @@ TEST(state_compress, m256_1) {
TEST(state_compress, m256_2) { TEST(state_compress, m256_2) {
char buf[sizeof(m256)] = { 0 }; char buf[sizeof(m256)] = { 0 };
char val_raw[32] = { '0', '1', '2', '3', '4', '5', '6', '7', const char val_raw[32] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' }; 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' };
@ -306,7 +306,7 @@ TEST(state_compress, m384_1) {
TEST(state_compress, m384_2) { TEST(state_compress, m384_2) {
char buf[sizeof(m384)] = { 0 }; char buf[sizeof(m384)] = { 0 };
char val_raw[48] = { '0', '1', '2', '3', '4', '5', '6', '7', const char val_raw[48] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
@ -386,7 +386,7 @@ TEST(state_compress, m512_1) {
TEST(state_compress, m512_2) { TEST(state_compress, m512_2) {
char buf[sizeof(m512)] = { 0 }; char buf[sizeof(m512)] = { 0 };
char val_raw[64] = { '0', '1', '2', '3', '4', '5', '6', '7', const char val_raw[64] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',

View File

@ -861,7 +861,7 @@ bool isUtf8CodePoint(const char c) {
} }
static static
bool canReach(const NGHolder &g, const NFAEdge &e, struct fmstate &state) { bool canReach(const NGHolder &g, const NFAEdge &e, const struct fmstate &state) {
auto flags = g[e].assert_flags; auto flags = g[e].assert_flags;
if (!flags) { if (!flags) {
return true; return true;