* to pass in the pattern that was being searched for so we can print it out.
*/
static int eventHandler(unsigned int id, unsigned long long from,
- unsigned long long to, unsigned int flags, void *ctx) {
+ unsigned long long to, unsigned int flags, void *ctx) { // cppcheck-suppress constParameterCallback
printf("Match for pattern \"%s\" at offset %llu\n", (char *)ctx, to);
return 0;
}
}
static really_inline
-void dumpZoneInfo(UNUSED struct zone *z, UNUSED size_t zone_id) {
+void dumpZoneInfo(UNUSED const struct zone *z, UNUSED size_t zone_id) {
#ifdef DEBUG
DEBUG_PRINTF("zone: zone=%zu, bufPtr=%p\n", zone_id, z->buf);
DEBUG_PRINTF("zone: startPtr=%p, endPtr=%p, shift=%u\n",
DEBUG_PRINTF("got %zu/%zu in 2nd buffer\n", delta, len);
*start += delta;
} else if (hlen) {
- UNUSED size_t remaining = offset + ptr2 - found;
- DEBUG_PRINTF("got %zu/%zu remaining in 1st buffer\n", remaining, hlen);
+ DEBUG_PRINTF("got %zu/%zu remaining in 1st buffer\n", offset + ptr2 - found, hlen);
}
}
static really_inline
u64a subCastleNextMatch(const struct Castle *c, const void *full_state,
- void *stream_state, const u64a loc,
+ const void *stream_state, const u64a loc,
const u32 subIdx) {
DEBUG_PRINTF("subcastle %u\n", subIdx);
const struct SubCastle *sub = getSubCastle(c, subIdx);
}
static
-s64a castleLastKillLoc(const struct Castle *c, struct mq *q) {
+s64a castleLastKillLoc(const struct Castle *c, const struct mq *q) {
assert(q_cur_type(q) == MQE_START);
assert(q_last_type(q) == MQE_END);
s64a sp = q_cur_loc(q);
}
static
-void translateRawReports(UNUSED GoughGraph &cfg, UNUSED const raw_som_dfa &raw,
+void translateRawReports(UNUSED const GoughGraph &cfg, UNUSED const raw_som_dfa &raw,
const flat_map<u32, GoughSSAVarJoin *> &joins_at_s,
UNUSED GoughVertex s,
const set<som_report> &reports_in,
}
static
+// cppcheck-suppress constParameterReference
void copy_propagate_report_set(vector<pair<ReportID, GoughSSAVar *> > &rep) {
vector<pair<ReportID, GoughSSAVar *> >::iterator it = rep.begin();
while (it != rep.end()) {
return nullptr;
}
-const flat_set<GoughEdge> &GoughSSAVarJoin::get_edges_for_input(
- GoughSSAVar *input) const {
+// cppcheck-suppress constParameterPointer
+const flat_set<GoughEdge> &GoughSSAVarJoin::get_edges_for_input(GoughSSAVar *input) const {
return input_map.at(input);
}
template<typename VarP>
void set_initial_slots(const vector<VarP> &vars, u32 *next_slot) {
- for (auto &var : vars) {
+ for (const auto &var : vars) {
assert(var->slot == INVALID_SLOT);
var->slot = (*next_slot)++;
}
char gf_name##_Q(const struct NFA *n, struct mq *q, s64a end); \
char gf_name##_Q2(const struct NFA *n, struct mq *q, s64a end); \
char gf_name##_QR(const struct NFA *n, struct mq *q, ReportID report); \
- char gf_name##_reportCurrent(const struct NFA *n, struct mq *q); \
+ char gf_name##_reportCurrent(const struct NFA *n, const struct mq *q); \
char gf_name##_inAccept(const struct NFA *n, ReportID report, \
struct mq *q); \
char gf_name##_inAnyAccept(const struct NFA *n, struct mq *q); \
context);
}
-char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, struct mq *q) {
+char JOIN(LIMEX_API_ROOT, _reportCurrent)(const struct NFA *n, const struct mq *q) {
const IMPL_NFA_T *limex = getImplNfa(n);
REPORTCURRENT_FN(limex, q);
return 1;
static
dstate_id_t find_sheng_states(dfa_info &info,
- map<dstate_id_t, AccelScheme> &accel_escape_info,
+ const map<dstate_id_t, AccelScheme> &accel_escape_info,
size_t max_sheng_states) {
RdfaGraph g(info.raw);
auto cyclics = find_vertices_in_cycles(g);
template <typename T>
static
-u8 getShengState(UNUSED dstate &state, UNUSED dfa_info &info,
- UNUSED map<dstate_id_t, AccelScheme> &accelInfo) {
+u8 getShengState(UNUSED const dstate &state, UNUSED dfa_info &info,
+ UNUSED const map<dstate_id_t, AccelScheme> &accelInfo) {
return 0;
}
template <>
-u8 getShengState<sheng>(dstate &state, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo) {
+u8 getShengState<sheng>(const dstate &state, dfa_info &info,
+ const map<dstate_id_t, AccelScheme> &accelInfo) {
u8 s = state.impl_id;
if (!state.reports.empty()) {
s |= SHENG_STATE_ACCEPT;
}
template <>
-u8 getShengState<sheng32>(dstate &state, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo) {
+u8 getShengState<sheng32>(const dstate &state, dfa_info &info,
+ const map<dstate_id_t, AccelScheme> &accelInfo) {
u8 s = state.impl_id;
if (!state.reports.empty()) {
s |= SHENG32_STATE_ACCEPT;
}
template <>
-u8 getShengState<sheng64>(dstate &state, dfa_info &info,
- UNUSED map<dstate_id_t, AccelScheme> &accelInfo) {
+u8 getShengState<sheng64>(const dstate &state, dfa_info &info,
+ UNUSED const map<dstate_id_t, AccelScheme> &accelInfo) {
u8 s = state.impl_id;
if (!state.reports.empty()) {
s |= SHENG64_STATE_ACCEPT;
template <typename T>
static
-void populateBasicInfo(UNUSED struct NFA *n, UNUSED dfa_info &info,
- UNUSED map<dstate_id_t, AccelScheme> &accelInfo,
+void populateBasicInfo(UNUSED struct NFA *n, UNUSED dfa_info &info, // cppcheck-suppress constParameterPointer
+ UNUSED const map<dstate_id_t, AccelScheme> &accelInfo,
UNUSED u32 aux_offset, UNUSED u32 report_offset,
UNUSED u32 accel_offset, UNUSED u32 total_size,
UNUSED u32 dfa_size) {
template <>
void populateBasicInfo<sheng>(struct NFA *n, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo,
+ const map<dstate_id_t, AccelScheme> &accelInfo,
u32 aux_offset, u32 report_offset,
u32 accel_offset, u32 total_size,
u32 dfa_size) {
template <>
void populateBasicInfo<sheng32>(struct NFA *n, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo,
+ const map<dstate_id_t, AccelScheme> &accelInfo,
u32 aux_offset, u32 report_offset,
u32 accel_offset, u32 total_size,
u32 dfa_size) {
template <>
void populateBasicInfo<sheng64>(struct NFA *n, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo,
+ const map<dstate_id_t, AccelScheme> &accelInfo,
u32 aux_offset, u32 report_offset,
u32 accel_offset, u32 total_size,
u32 dfa_size) {
template <typename T>
static
-bool createShuffleMasks(UNUSED T *s, UNUSED dfa_info &info,
- UNUSED map<dstate_id_t, AccelScheme> &accelInfo) {
+bool createShuffleMasks(UNUSED T *s, UNUSED dfa_info &info, // cppcheck-suppress constParameterPointer
+ UNUSED const map<dstate_id_t, AccelScheme> &accelInfo) {
return true;
}
template <>
bool createShuffleMasks<sheng>(sheng *s, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo) {
+ const map<dstate_id_t, AccelScheme> &accelInfo) {
for (u16 chr = 0; chr < 256; chr++) {
u8 buf[16] = {0};
for (dstate_id_t idx = 0; idx < info.size(); idx++) {
- auto &succ_state = info.next(idx, chr);
+ const auto &succ_state = info.next(idx, chr);
buf[idx] = getShengState<sheng>(succ_state, info, accelInfo);
}
template <>
bool createShuffleMasks<sheng32>(sheng32 *s, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo) {
+ const map<dstate_id_t, AccelScheme> &accelInfo) {
for (u16 chr = 0; chr < 256; chr++) {
u8 buf[64] = {0};
assert(info.size() <= 32);
for (dstate_id_t idx = 0; idx < info.size(); idx++) {
- auto &succ_state = info.next(idx, chr);
+ const auto &succ_state = info.next(idx, chr);
buf[idx] = getShengState<sheng32>(succ_state, info, accelInfo);
buf[32 + idx] = buf[idx];
template <>
bool createShuffleMasks<sheng64>(sheng64 *s, dfa_info &info,
- map<dstate_id_t, AccelScheme> &accelInfo) {
+ const map<dstate_id_t, AccelScheme> &accelInfo) {
for (u16 chr = 0; chr < 256; chr++) {
u8 buf[64] = {0};
assert(info.size() <= 64);
for (dstate_id_t idx = 0; idx < info.size(); idx++) {
- auto &succ_state = info.next(idx, chr);
+ const auto &succ_state = info.next(idx, chr);
if (accelInfo.find(info.raw_id(succ_state.impl_id))
!= accelInfo.end()) {
/** Transform (1), removal of redundant vertices. */
static
-bool doUselessMergePass(NGHolder &g, som_type som, VertexInfoMap &infoMap,
+bool doUselessMergePass(const NGHolder &g, const som_type som, VertexInfoMap &infoMap,
set<NFAVertex> &removable) {
/* useless merges can be done in any order, no need to take any care with
* ordering */
* rewire the straw to start instead of removing the startDs self-loop.
*/
static
-bool improveLeadingRepeatOutfix(NGHolder &g, BoundedRepeatData &rd,
+bool improveLeadingRepeatOutfix(NGHolder &g, const BoundedRepeatData &rd,
unordered_set<NFAVertex> &created,
const vector<BoundedRepeatData> &all_repeats) {
assert(g.kind == NFA_OUTFIX);
u64a top_squash_distance, u64a end,
char in_catchup) {
assert(event == MQE_TOP || event >= MQE_TOP_FIRST);
- struct core_info *ci = &scratch->core_info;
+ const struct core_info *ci = &scratch->core_info;
u8 *aa = getActiveLeafArray(t, scratch->core_info.state);
u32 aaCount = t->activeArrayCount;
}
bytecode_ptr<anchored_matcher_info>
-buildAnchoredMatcher(RoseBuildImpl &build, const vector<LitFragment> &fragments,
+buildAnchoredMatcher(const RoseBuildImpl &build, const vector<LitFragment> &fragments,
vector<raw_dfa> &dfas) {
const CompileContext &cc = build.cc;
* given in litPrograms.
*/
bytecode_ptr<anchored_matcher_info>
-buildAnchoredMatcher(RoseBuildImpl &build,
+buildAnchoredMatcher(const RoseBuildImpl &build,
const std::vector<LitFragment> &fragments,
std::vector<raw_dfa> &dfas);
const map<pair<const NFA *, u32>, u32> &out_top_remap,
const bool is_suffix) {
u32 i = 0;
- for (const auto &n : tamaInfo.subengines) {
+ for (const auto *n : tamaInfo.subengines) {
for (const auto &v : subengines[i].vertices) {
if (is_suffix) {
tamaProto.add(n, g[v].index, g[v].suffix.top, out_top_remap);
}
static
-RoseProgram makeFragmentProgram(const RoseBuildImpl &build, build_context &bc,
+RoseProgram makeFragmentProgram(const RoseBuildImpl &build, const build_context &bc,
ProgramBuild &prog_build,
const vector<u32> &lit_ids,
const vector<vector<RoseEdge>> &lit_edge_map) {
return;
}
- RoseGraph &g = tbi.g;
+ const RoseGraph &g = tbi.g;
LeftfixBouquet nfa_leftfixes;
SuffixBouquet suffixes;
- RoseGraph &g = tbi.g;
+ const RoseGraph &g = tbi.g;
for (auto v : vertices_range(g)) {
shared_ptr<NGHolder> h = g[v].suffix.graph;
return;
}
- RoseGraph &g = tbi.g;
+ const RoseGraph &g = tbi.g;
SuffixBouquet suffixes;
for (auto v : vertices_range(g)) {
build.g[a].index, build.g[b].index);
assert(a != b);
- RoseGraph &g = build.g;
+ const RoseGraph &g = build.g;
const LeftEngInfo &a_left = g[a].left;
const LeftEngInfo &b_left = g[b].left;
void aliasRoles(RoseBuildImpl &build, bool mergeRoses) {
const CompileContext &cc = build.cc;
- RoseGraph &g = build.g;
+ const RoseGraph &g = build.g;
assert(!hasOrphanedTops(build));
assert(canImplementGraphs(build));
struct hs_scratch *scratch, u32 qi,
const struct LeftNfaInfo *left,
const struct NFA *nfa) {
- struct core_info *ci = &scratch->core_info;
+ const struct core_info *ci = &scratch->core_info;
const u32 qCount = t->queueCount;
struct mq *q = scratch->queues + qi;
const struct LeftNfaInfo *left) {
assert(!left->transient); // active roses only
- struct core_info *ci = &scratch->core_info;
+ const struct core_info *ci = &scratch->core_info;
const u32 qCount = t->queueCount;
struct mq *q = scratch->queues + qi;
const struct NFA *nfa = getNfaByQueue(t, qi);
static
int HS_CDECL null_onEvent(UNUSED unsigned id, UNUSED unsigned long long from,
UNUSED unsigned long long to, UNUSED unsigned flags,
- UNUSED void *ctxt) {
+ UNUSED void *ctxt) { // cppcheck-suppress constParameterCallback
return 0;
}
static really_inline
-void rawEodExec(hs_stream_t *id, hs_scratch_t *scratch) {
+void rawEodExec(const hs_stream_t *id, hs_scratch_t *scratch) {
const struct RoseEngine *rose = id->rose;
if (can_stop_matching(scratch)) {
}
static never_inline
-void soleOutfixEodExec(hs_stream_t *id, hs_scratch_t *scratch) {
+void soleOutfixEodExec(const hs_stream_t *id, hs_scratch_t *scratch) {
const struct RoseEngine *t = id->rose;
if (can_stop_matching(scratch)) {
/** Process command-line arguments. Prints usage and exits on error. */
static
void processArgs(int argc, char *argv[], vector<BenchmarkSigs> &sigSets,
- UNUSED unique_ptr<Grey> &grey) {
+ UNUSED const unique_ptr<Grey> &grey) {
const char options[] = "-b:c:Cd:e:E:G:hHi:n:No:p:PsS:Vw:z:"
#if defined(HAVE_DECL_PTHREAD_SETAFFINITY_NP)
"T:" // add the thread flag
}
static
-void processArgs(int argc, char *argv[], UNUSED unique_ptr<Grey> &grey) {
+void processArgs(int argc, char *argv[], UNUSED const unique_ptr<Grey> &grey) {
const char options[] = "e:E:s:z:hHLNV8G:T:BC";
bool signatureSet = false;
int literalFlag = 0;
static
void getAcceptMatches(const NGHolder &g, MatchSet &matches,
- struct fmstate &state, NFAVertex accept_vertex,
+ const struct fmstate &state, NFAVertex accept_vertex,
vector<StateSet::State> &active_states) {
assert(accept_vertex == g.accept || accept_vertex == g.acceptEod);