Fix/Suppress remaining Cppcheck warnings (#291)

Fix/suppress the following cppcheck warnings:

* arithOperationsOnVoidPointer
* uninitMember
* const*
* shadowVariable
* assignmentIntegerToAddress
* containerOutOfBounds
* pointer-related warnings in Ragel source
* missingOverride
* memleak
* knownConditionTrueFalse
* noExplicitConstructor
* invalidPrintfArgType_sint
* useStlAlgorithm
* cstyleCast
* clarifyCondition
* VSX-related cstyleCast
* unsignedLessThanZero 

Furthermore, we added a suppression list to be used, which also includes the following:
* missingIncludeSystem
* missingInclude
* unmatchedSuppression
This commit is contained in:
Konstantinos Margaritis 2024-05-27 12:23:02 +03:00 committed by GitHub
parent cebc6541c1
commit c837925087
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
78 changed files with 204 additions and 131 deletions

View File

@ -278,7 +278,7 @@ int main(){
// we imitate the noodle unit tests // we imitate the noodle unit tests
std::string str; std::string str;
const size_t char_len = 5; const size_t char_len = 5;
str.resize(char_len + 1); str.resize(char_len + 2);
for (size_t j = 0; j < char_len; j++) { for (size_t j = 0; j < char_len; j++) {
srand(time(NULL)); srand(time(NULL));
int key = rand() % +36; int key = rand() % +36;

View File

@ -61,7 +61,7 @@ public:
std::vector<u8> buf; std::vector<u8> buf;
// Noodle // Noodle
struct hs_scratch scratch; struct hs_scratch scratch{};
ue2::bytecode_ptr<noodTable> nt; ue2::bytecode_ptr<noodTable> nt;
MicroBenchmark(char const *label_, size_t size_) MicroBenchmark(char const *label_, size_t size_)

View File

@ -0,0 +1,12 @@
unknownMacro:*gtest-all.cc
knownConditionTrueFalse:*Parser.rl
knownConditionTrueFalse:*Parser.cpp
variableScope:*Parser.rl
unreadVariable:*control_verbs.cpp
assertWithSideEffect
syntaxError
internalError
checkersReport
missingInclude
missingIncludeSystem
unmatchedSuppression

View File

@ -39,6 +39,7 @@ namespace ue2 {
size_t maxLen(const vector<hwlmLiteral> &lits) { size_t maxLen(const vector<hwlmLiteral> &lits) {
size_t rv = 0; size_t rv = 0;
for (const auto &lit : lits) { for (const auto &lit : lits) {
// cppcheck-suppress useStlAlgorithm
rv = max(rv, lit.s.size()); rv = max(rv, lit.s.size());
} }
return rv; return rv;

View File

@ -113,7 +113,7 @@ void dumpTeddyDupMasks(const u8 *dmsk, u32 numMasks, FILE *f) {
u32 maskWidth = 2; u32 maskWidth = 2;
fprintf(f, " dup nibble masks:\n"); fprintf(f, " dup nibble masks:\n");
for (u32 i = 0; i < numMasks * 2; i++) { for (u32 i = 0; i < numMasks * 2; i++) {
fprintf(f, " -%d%s: ", 1 + i / 2, (i % 2) ? "hi" : "lo"); fprintf(f, " -%u%s: ", 1 + i / 2, (i % 2) ? "hi" : "lo");
for (u32 j = 0; j < 16 * maskWidth * 2; j++) { for (u32 j = 0; j < 16 * maskWidth * 2; j++) {
u8 val = dmsk[i * 16 * maskWidth * 2 + j]; u8 val = dmsk[i * 16 * maskWidth * 2 + j];
for (u32 k = 0; k < 8; k++) { for (u32 k = 0; k < 8; k++) {
@ -131,7 +131,7 @@ void dumpTeddyMasks(const u8 *baseMsk, u32 numMasks, u32 maskWidth, FILE *f) {
// dump nibble masks // dump nibble masks
fprintf(f, " nibble masks:\n"); fprintf(f, " nibble masks:\n");
for (u32 i = 0; i < numMasks * 2; i++) { for (u32 i = 0; i < numMasks * 2; i++) {
fprintf(f, " -%d%s: ", 1 + i / 2, (i % 2) ? "hi" : "lo"); fprintf(f, " -%u%s: ", 1 + i / 2, (i % 2) ? "hi" : "lo");
for (u32 j = 0; j < 16 * maskWidth; j++) { for (u32 j = 0; j < 16 * maskWidth; j++) {
u8 val = baseMsk[i * 16 * maskWidth + j]; u8 val = baseMsk[i * 16 * maskWidth + j];
for (u32 k = 0; k < 8; k++) { for (u32 k = 0; k < 8; k++) {

View File

@ -93,6 +93,7 @@ void dumpLits(UNUSED const vector<hwlmLiteral> &lits) {
// Called by an assertion. // Called by an assertion.
static static
bool everyoneHasGroups(const vector<hwlmLiteral> &lits) { bool everyoneHasGroups(const vector<hwlmLiteral> &lits) {
// cppcheck-suppress useStlAlgorithm
for (const auto &lit : lits) { for (const auto &lit : lits) {
if (!lit.groups) { if (!lit.groups) {
return false; return false;

View File

@ -595,6 +595,7 @@ void GoughSSAVarNew::generate(vector<gough_ins> *out) const {
#ifndef NDEBUG #ifndef NDEBUG
template<typename C, typename K> template<typename C, typename K>
bool contains_loose(const C &container, const K &key) { bool contains_loose(const C &container, const K &key) {
// cppcheck-suppress useStlAlgorithm
for (const auto &elem : container) { for (const auto &elem : container) {
if (elem == key) { if (elem == key) {
return true; return true;
@ -986,7 +987,6 @@ void copy_in_blocks(raw_som_dfa &raw, u8 alphaShift, const GoughGraph &cfg,
} }
bool find_normal_self_loop(GoughVertex v, const GoughGraph &g, GoughEdge *out) { bool find_normal_self_loop(GoughVertex v, const GoughGraph &g, GoughEdge *out) {
// cppcheck-suppress useStlAlgorithm
for (const auto &e : out_edges_range(v, g)) { for (const auto &e : out_edges_range(v, g)) {
if (target(e, g) != v) { if (target(e, g) != v) {
continue; continue;

View File

@ -145,6 +145,7 @@ void dump_var_mapping(const GoughGraph &g, const string &base,
fprintf(f, "\tuses:"); fprintf(f, "\tuses:");
vector<u32> used_id; vector<u32> used_id;
for (const GoughSSAVar *var : used) { for (const GoughSSAVar *var : used) {
// cppcheck-suppress useStlAlgorithm
used_id.emplace_back(var->slot); used_id.emplace_back(var->slot);
} }
for (const u32 &id : used_id) { for (const u32 &id : used_id) {
@ -167,6 +168,7 @@ void dump_var_mapping(const GoughGraph &g, const string &base,
fprintf(f, "\tuses:"); fprintf(f, "\tuses:");
vector<u32> used_id; vector<u32> used_id;
for (const GoughSSAVar *var : used) { for (const GoughSSAVar *var : used) {
// cppcheck-suppress useStlAlgorithm
used_id.emplace_back(var->slot); used_id.emplace_back(var->slot);
} }
for (const u32 &id : used_id) { for (const u32 &id : used_id) {

View File

@ -50,8 +50,8 @@ namespace ue2 {
template<typename VarP, typename VarQ> template<typename VarP, typename VarQ>
void emplace_back_all_raw(vector<VarP> *out, const vector<VarQ> &in) { void emplace_back_all_raw(vector<VarP> *out, const vector<VarQ> &in) {
// cppcheck-suppress useStlAlgorithm
for (const auto &var : in) { for (const auto &var : in) {
// cppcheck-suppress useStlAlgorithm
out->emplace_back(var.get()); out->emplace_back(var.get());
} }
} }

View File

@ -336,7 +336,7 @@ void nfaExecGough16_dumpText(const struct NFA *nfa, FILE *f) {
m->state_count, m->length); m->state_count, m->length);
fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored, fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored,
m->start_floating); m->start_floating);
fprintf(f, "single accept: %d\n", !!(int)m->flags & MCCLELLAN_FLAG_SINGLE); fprintf(f, "single accept: %d\n", !!(m->flags & MCCLELLAN_FLAG_SINGLE));
fprintf(f, "sherman_limit: %u, sherman_end: %u\n", m->sherman_limit, fprintf(f, "sherman_limit: %u, sherman_end: %u\n", m->sherman_limit,
m->sherman_end); m->sherman_end);

View File

@ -279,6 +279,7 @@ char JOIN(ENGINE_EXEC_NAME, _Q_i)(const struct NFA *nfa, struct mq *q,
assert(rv == MO_CONTINUE_MATCHING); assert(rv == MO_CONTINUE_MATCHING);
} }
// cppcheck-suppress knownConditionTrueFalse
if (escape_found) { if (escape_found) {
DEBUG_PRINTF("clearing repeat due to escape\n"); DEBUG_PRINTF("clearing repeat due to escape\n");
clearRepeat(info, lstate); clearRepeat(info, lstate);
@ -355,6 +356,7 @@ void JOIN(ENGINE_EXEC_NAME, _StreamSilent)(const struct NFA *nfa, struct mq *q,
size_t eloc = 0; size_t eloc = 0;
char escaped = FWDSCAN_FN(nfa, buf, 0, length, &eloc); char escaped = FWDSCAN_FN(nfa, buf, 0, length, &eloc);
// cppcheck-suppress knownConditionTrueFalse
if (escaped) { if (escaped) {
assert(eloc < length); assert(eloc < length);
DEBUG_PRINTF("escape found at %zu, clearing repeat\n", eloc); DEBUG_PRINTF("escape found at %zu, clearing repeat\n", eloc);

View File

@ -125,6 +125,7 @@ char PROCESS_ACCEPTS_IMPL_FN(const IMPL_NFA_T *limex, const STATE_T *s,
const STATE_T accept_mask = *acceptMask; const STATE_T accept_mask = *acceptMask;
STATE_T accepts = AND_STATE(*s, accept_mask); STATE_T accepts = AND_STATE(*s, accept_mask);
DEBUG_PRINTF("sizeof(STATE_T): %ld, sizeof(CHUNK_T): %ld, NUM_STATE_CHUNKS: %ld\n", sizeof(STATE_T), sizeof(CHUNK_T), NUM_STATE_CHUNKS);
// Caller must ensure that we have at least one accept state on. // Caller must ensure that we have at least one accept state on.
assert(ISNONZERO_STATE(accepts)); assert(ISNONZERO_STATE(accepts));
@ -135,6 +136,7 @@ char PROCESS_ACCEPTS_IMPL_FN(const IMPL_NFA_T *limex, const STATE_T *s,
memcpy(mask_chunks, &accept_mask, sizeof(accept_mask)); memcpy(mask_chunks, &accept_mask, sizeof(accept_mask));
u32 base_index = 0; // Cumulative sum of mask popcount up to current chunk. u32 base_index = 0; // Cumulative sum of mask popcount up to current chunk.
// cppcheck-suppress unsignedLessThanZero
for (u32 i = 0; i < NUM_STATE_CHUNKS; i++) { for (u32 i = 0; i < NUM_STATE_CHUNKS; i++) {
CHUNK_T chunk = chunks[i]; CHUNK_T chunk = chunks[i];
while (chunk != 0) { while (chunk != 0) {
@ -358,6 +360,7 @@ char LIMEX_INACCEPT_FN(const IMPL_NFA_T *limex, STATE_T state,
memcpy(mask_chunks, &accept_mask, sizeof(accept_mask)); memcpy(mask_chunks, &accept_mask, sizeof(accept_mask));
u32 base_index = 0; // Cumulative sum of mask popcount up to current chunk. u32 base_index = 0; // Cumulative sum of mask popcount up to current chunk.
// cppcheck-suppress unsignedLessThanZero
for (u32 i = 0; i < NUM_STATE_CHUNKS; i++) { for (u32 i = 0; i < NUM_STATE_CHUNKS; i++) {
CHUNK_T chunk = chunks[i]; CHUNK_T chunk = chunks[i];
while (chunk != 0) { while (chunk != 0) {

View File

@ -140,6 +140,7 @@ reindexByStateId(const unordered_map<NFAVertex, NFAStateSet> &in,
for (size_t i = m.second.find_first(); i != m.second.npos; for (size_t i = m.second.find_first(); i != m.second.npos;
i = m.second.find_next(i)) { i = m.second.find_next(i)) {
u32 state_id = indexToState[i]; u32 state_id = indexToState[i];
// cppcheck-suppress knownConditionTrueFalse
if (state_id == NO_STATE) { if (state_id == NO_STATE) {
continue; continue;
} }
@ -586,6 +587,7 @@ bool containsBadSubset(const limex_accel_info &accel,
subset = state_set; subset = state_set;
subset.reset(j); subset.reset(j);
// cppcheck-suppress knownConditionTrueFalse
if (effective_sds != NO_STATE && subset.count() == 1 && if (effective_sds != NO_STATE && subset.count() == 1 &&
subset.test(effective_sds)) { subset.test(effective_sds)) {
continue; continue;
@ -1088,6 +1090,7 @@ void buildAccepts(const build_info &args, ReportListCache &reports_cache,
for (auto v : vertices_range(h)) { for (auto v : vertices_range(h)) {
u32 state_id = args.state_ids.at(v); u32 state_id = args.state_ids.at(v);
// cppcheck-suppress knownConditionTrueFalse
if (state_id == NO_STATE || !is_match_vertex(v, h)) { if (state_id == NO_STATE || !is_match_vertex(v, h)) {
continue; continue;
} }
@ -1147,6 +1150,7 @@ u32 compressedStateSize(const NGHolder &h, const NFAStateSet &maskedStates,
for (auto v : vertices_range(h)) { for (auto v : vertices_range(h)) {
u32 i = state_ids.at(v); u32 i = state_ids.at(v);
// cppcheck-suppress knownConditionTrueFalse
if (i == NO_STATE || maskedStates.test(i)) { if (i == NO_STATE || maskedStates.test(i)) {
continue; continue;
} }
@ -1172,6 +1176,7 @@ bool hasSquashableInitDs(const build_info &args) {
NFAStateSet initDs(args.num_states); NFAStateSet initDs(args.num_states);
u32 sds_state = args.state_ids.at(h.startDs); u32 sds_state = args.state_ids.at(h.startDs);
// cppcheck-suppress knownConditionTrueFalse
if (sds_state == NO_STATE) { if (sds_state == NO_STATE) {
DEBUG_PRINTF("no states in initds\n"); DEBUG_PRINTF("no states in initds\n");
return false; return false;
@ -1232,6 +1237,7 @@ void findMaskedCompressionStates(const build_info &args,
// Rose leftfixes can mask out initds, which is worth doing if it will // Rose leftfixes can mask out initds, which is worth doing if it will
// stay on forever (i.e. it's not squashable). // stay on forever (i.e. it's not squashable).
u32 sds_i = args.state_ids.at(h.startDs); u32 sds_i = args.state_ids.at(h.startDs);
// cppcheck-suppress knownConditionTrueFalse
if (sds_i != NO_STATE && !hasSquashableInitDs(args)) { if (sds_i != NO_STATE && !hasSquashableInitDs(args)) {
maskedStates.set(sds_i); maskedStates.set(sds_i);
DEBUG_PRINTF("masking out initds state\n"); DEBUG_PRINTF("masking out initds state\n");
@ -1247,6 +1253,7 @@ void findMaskedCompressionStates(const build_info &args,
for (const auto &e : edges_range(h)) { for (const auto &e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h)); u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h)); u32 to = args.state_ids.at(target(e, h));
// cppcheck-suppress knownConditionTrueFalse
if (from == NO_STATE) { if (from == NO_STATE) {
continue; continue;
} }
@ -1254,6 +1261,7 @@ void findMaskedCompressionStates(const build_info &args,
// We cannot mask out EOD accepts, as they have to perform an // We cannot mask out EOD accepts, as they have to perform an
// action after they're switched on that may be delayed until the // action after they're switched on that may be delayed until the
// next stream write. // next stream write.
// cppcheck-suppress knownConditionTrueFalse
if (to == NO_STATE && target(e, h) != h.acceptEod) { if (to == NO_STATE && target(e, h) != h.acceptEod) {
continue; continue;
} }
@ -1404,6 +1412,7 @@ u32 buildExceptionMap(const build_info &args, ReportListCache &reports_cache,
for (auto v : vertices_range(h)) { for (auto v : vertices_range(h)) {
const u32 i = args.state_ids.at(v); const u32 i = args.state_ids.at(v);
// cppcheck-suppress knownConditionTrueFalse
if (i == NO_STATE) { if (i == NO_STATE) {
continue; continue;
} }
@ -1487,6 +1496,7 @@ u32 buildExceptionMap(const build_info &args, ReportListCache &reports_cache,
} }
u32 j = args.state_ids.at(w); u32 j = args.state_ids.at(w);
// j can be NO_STATE if args.state_ids.at(w) returns NO_STATE // j can be NO_STATE if args.state_ids.at(w) returns NO_STATE
// cppcheck-suppress knownConditionTrueFalse
if (j == NO_STATE) { if (j == NO_STATE) {
continue; continue;
} }
@ -1559,6 +1569,7 @@ u32 findMaxVarShift(const build_info &args, u32 nShifts) {
for (const auto &e : edges_range(h)) { for (const auto &e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h)); u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h)); u32 to = args.state_ids.at(target(e, h));
// cppcheck-suppress knownConditionTrueFalse
if (from == NO_STATE || to == NO_STATE) { if (from == NO_STATE || to == NO_STATE) {
continue; continue;
} }
@ -1588,6 +1599,7 @@ int getLimexScore(const build_info &args, u32 nShifts) {
for (const auto &e : edges_range(h)) { for (const auto &e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h)); u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h)); u32 to = args.state_ids.at(target(e, h));
// cppcheck-suppress knownConditionTrueFalse
if (from == NO_STATE || to == NO_STATE) { if (from == NO_STATE || to == NO_STATE) {
continue; continue;
} }
@ -1836,6 +1848,7 @@ struct Factory {
u32 s_i = args.state_ids.at(h.start); u32 s_i = args.state_ids.at(h.start);
u32 sds_i = args.state_ids.at(h.startDs); u32 sds_i = args.state_ids.at(h.startDs);
// cppcheck-suppress knownConditionTrueFalse
if (s_i != NO_STATE) { if (s_i != NO_STATE) {
maskSetBit(limex->init, s_i); maskSetBit(limex->init, s_i);
if (is_triggered(h)) { if (is_triggered(h)) {
@ -1843,6 +1856,7 @@ struct Factory {
} }
} }
// cppcheck-suppress knownConditionTrueFalse
if (sds_i != NO_STATE) { if (sds_i != NO_STATE) {
maskSetBit(limex->init, sds_i); maskSetBit(limex->init, sds_i);
maskSetBit(limex->initDS, sds_i); maskSetBit(limex->initDS, sds_i);
@ -1878,6 +1892,7 @@ struct Factory {
for (const auto &e : edges_range(h)) { for (const auto &e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h)); u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h)); u32 to = args.state_ids.at(target(e, h));
// cppcheck-suppress knownConditionTrueFalse
if (from == NO_STATE || to == NO_STATE) { if (from == NO_STATE || to == NO_STATE) {
continue; continue;
} }
@ -1916,6 +1931,7 @@ struct Factory {
for (const auto &e : edges_range(h)) { for (const auto &e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h)); u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h)); u32 to = args.state_ids.at(target(e, h));
// cppcheck-suppress knownConditionTrueFalse
if (from == NO_STATE || to == NO_STATE) { if (from == NO_STATE || to == NO_STATE) {
continue; continue;
} }
@ -2458,6 +2474,7 @@ bool isSane(const NGHolder &h, const map<u32, set<NFAVertex>> &tops,
return false; return false;
} }
const u32 i = state_ids.at(v); const u32 i = state_ids.at(v);
// cppcheck-suppress knownConditionTrueFalse
if (i == NO_STATE) { if (i == NO_STATE) {
continue; continue;
} }
@ -2538,6 +2555,7 @@ bool isFast(const build_info &args) {
continue; continue;
} }
u32 j = args.state_ids.at(w); u32 j = args.state_ids.at(w);
// cppcheck-suppress knownConditionTrueFalse
if (j == NO_STATE) { if (j == NO_STATE) {
continue; continue;
} }

View File

@ -322,6 +322,7 @@ int PE_FN(STATE_ARG, ESTATE_ARG, UNUSED u32 diffmask, STATE_T *succ,
#ifdef ARCH_64_BIT #ifdef ARCH_64_BIT
t >>= 1; // Due to diffmask64, which leaves holes in the bitmask. t >>= 1; // Due to diffmask64, which leaves holes in the bitmask.
#endif #endif
// cppcheck-suppress unsignedLessThanZero
assert(t < ARRAY_LENGTH(chunks)); assert(t < ARRAY_LENGTH(chunks));
CHUNK_T word = chunks[t]; CHUNK_T word = chunks[t];
assert(word != 0); assert(word != 0);

View File

@ -210,6 +210,7 @@ set<ReportID> all_reports(const raw_dfa &rdfa) {
} }
bool has_eod_accepts(const raw_dfa &rdfa) { bool has_eod_accepts(const raw_dfa &rdfa) {
// cppcheck-suppress useStlAlgorithm
for (const auto &ds : rdfa.states) { for (const auto &ds : rdfa.states) {
if (!ds.reports_eod.empty()) { if (!ds.reports_eod.empty()) {
return true; return true;
@ -219,6 +220,7 @@ bool has_eod_accepts(const raw_dfa &rdfa) {
} }
bool has_non_eod_accepts(const raw_dfa &rdfa) { bool has_non_eod_accepts(const raw_dfa &rdfa) {
// cppcheck-suppress useStlAlgorithm
for (const auto &ds : rdfa.states) { for (const auto &ds : rdfa.states) {
if (!ds.reports.empty()) { if (!ds.reports.empty()) {
return true; return true;

View File

@ -360,7 +360,7 @@ void dumpCommonHeader(FILE *f, const mcclellan *m) {
fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored, fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored,
m->start_floating); m->start_floating);
fprintf(f, "single accept: %d, has_accel: %d\n", fprintf(f, "single accept: %d, has_accel: %d\n",
!!(int)m->flags & MCCLELLAN_FLAG_SINGLE, m->has_accel); !!(m->flags & MCCLELLAN_FLAG_SINGLE), m->has_accel);
} }
static static

View File

@ -530,7 +530,7 @@ void dumpCommonHeader(FILE *f, const mcsheng *m) {
fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored, fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored,
m->start_floating); m->start_floating);
fprintf(f, "single accept: %d, has_accel: %d\n", fprintf(f, "single accept: %d, has_accel: %d\n",
!!(int)m->flags & MCSHENG_FLAG_SINGLE, m->has_accel); !!(m->flags & MCSHENG_FLAG_SINGLE), m->has_accel);
fprintf(f, "sheng_end: %hu\n", m->sheng_end); fprintf(f, "sheng_end: %hu\n", m->sheng_end);
fprintf(f, "sheng_accel_limit: %hu\n", m->sheng_accel_limit); fprintf(f, "sheng_accel_limit: %hu\n", m->sheng_accel_limit);
} }
@ -655,7 +655,7 @@ void dumpCommonHeader64(FILE *f, const mcsheng64 *m) {
fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored, fprintf(f, "astart: %hu, fstart: %hu\n", m->start_anchored,
m->start_floating); m->start_floating);
fprintf(f, "single accept: %d, has_accel: %d\n", fprintf(f, "single accept: %d, has_accel: %d\n",
!!(int)m->flags & MCSHENG_FLAG_SINGLE, m->has_accel); !!(m->flags & MCSHENG_FLAG_SINGLE), m->has_accel);
fprintf(f, "sheng_end: %hu\n", m->sheng_end); fprintf(f, "sheng_end: %hu\n", m->sheng_end);
fprintf(f, "sheng_accel_limit: %hu\n", m->sheng_accel_limit); fprintf(f, "sheng_accel_limit: %hu\n", m->sheng_accel_limit);
} }

View File

@ -105,6 +105,7 @@ void writeSentinel(mpv_puffette *out) {
static static
void writeDeadPoint(mpv_kilopuff *out, const vector<raw_puff> &puffs) { void writeDeadPoint(mpv_kilopuff *out, const vector<raw_puff> &puffs) {
for (const auto &puff : puffs) { for (const auto &puff : puffs) {
// cppcheck-suppress useStlAlgorithm
if (puff.unbounded) { /* mpv can never die */ if (puff.unbounded) { /* mpv can never die */
out->dead_point = MPV_DEAD_VALUE; out->dead_point = MPV_DEAD_VALUE;
return; return;
@ -313,6 +314,7 @@ static
const mpv_counter_info &findCounter(const vector<mpv_counter_info> &counters, const mpv_counter_info &findCounter(const vector<mpv_counter_info> &counters,
u32 i) { u32 i) {
for (const auto &counter : counters) { for (const auto &counter : counters) {
// cppcheck-suppress useStlAlgorithm
if (i >= counter.kilo_begin && i < counter.kilo_end) { if (i >= counter.kilo_begin && i < counter.kilo_end) {
return counter; return counter;
} }

View File

@ -138,7 +138,7 @@ template<NFAEngineType t>
static static
string getDescriptionLimEx(const NFA *nfa) { string getDescriptionLimEx(const NFA *nfa) {
const typename NFATraits<t>::implNFA_t *limex = const typename NFATraits<t>::implNFA_t *limex =
(const typename NFATraits<t>::implNFA_t *)getImplNfa(nfa); reinterpret_cast<const typename NFATraits<t>::implNFA_t *>(getImplNfa(nfa));
ostringstream oss; ostringstream oss;
oss << NFATraits<t>::name << "/" << limex->exceptionCount; oss << NFATraits<t>::name << "/" << limex->exceptionCount;
if (limex->repeatCount) { if (limex->repeatCount) {

View File

@ -137,13 +137,13 @@ void dumpTextReverse(const struct NFA *nfa, FILE *f) {
char c2 = nfa->rAccelData.array[1]; char c2 = nfa->rAccelData.array[1];
if (!twofer) { if (!twofer) {
fprintf(f, " \\x%02hhx (%c) ", c1, isprint(c1) ? c1 : '?'); fprintf(f, " \\x%02hhx (%c) ", static_cast<u8>(c1), isprint(c1) ? c1 : '?');
} else { } else {
fprintf(f, " \\x%02hhx\\x%02hhx (%c%c) ", c1, c2, fprintf(f, " \\x%02hhx\\x%02hhx (%c%c) ", static_cast<u8>(c1), static_cast<u8>(c2),
isprint(c1) ? c1 : '?', isprint(c2) ? c2 : '?'); isprint(c1) ? c1 : '?', isprint(c2) ? c2 : '?');
} }
fprintf(f, "offset %hhd\n", nfa->rAccelOffset); fprintf(f, "offset %hhu\n", nfa->rAccelOffset);
} }
} // namespace ue2 } // namespace ue2

View File

@ -44,6 +44,7 @@ void raw_dfa::stripExtraEodReports(void) {
} }
bool raw_dfa::hasEodReports(void) const { bool raw_dfa::hasEodReports(void) const {
// cppcheck-suppress useStlAlgorithm
for (const dstate &ds : states) { for (const dstate &ds : states) {
if (!ds.reports_eod.empty()) { if (!ds.reports_eod.empty()) {
return true; return true;

View File

@ -76,7 +76,7 @@ struct raw_dfa {
u16 alpha_size = 0; /* including special symbols */ u16 alpha_size = 0; /* including special symbols */
/* mapping from input symbol --> equiv class id */ /* mapping from input symbol --> equiv class id */
std::array<u16, ALPHABET_SIZE> alpha_remap; std::array<u16, ALPHABET_SIZE> alpha_remap{};
explicit raw_dfa(nfa_kind k) : kind(k) {} explicit raw_dfa(nfa_kind k) : kind(k) {}
virtual ~raw_dfa(); virtual ~raw_dfa();

View File

@ -232,6 +232,7 @@ public:
// Must all be external reports. // Must all be external reports.
assert(rm); assert(rm);
// cppcheck-suppress useStlAlgorithm
for (const auto &report_id : test_reports) { for (const auto &report_id : test_reports) {
if (!isExternalReport(rm->getReport(report_id))) { if (!isExternalReport(rm->getReport(report_id))) {
return false; return false;
@ -247,6 +248,7 @@ public:
flat_set<ReportID> seen_reports; flat_set<ReportID> seen_reports;
for (const auto &rdfa : nfas) { for (const auto &rdfa : nfas) {
for (const auto &report_id : all_reports(*rdfa)) { for (const auto &report_id : all_reports(*rdfa)) {
// cppcheck-suppress useStlAlgorithm
if (!seen_reports.insert(report_id).second) { if (!seen_reports.insert(report_id).second) {
DEBUG_PRINTF("report %u in several dfas\n", report_id); DEBUG_PRINTF("report %u in several dfas\n", report_id);
return true; return true;

View File

@ -101,7 +101,7 @@ void dumpHeader(FILE *f, const sheng *s) {
fprintf(f, "aux base offset: %u, reports base offset: %u, " fprintf(f, "aux base offset: %u, reports base offset: %u, "
"accel offset: %u\n", "accel offset: %u\n",
s->aux_offset, s->report_offset, s->accel_offset); s->aux_offset, s->report_offset, s->accel_offset);
fprintf(f, "anchored start state: %u, floating start state: %u\n", fprintf(f, "anchored start state: %d, floating start state: %d\n",
s->anchored & SHENG_STATE_MASK, s->floating & SHENG_STATE_MASK); s->anchored & SHENG_STATE_MASK, s->floating & SHENG_STATE_MASK);
fprintf(f, "has accel: %u can die: %u single report: %u\n", fprintf(f, "has accel: %u can die: %u single report: %u\n",
!!(s->flags & SHENG_FLAG_HAS_ACCEL), !!(s->flags & SHENG_FLAG_HAS_ACCEL),
@ -116,7 +116,7 @@ void dumpHeader32(FILE *f, const sheng32 *s) {
fprintf(f, "aux base offset: %u, reports base offset: %u, " fprintf(f, "aux base offset: %u, reports base offset: %u, "
"accel offset: %u\n", "accel offset: %u\n",
s->aux_offset, s->report_offset, s->accel_offset); s->aux_offset, s->report_offset, s->accel_offset);
fprintf(f, "anchored start state: %u, floating start state: %u\n", fprintf(f, "anchored start state: %d, floating start state: %d\n",
s->anchored & SHENG32_STATE_MASK, s->floating & SHENG32_STATE_MASK); s->anchored & SHENG32_STATE_MASK, s->floating & SHENG32_STATE_MASK);
fprintf(f, "has accel: %u can die: %u single report: %u\n", fprintf(f, "has accel: %u can die: %u single report: %u\n",
!!(s->flags & SHENG_FLAG_HAS_ACCEL), !!(s->flags & SHENG_FLAG_HAS_ACCEL),
@ -131,7 +131,7 @@ void dumpHeader64(FILE *f, const sheng64 *s) {
fprintf(f, "aux base offset: %u, reports base offset: %u, " fprintf(f, "aux base offset: %u, reports base offset: %u, "
"accel offset: %u\n", "accel offset: %u\n",
s->aux_offset, s->report_offset, s->accel_offset); s->aux_offset, s->report_offset, s->accel_offset);
fprintf(f, "anchored start state: %u, floating start state: %u\n", fprintf(f, "anchored start state: %d, floating start state: %d\n",
s->anchored & SHENG64_STATE_MASK, s->floating & SHENG64_STATE_MASK); s->anchored & SHENG64_STATE_MASK, s->floating & SHENG64_STATE_MASK);
fprintf(f, "has accel: %u can die: %u single report: %u\n", fprintf(f, "has accel: %u can die: %u single report: %u\n",
!!(s->flags & SHENG_FLAG_HAS_ACCEL), !!(s->flags & SHENG_FLAG_HAS_ACCEL),
@ -182,9 +182,9 @@ void dumpMasks(FILE *f, const sheng *s) {
for (u32 pos = 0; pos < 16; pos++) { for (u32 pos = 0; pos < 16; pos++) {
u8 c = buf[pos]; u8 c = buf[pos];
if (c & SHENG_STATE_FLAG_MASK) { if (c & SHENG_STATE_FLAG_MASK) {
fprintf(f, "%2u* ", c & SHENG_STATE_MASK); fprintf(f, "%2d* ", c & SHENG_STATE_MASK);
} else { } else {
fprintf(f, "%2u ", c & SHENG_STATE_MASK); fprintf(f, "%2d ", c & SHENG_STATE_MASK);
} }
} }
fprintf(f, "\n"); fprintf(f, "\n");
@ -202,9 +202,9 @@ void dumpMasks32(FILE *f, const sheng32 *s) {
for (u32 pos = 0; pos < 64; pos++) { for (u32 pos = 0; pos < 64; pos++) {
u8 c = buf[pos]; u8 c = buf[pos];
if (c & SHENG32_STATE_FLAG_MASK) { if (c & SHENG32_STATE_FLAG_MASK) {
fprintf(f, "%2u* ", c & SHENG32_STATE_MASK); fprintf(f, "%2d* ", c & SHENG32_STATE_MASK);
} else { } else {
fprintf(f, "%2u ", c & SHENG32_STATE_MASK); fprintf(f, "%2d ", c & SHENG32_STATE_MASK);
} }
} }
fprintf(f, "\n"); fprintf(f, "\n");
@ -222,9 +222,9 @@ void dumpMasks64(FILE *f, const sheng64 *s) {
for (u32 pos = 0; pos < 64; pos++) { for (u32 pos = 0; pos < 64; pos++) {
u8 c = buf[pos]; u8 c = buf[pos];
if (c & SHENG64_STATE_FLAG_MASK) { if (c & SHENG64_STATE_FLAG_MASK) {
fprintf(f, "%2u* ", c & SHENG64_STATE_MASK); fprintf(f, "%2d* ", c & SHENG64_STATE_MASK);
} else { } else {
fprintf(f, "%2u ", c & SHENG64_STATE_MASK); fprintf(f, "%2d ", c & SHENG64_STATE_MASK);
} }
} }
fprintf(f, "\n"); fprintf(f, "\n");
@ -358,7 +358,7 @@ void dumpDotPreambleDfa(FILE *f) {
template <typename T> template <typename T>
static static
void describeNode(UNUSED const NFA *n, UNUSED const T *s, UNUSED u16 i, void describeNode(UNUSED const NFA *n, UNUSED const T *s, UNUSED u16 i,
UNUSED FILE *f) { UNUSED FILE *f) { // cppcheck-suppress constParameterPointer
} }
template <> template <>

View File

@ -299,7 +299,7 @@ char nfaExecTamarama_QR(const struct NFA *n, struct mq *q, ReportID report) {
rv = nfaQueueExecRose(q1.nfa, &q1, report); rv = nfaQueueExecRose(q1.nfa, &q1, report);
} }
DEBUG_PRINTF("exec rose rv:%u\n", rv); DEBUG_PRINTF("exec rose rv:%d\n", rv);
return rv; return rv;
} }

View File

@ -131,7 +131,7 @@ buildTamarama(const TamaInfo &tamaInfo, const u32 queue,
sizeof(u32) * subSize + 64; // offsets to subengines in bytecode and sizeof(u32) * subSize + 64; // offsets to subengines in bytecode and
// padding for subengines // padding for subengines
auto subl = [](size_t z, NFA *sub) { auto subl = [](size_t z, const NFA *sub) {
return z + (size_t)(ROUNDUP_CL(sub->length)); return z + (size_t)(ROUNDUP_CL(sub->length));
}; };
total_size += std::accumulate(tamaInfo.subengines.begin(), tamaInfo.subengines.end(), 0, subl); total_size += std::accumulate(tamaInfo.subengines.begin(), tamaInfo.subengines.end(), 0, subl);

View File

@ -220,6 +220,7 @@ bool inIsIrreducible(const NFAVertex &v, const NGHolder &g) {
* just a chain of vertices with no other edges. */ * just a chain of vertices with no other edges. */
static static
bool isIrreducible(const NGHolder &g) { bool isIrreducible(const NGHolder &g) {
// cppcheck-suppress useStlAlgorithm
for (auto v : vertices_range(g)) { for (auto v : vertices_range(g)) {
// skip specials // skip specials
if (is_special(v, g)) { if (is_special(v, g)) {
@ -244,11 +245,13 @@ bool isIrreducible(const NGHolder &g) {
#ifndef NDEBUG #ifndef NDEBUG
static static
bool hasEdgeAsserts(NFAVertex v, const NGHolder &g) { bool hasEdgeAsserts(NFAVertex v, const NGHolder &g) {
// cppcheck-suppress useStlAlgorithm
for (const auto &e : in_edges_range(v, g)) { for (const auto &e : in_edges_range(v, g)) {
if (g[e].assert_flags != 0) { if (g[e].assert_flags != 0) {
return true; return true;
} }
} }
// cppcheck-suppress useStlAlgorithm
for (const auto &e : out_edges_range(v, g)) { for (const auto &e : out_edges_range(v, g)) {
if (g[e].assert_flags != 0) { if (g[e].assert_flags != 0) {
return true; return true;

View File

@ -114,6 +114,7 @@ public:
nfa_kind kind; /* Role that this plays in Rose */ nfa_kind kind; /* Role that this plays in Rose */
// cppcheck-suppress duplInheritedMember
static const size_t N_SPECIAL_VERTICES = N_SPECIALS; static const size_t N_SPECIAL_VERTICES = N_SPECIALS;
public: public:
const vertex_descriptor start; //!< Anchored start vertex. const vertex_descriptor start; //!< Anchored start vertex.

View File

@ -106,6 +106,7 @@ bool sanityCheckGraph(const NGHolder &g,
return false; return false;
} }
u32 s = state_ids.at(v); u32 s = state_ids.at(v);
// cppcheck-suppress knownConditionTrueFalse
if (s != NO_STATE && !seen_states.insert(s).second) { if (s != NO_STATE && !seen_states.insert(s).second) {
DEBUG_PRINTF("vertex %zu has dupe state %u\n", g[v].index, s); DEBUG_PRINTF("vertex %zu has dupe state %u\n", g[v].index, s);
return false; return false;
@ -392,8 +393,8 @@ void reusePredsAsStarts(const NGHolder &g, const map<u32, CharReach> &top_reach,
auto cands = [&g=g](const NFAVertex &u) { auto cands = [&g=g](const NFAVertex &u) {
return (hasSelfLoop(u, g)); return (hasSelfLoop(u, g));
}; };
const auto &u = unhandled_succ_tops | map_keys; const auto &ust = unhandled_succ_tops | map_keys;
std::copy_if(begin(u), end(u), std::back_inserter(cand_starts), cands); std::copy_if(begin(ust), end(ust), std::back_inserter(cand_starts), cands);
for (NFAVertex u : cand_starts) { for (NFAVertex u : cand_starts) {
if (!contains(unhandled_succ_tops, u)) { if (!contains(unhandled_succ_tops, u)) {

View File

@ -463,6 +463,7 @@ void blowoutPathsLessStrictSegment(vector<vector<CharReach> > &paths) {
/* paths segments which are a superset of an earlier segment should never be /* paths segments which are a superset of an earlier segment should never be
* picked as an acceleration segment -> to improve processing just replace * picked as an acceleration segment -> to improve processing just replace
* with dot */ * with dot */
// cppcheck-suppress constVariableReference
for (auto &p : paths) { for (auto &p : paths) {
for (auto it = p.begin(); it != p.end(); ++it) { for (auto it = p.begin(); it != p.end(); ++it) {
for (auto jt = next(it); jt != p.end(); ++jt) { for (auto jt = next(it); jt != p.end(); ++jt) {

View File

@ -360,8 +360,8 @@ u64a litUniqueness(const string &s) {
static static
u64a litCountBits(const ue2_literal &lit) { u64a litCountBits(const ue2_literal &lit) {
u64a n = 0; u64a n = 0;
// cppcheck-suppress useStlAlgorithm
for (const auto &c : lit) { for (const auto &c : lit) {
// cppcheck-suppress useStlAlgorithm
n += c.nocase ? 7 : 8; n += c.nocase ? 7 : 8;
} }
return n; return n;
@ -491,8 +491,8 @@ vector<LitEdge> add_reverse_edges_and_index(LitGraph &lg) {
vector<LitEdge> fwd_edges; vector<LitEdge> fwd_edges;
fwd_edges.reserve(edge_count); fwd_edges.reserve(edge_count);
const auto &e = edges_range(lg); const auto &er = edges_range(lg);
std::copy(begin(e), end(e), std::back_inserter(fwd_edges)); std::copy(begin(er), end(er), std::back_inserter(fwd_edges));
vector<LitEdge> rev_map(2 * edge_count); vector<LitEdge> rev_map(2 * edge_count);
@ -881,6 +881,7 @@ bool literalIsWholeGraph(const NGHolder &g, const ue2_literal &lit) {
} }
// Our last value for v should have only start states for predecessors. // Our last value for v should have only start states for predecessors.
// cppcheck-suppress useStlAlgorithm
for (auto u : inv_adjacent_vertices_range(v, g)) { for (auto u : inv_adjacent_vertices_range(v, g)) {
if (!is_any_start(u, g)) { if (!is_any_start(u, g)) {
DEBUG_PRINTF("pred is not start\n"); DEBUG_PRINTF("pred is not start\n");

View File

@ -131,6 +131,7 @@ bool findPaths(const NGHolder &g, vector<Path> &paths) {
static static
bool hasLargeDegreeVertex(const NGHolder &g) { bool hasLargeDegreeVertex(const NGHolder &g) {
// cppcheck-suppress useStlAlgorithm
for (const auto &v : vertices_range(g)) { for (const auto &v : vertices_range(g)) {
if (is_special(v, g)) { // specials can have large degree if (is_special(v, g)) { // specials can have large degree
continue; continue;

View File

@ -129,6 +129,7 @@ void calculateAlphabet(const NGHolder &g, array<u16, ALPHABET_SIZE> &alpha,
static static
bool allExternalReports(const ReportManager &rm, bool allExternalReports(const ReportManager &rm,
const flat_set<ReportID> &reports) { const flat_set<ReportID> &reports) {
// cppcheck-suppress useStlAlgorithm
for (auto report_id : reports) { for (auto report_id : reports) {
if (!isExternalReport(rm.getReport(report_id))) { if (!isExternalReport(rm.getReport(report_id))) {
return false; return false;
@ -327,6 +328,7 @@ void markToppableStarts(const NGHolder &g, const flat_set<NFAVertex> &unused,
continue; continue;
} }
for (const auto &trigger : triggers) { for (const auto &trigger : triggers) {
// cppcheck-suppress useStlAlgorithm
if (triggerAllowed(g, v, triggers, trigger)) { if (triggerAllowed(g, v, triggers, trigger)) {
DEBUG_PRINTF("idx %zu is valid location for top\n", g[v].index); DEBUG_PRINTF("idx %zu is valid location for top\n", g[v].index);
out->set(g[v].index); out->set(g[v].index);

View File

@ -482,6 +482,7 @@ vector<CharReach> reduced_cr(const NGHolder &g,
static static
bool anyOutSpecial(NFAVertex v, const NGHolder &g) { bool anyOutSpecial(NFAVertex v, const NGHolder &g) {
// cppcheck-suppress useStlAlgorithm
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) {
return true; return true;

View File

@ -115,6 +115,7 @@ bool isRegionEntry(const Graph &g, NFAVertex v,
const std::unordered_map<NFAVertex, u32> &region_map) { const std::unordered_map<NFAVertex, u32> &region_map) {
// Note that some graph types do not have inv_adjacent_vertices, so we must // Note that some graph types do not have inv_adjacent_vertices, so we must
// use in_edges here. // use in_edges here.
// cppcheck-suppress useStlAlgorithm
for (const auto &e : in_edges_range(v, g)) { for (const auto &e : in_edges_range(v, g)) {
if (!inSameRegion(g, v, source(e, g), region_map)) { if (!inSameRegion(g, v, source(e, g), region_map)) {
return true; return true;
@ -128,6 +129,7 @@ bool isRegionEntry(const Graph &g, NFAVertex v,
template <class Graph> template <class Graph>
bool isRegionExit(const Graph &g, NFAVertex v, bool isRegionExit(const Graph &g, NFAVertex v,
const std::unordered_map<NFAVertex, u32> &region_map) { const std::unordered_map<NFAVertex, u32> &region_map) {
// cppcheck-suppress useStlAlgorithm
for (auto w : adjacent_vertices_range(v, g)) { for (auto w : adjacent_vertices_range(v, g)) {
if (!inSameRegion(g, v, w, region_map)) { if (!inSameRegion(g, v, w, region_map)) {
return true; return true;

View File

@ -2181,6 +2181,7 @@ bool hasOverlappingRepeats(UNUSED const NGHolder &g,
DEBUG_PRINTF("already seen pos %zu\n", g[br.pos_trigger].index); DEBUG_PRINTF("already seen pos %zu\n", g[br.pos_trigger].index);
return true; return true;
} }
// cppcheck-suppress useStlAlgorithm
for (auto v : br.tug_triggers) { for (auto v : br.tug_triggers) {
if (contains(involved, v)) { if (contains(involved, v)) {
DEBUG_PRINTF("already seen tug %zu\n", g[v].index); DEBUG_PRINTF("already seen tug %zu\n", g[v].index);

View File

@ -210,7 +210,6 @@ u32 countStates(const unordered_map<NFAVertex, u32> &state_ids) {
u32 max_state = 0; u32 max_state = 0;
for (const auto &m : state_ids) { for (const auto &m : state_ids) {
if (m.second != NO_STATE) { if (m.second != NO_STATE) {
// cppcheck-suppress useStlAlgorithm
max_state = max(m.second, max_state); max_state = max(m.second, max_state);
} }
} }

View File

@ -776,12 +776,14 @@ bool allMatchStatesHaveReports(const NGHolder &g) {
bool isCorrectlyTopped(const NGHolder &g) { bool isCorrectlyTopped(const NGHolder &g) {
if (is_triggered(g)) { if (is_triggered(g)) {
// cppcheck-suppress useStlAlgorithm
for (const auto &e : out_edges_range(g.start, g)) { for (const auto &e : out_edges_range(g.start, g)) {
if (g[e].tops.empty() != (target(e, g) == g.startDs)) { if (g[e].tops.empty() != (target(e, g) == g.startDs)) {
return false; return false;
} }
} }
} else { } else {
// cppcheck-suppress useStlAlgorithm
for (const auto &e : out_edges_range(g.start, g)) { for (const auto &e : out_edges_range(g.start, g)) {
if (!g[e].tops.empty()) { if (!g[e].tops.empty()) {
return false; return false;

View File

@ -164,7 +164,7 @@ ComponentSequence *enterSequence(ComponentSequence *parent,
ComponentSequence *seq = child.get(); ComponentSequence *seq = child.get();
parent->addComponent(std::move(child)); parent->addComponent(std::move(child));
return seq; return seq; // cppcheck-suppress returnDanglingLifetime
} }
static static

View File

@ -99,7 +99,8 @@ public:
const NFABuilder &getBuilder() const override { return builder; } const NFABuilder &getBuilder() const override { return builder; }
/** \brief Wire up the lasts of one component to the firsts of another. */ /** \brief Wire up the lasts of one component to the firsts of another. */
void connectRegions(const vector<PositionInfo> &lasts, // cppcheck-suppress virtualCallInConstructor
virtual void connectRegions(const vector<PositionInfo> &lasts,
const vector<PositionInfo> &firsts) override; const vector<PositionInfo> &firsts) override;
/** \brief Wire the lasts of the main sequence to accepts. */ /** \brief Wire the lasts of the main sequence to accepts. */

View File

@ -108,6 +108,8 @@ const char *read_control_verbs(const char *ptr, const char *end, size_t start,
try { try {
%% write exec; %% write exec;
} catch (LocatedParseError &error) { } catch (LocatedParseError &error) {
// cppcheck-suppress pointerLessThanZero
// cppcheck-suppress pointerPositive
if (ts >= ptr && ts <= pe) { if (ts >= ptr && ts <= pe) {
error.locate(ts - ptr + start); error.locate(ts - ptr + start);
} else { } else {

View File

@ -37,6 +37,7 @@ namespace ue2 {
/** Class representing a component state. */ /** Class representing a component state. */
class PositionInfo { class PositionInfo {
public: public:
// cppcheck-suppress noExplicitConstructor
PositionInfo(unsigned int p) : pos(p), flags(0) {} PositionInfo(unsigned int p) : pos(p), flags(0) {}
bool operator<(const PositionInfo &other) const { bool operator<(const PositionInfo &other) const {

View File

@ -347,6 +347,7 @@ void prefilterTree(unique_ptr<Component> &root, const ParseMode &mode) {
assert(root); assert(root);
PrefilterVisitor vis(root.get(), mode); PrefilterVisitor vis(root.get(), mode);
// cppcheck-suppress constVariablePointer
Component *c = root->accept(vis); Component *c = root->accept(vis);
if (c != root.get()) { if (c != root.get()) {
root.reset(c); root.reset(c);

View File

@ -1496,6 +1496,7 @@ void transformSuffixDelay(RoseInGraph &ig, const CompileContext &cc) {
#ifndef NDEBUG #ifndef NDEBUG
static static
bool validateKinds(const RoseInGraph &g) { bool validateKinds(const RoseInGraph &g) {
// cppcheck-suppress useStlAlgorithm
for (const auto &e : edges_range(g)) { for (const auto &e : edges_range(g)) {
if (g[e].graph && g[e].graph->kind != whatRoseIsThis(g, e)) { if (g[e].graph && g[e].graph->kind != whatRoseIsThis(g, e)) {
return false; return false;
@ -1934,10 +1935,9 @@ bool RoseBuildImpl::addAnchoredAcyclic(const NGHolder &h) {
flat_set<u32> added_lit_ids; /* literal ids added for this NFA */ flat_set<u32> added_lit_ids; /* literal ids added for this NFA */
for (auto v : inv_adjacent_vertices_range(h.accept, h)) { for (auto v : inv_adjacent_vertices_range(h.accept, h)) {
// cppcheck-suppress useStlAlgorithm
if (!prepAcceptForAddAnchoredNFA(*this, h, v, vertexDepths, depthMap, if (!prepAcceptForAddAnchoredNFA(*this, h, v, vertexDepths, depthMap,
reportMap, allocated_reports, reportMap, allocated_reports,
added_lit_ids)) { added_lit_ids)) { // cppcheck-suppress useStlAlgorithm
removeAddedLiterals(*this, added_lit_ids); removeAddedLiterals(*this, added_lit_ids);
return false; return false;
} }

View File

@ -188,7 +188,7 @@ bool expandFmlCandidates(const CharReach &cr, vector<ue2_literal> &curr,
} }
} }
if (curr.back().length() > MAX_MASK2_WIDTH && if (!curr.empty() && curr.back().length() > MAX_MASK2_WIDTH &&
any_of(begin(curr), end(curr), mixed_sensitivity)) { any_of(begin(curr), end(curr), mixed_sensitivity)) {
DEBUG_PRINTF("mixed-sensitivity lit is too long, stopping\n"); DEBUG_PRINTF("mixed-sensitivity lit is too long, stopping\n");
return false; return false;

View File

@ -2457,6 +2457,7 @@ bool hasEodAnchors(const RoseBuildImpl &build, const build_context &bc,
} }
const RoseGraph &g = build.g; const RoseGraph &g = build.g;
// cppcheck-suppress useStlAlgorithm
for (auto v : vertices_range(g)) { for (auto v : vertices_range(g)) {
if (g[v].eod_accept) { if (g[v].eod_accept) {
DEBUG_PRINTF("literally report eod\n"); DEBUG_PRINTF("literally report eod\n");
@ -2975,8 +2976,8 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
if (pfrag.included_frag_id != INVALID_FRAG_ID && if (pfrag.included_frag_id != INVALID_FRAG_ID &&
!lit_prog.empty()) { !lit_prog.empty()) {
const auto &cfrag = fragments[pfrag.included_frag_id]; const auto &cfrag = fragments[pfrag.included_frag_id];
assert(pfrag.s.length() >= cfrag.s.length() && // cppcheck-suppress comparisonOfTwoFuncsReturningBoolError
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase()); assert(pfrag.s.length() >= cfrag.s.length() && !pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
u32 child_offset = cfrag.lit_program_offset; u32 child_offset = cfrag.lit_program_offset;
DEBUG_PRINTF("child %u offset %u\n", cfrag.fragment_id, DEBUG_PRINTF("child %u offset %u\n", cfrag.fragment_id,
child_offset); child_offset);

View File

@ -1325,10 +1325,8 @@ void rehomeAnchoredLiteral(RoseBuildImpl &tbi, const simple_anchored_info &sai,
/* ensure bounds on the vertex's in-edge are correct */ /* ensure bounds on the vertex's in-edge are correct */
assert(in_degree(v, tbi.g) == 1); assert(in_degree(v, tbi.g) == 1);
const RoseEdge &e = *in_edges(v, tbi.g).first; const RoseEdge &e = *in_edges(v, tbi.g).first;
assert(tbi.g[e].minBound == sai.min_bound + sai.literal.length()); tbi.g[e].minBound = sai.min_bound; // cppcheck-suppress danglingTempReference
assert(tbi.g[e].maxBound == sai.max_bound + sai.literal.length()); tbi.g[e].maxBound = sai.max_bound; // cppcheck-suppress danglingTempReference
tbi.g[e].minBound = sai.min_bound;
tbi.g[e].maxBound = sai.max_bound;
} }
/* mark the old literal as empty */ /* mark the old literal as empty */
@ -1632,6 +1630,7 @@ void addAnchoredSmallBlockLiterals(RoseBuildImpl &tbi) {
#ifndef NDEBUG #ifndef NDEBUG
static static
bool historiesAreValid(const RoseGraph &g) { bool historiesAreValid(const RoseGraph &g) {
// cppcheck-suppress useStlAlgorithm
for (const auto &e : edges_range(g)) { for (const auto &e : edges_range(g)) {
if (g[e].history == ROSE_ROLE_HISTORY_INVALID) { if (g[e].history == ROSE_ROLE_HISTORY_INVALID) {
DEBUG_PRINTF("edge [%zu,%zu] has invalid history\n", DEBUG_PRINTF("edge [%zu,%zu] has invalid history\n",
@ -1648,7 +1647,7 @@ bool historiesAreValid(const RoseGraph &g) {
* that no longer exists in the graph. * that no longer exists in the graph.
*/ */
static static
bool danglingVertexRef(RoseBuildImpl &tbi) { bool danglingVertexRef(const RoseBuildImpl &tbi) {
RoseGraph::vertex_iterator vi, ve; RoseGraph::vertex_iterator vi, ve;
tie(vi, ve) = vertices(tbi.g); tie(vi, ve) = vertices(tbi.g);
const unordered_set<RoseVertex> valid_vertices(vi, ve); const unordered_set<RoseVertex> valid_vertices(vi, ve);
@ -1659,6 +1658,7 @@ bool danglingVertexRef(RoseBuildImpl &tbi) {
return true; return true;
} }
// cppcheck-suppress useStlAlgorithm
for (const auto &e : tbi.ghost) { for (const auto &e : tbi.ghost) {
if (!contains(valid_vertices, e.first)) { if (!contains(valid_vertices, e.first)) {
DEBUG_PRINTF("ghost key vertex %zu not in graph\n", DEBUG_PRINTF("ghost key vertex %zu not in graph\n",
@ -1677,6 +1677,7 @@ bool danglingVertexRef(RoseBuildImpl &tbi) {
static static
bool roleOffsetsAreValid(const RoseGraph &g) { bool roleOffsetsAreValid(const RoseGraph &g) {
// cppcheck-suppress useStlAlgorithm
for (auto v : vertices_range(g)) { for (auto v : vertices_range(g)) {
if (g[v].min_offset >= ROSE_BOUND_INF) { if (g[v].min_offset >= ROSE_BOUND_INF) {
DEBUG_PRINTF("invalid min_offset for role %zu\n", g[v].index); DEBUG_PRINTF("invalid min_offset for role %zu\n", g[v].index);

View File

@ -1421,6 +1421,7 @@ void dumpProgram(ofstream &os, const RoseEngine *t, const char *pc) {
os << " base_offset " << ri->base_offset << endl; os << " base_offset " << ri->base_offset << endl;
os << " last_start " << ri->last_start << endl; os << " last_start " << ri->last_start << endl;
os << " fail_jump " << offset + ri->fail_jump << endl; os << " fail_jump " << offset + ri->fail_jump << endl;
// cppcheck-suppress pointerOutOfBounds
dumpMultipathShufti(os, 16, ri->nib_mask, ri->nib_mask + 16, dumpMultipathShufti(os, 16, ri->nib_mask, ri->nib_mask + 16,
ri->bucket_select_mask, ri->bucket_select_mask,
ri->data_select_mask, ri->data_select_mask,
@ -1868,6 +1869,7 @@ void dumpComponentInfoCsv(const RoseEngine *t, const string &base) {
} }
} }
// cppcheck-suppress invalidPrintfArgType_sint
fprintf(f, "%u,%zd,\"%s\",%u,%u,%u,%s,%s\n", i, fprintf(f, "%u,%zd,\"%s\",%u,%u,%u,%s,%s\n", i,
(reinterpret_cast<const char *>(n) - reinterpret_cast<const char *>(t)), describe(*n).c_str(), (reinterpret_cast<const char *>(n) - reinterpret_cast<const char *>(t)), describe(*n).c_str(),
n->nPositions, n->streamStateSize, n->length, n->nPositions, n->streamStateSize, n->length,

View File

@ -140,6 +140,7 @@ static
bool isSuffix(const vector<vector<CharReach>> &triggers1, bool isSuffix(const vector<vector<CharReach>> &triggers1,
const vector<vector<CharReach>> &triggers2) { const vector<vector<CharReach>> &triggers2) {
// literal suffix test // literal suffix test
// cppcheck-suppress useStlAlgorithm
for (const auto &lit1 : triggers1) { for (const auto &lit1 : triggers1) {
// cppcheck-suppress useStlAlgorithm // cppcheck-suppress useStlAlgorithm
for (const auto &lit2 : triggers2) { for (const auto &lit2 : triggers2) {

View File

@ -1027,6 +1027,7 @@ bool hasOrphanedTops(const RoseBuildImpl &build) {
} }
for (const auto &e : leftfixes) { for (const auto &e : leftfixes) {
// cppcheck-suppress useStlAlgorithm
if (all_tops(e.first) != e.second) { if (all_tops(e.first) != e.second) {
DEBUG_PRINTF("rose tops (%s) don't match rose graph (%s)\n", DEBUG_PRINTF("rose tops (%s) don't match rose graph (%s)\n",
as_string_list(all_tops(e.first)).c_str(), as_string_list(all_tops(e.first)).c_str(),
@ -1036,6 +1037,7 @@ bool hasOrphanedTops(const RoseBuildImpl &build) {
} }
for (const auto &e : suffixes) { for (const auto &e : suffixes) {
// cppcheck-suppress useStlAlgorithm
if (all_tops(e.first) != e.second) { if (all_tops(e.first) != e.second) {
DEBUG_PRINTF("suffix tops (%s) don't match rose graph (%s)\n", DEBUG_PRINTF("suffix tops (%s) don't match rose graph (%s)\n",
as_string_list(all_tops(e.first)).c_str(), as_string_list(all_tops(e.first)).c_str(),

View File

@ -737,8 +737,8 @@ void pruneReportIfUnused(const RoseBuildImpl &build, shared_ptr<NGHolder> h,
DEBUG_PRINTF("trying to prune %u from %p (v %zu)\n", report, h.get(), DEBUG_PRINTF("trying to prune %u from %p (v %zu)\n", report, h.get(),
verts.size()); verts.size());
for (RoseVertex v : verts) { for (RoseVertex v : verts) {
// cppcheck-suppress useStlAlgorithm
if (build.g[v].left.graph == h && if (build.g[v].left.graph == h &&
// cppcheck-suppress useStlAlgorithm
build.g[v].left.leftfix_report == report) { build.g[v].left.leftfix_report == report) {
DEBUG_PRINTF("report %u still in use\n", report); DEBUG_PRINTF("report %u still in use\n", report);
return; return;

View File

@ -65,7 +65,7 @@ u32 findMinWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
const RoseGraph &g = tbi.g; const RoseGraph &g = tbi.g;
vector<RoseVertex> table_verts; vector<RoseVertex> table_verts;
auto tvs = [&tbi=tbi, &table=table](const RoseVertex &v) { auto tvs = [&tbi=tbi, table](const RoseVertex &v) {
return (tbi.hasLiteralInTable(v, table)); return (tbi.hasLiteralInTable(v, table));
}; };
const auto &vr = vertices_range(g); const auto &vr = vertices_range(g);
@ -189,7 +189,7 @@ u32 findMaxBAWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
table == ROSE_FLOATING ? "floating" : "anchored"); table == ROSE_FLOATING ? "floating" : "anchored");
vector<RoseVertex> table_verts; vector<RoseVertex> table_verts;
auto tvs = [&tbi=tbi, &table=table](const RoseVertex &v) { auto tvs = [&tbi=tbi, table](const RoseVertex &v) {
return ((table == ROSE_FLOATING && tbi.isFloating(v)) return ((table == ROSE_FLOATING && tbi.isFloating(v))
|| (table == ROSE_ANCHORED && tbi.isAnchored(v))); || (table == ROSE_ANCHORED && tbi.isAnchored(v)));
}; };

View File

@ -82,6 +82,7 @@ void dumpSomSlotManager(const SomSlotManager &ssm, const Grey &grey) {
fprintf(f, "\t shared reset (users = %zu)\n", ir.entries.size()); fprintf(f, "\t shared reset (users = %zu)\n", ir.entries.size());
} else if (contains(by_slot, i)) { } else if (contains(by_slot, i)) {
const SlotCacheEntry &ce = *by_slot.at(i); const SlotCacheEntry &ce = *by_slot.at(i);
// cppcheck-suppress knownConditionTrueFalse
if (ce.parent_slot != SomSlotManager::NO_PARENT) { if (ce.parent_slot != SomSlotManager::NO_PARENT) {
fprintf(f, "\tparent:%u", ce.parent_slot); fprintf(f, "\tparent:%u", ce.parent_slot);
} }

View File

@ -270,22 +270,26 @@ static really_inline m128 andnot128(m128 a, m128 b) {
// aligned load // aligned load
static really_inline m128 load128(const void *ptr) { static really_inline m128 load128(const void *ptr) {
assert(ISALIGNED_N(ptr, alignof(m128))); assert(ISALIGNED_N(ptr, alignof(m128)));
// cppcheck-suppress cstyleCast
return (m128) vld1q_s32((const int32_t *)ptr); return (m128) vld1q_s32((const int32_t *)ptr);
} }
// aligned store // aligned store
static really_inline void store128(void *ptr, m128 a) { static really_inline void store128(void *ptr, m128 a) {
assert(ISALIGNED_N(ptr, alignof(m128))); assert(ISALIGNED_N(ptr, alignof(m128)));
// cppcheck-suppress cstyleCast
vst1q_s32((int32_t *)ptr, a); vst1q_s32((int32_t *)ptr, a);
} }
// unaligned load // unaligned load
static really_inline m128 loadu128(const void *ptr) { static really_inline m128 loadu128(const void *ptr) {
// cppcheck-suppress cstyleCast
return (m128) vld1q_s32((const int32_t *)ptr); return (m128) vld1q_s32((const int32_t *)ptr);
} }
// unaligned store // unaligned store
static really_inline void storeu128(void *ptr, m128 a) { static really_inline void storeu128(void *ptr, m128 a) {
// cppcheck-suppress cstyleCast
vst1q_s32((int32_t *)ptr, a); vst1q_s32((int32_t *)ptr, a);
} }
@ -430,12 +434,14 @@ m128 sub_u8_m128(m128 a, m128 b) {
static really_inline static really_inline
m128 set4x32(u32 x3, u32 x2, u32 x1, u32 x0) { m128 set4x32(u32 x3, u32 x2, u32 x1, u32 x0) {
uint32_t ALIGN_ATTR(16) data[4] = { x0, x1, x2, x3 }; uint32_t ALIGN_ATTR(16) data[4] = { x0, x1, x2, x3 };
// cppcheck-suppress cstyleCast
return (m128) vld1q_u32((uint32_t *) data); return (m128) vld1q_u32((uint32_t *) data);
} }
static really_inline static really_inline
m128 set2x64(u64a hi, u64a lo) { m128 set2x64(u64a hi, u64a lo) {
uint64_t ALIGN_ATTR(16) data[2] = { lo, hi }; uint64_t ALIGN_ATTR(16) data[2] = { lo, hi };
// cppcheck-suppress cstyleCast
return (m128) vld1q_u64((uint64_t *) data); return (m128) vld1q_u64((uint64_t *) data);
} }

View File

@ -255,22 +255,26 @@ static really_inline m128 andnot128(m128 a, m128 b) {
// aligned load // aligned load
static really_inline m128 load128(const void *ptr) { static really_inline m128 load128(const void *ptr) {
assert(ISALIGNED_N(ptr, alignof(m128))); assert(ISALIGNED_N(ptr, alignof(m128)));
// cppcheck-suppress cstyleCast
return (m128) vec_xl(0, (const int32_t*)ptr); return (m128) vec_xl(0, (const int32_t*)ptr);
} }
// aligned store // aligned store
static really_inline void store128(void *ptr, m128 a) { static really_inline void store128(void *ptr, m128 a) {
assert(ISALIGNED_N(ptr, alignof(m128))); assert(ISALIGNED_N(ptr, alignof(m128)));
// cppcheck-suppress cstyleCast
vec_st(a, 0, (int32_t*)ptr); vec_st(a, 0, (int32_t*)ptr);
} }
// unaligned load // unaligned load
static really_inline m128 loadu128(const void *ptr) { static really_inline m128 loadu128(const void *ptr) {
// cppcheck-suppress cstyleCast
return (m128) vec_xl(0, (const int32_t*)ptr); return (m128) vec_xl(0, (const int32_t*)ptr);
} }
// unaligned store // unaligned store
static really_inline void storeu128(void *ptr, m128 a) { static really_inline void storeu128(void *ptr, m128 a) {
// cppcheck-suppress cstyleCast
vec_xst(a, 0, (int32_t*)ptr); vec_xst(a, 0, (int32_t*)ptr);
} }

View File

@ -66,7 +66,6 @@ public:
static depth unreachable() { static depth unreachable() {
depth d; depth d;
d.val = val_unreachable;
return d; return d;
} }
@ -179,7 +178,7 @@ public:
} }
s64a rv = val + d; s64a rv = val + d;
if (rv < 0 || (u64a)rv >= val_infinity) { if ((u64a)rv >= val_infinity) {
DEBUG_PRINTF("depth %lld too large to represent!\n", rv); DEBUG_PRINTF("depth %lld too large to represent!\n", rv);
throw DepthOverflowError(); throw DepthOverflowError();
} }
@ -202,7 +201,7 @@ public:
} }
s64a rv = val - d; s64a rv = val - d;
if (rv < 0 || (u64a)rv >= val_infinity) { if ((u64a)rv >= val_infinity) {
DEBUG_PRINTF("depth %lld too large to represent!\n", rv); DEBUG_PRINTF("depth %lld too large to represent!\n", rv);
throw DepthOverflowError(); throw DepthOverflowError();
} }

View File

@ -227,8 +227,6 @@ void describeClass(ostream &os, const CharReach &incr, size_t maxLength,
int out_count = describeClassInt(out, incr, maxLength, out_type); int out_count = describeClassInt(out, incr, maxLength, out_type);
std::ostringstream neg; std::ostringstream neg;
UNUSED int neg_count = describeClassInt(neg, ~incr, maxLength, out_type);
if (out.tellp() <= neg.tellp()) { if (out.tellp() <= neg.tellp()) {
if (out_count > 1) { if (out_count > 1) {
os << '[' << out.str() << ']'; os << '[' << out.str() << ']';

View File

@ -62,6 +62,7 @@ private:
public: public:
template <class OtherIter, class OtherValue> template <class OtherIter, class OtherValue>
// cppcheck-suppress noExplicitConstructor
iter_wrapper(iter_wrapper<OtherIter, OtherValue> other, iter_wrapper(iter_wrapper<OtherIter, OtherValue> other,
typename std::enable_if<std::is_convertible< typename std::enable_if<std::is_convertible<
OtherIter, WrappedIter>::value>::type * = nullptr) OtherIter, WrappedIter>::value>::type * = nullptr)

View File

@ -146,7 +146,7 @@ public:
adj_edge_iterator<Reverse>, edge_descriptor, adj_edge_iterator<Reverse>, edge_descriptor,
boost::forward_traversal_tag, edge_descriptor> { boost::forward_traversal_tag, edge_descriptor> {
vertex_descriptor u; vertex_descriptor u;
const base_type *g; const base_type *g = nullptr;
typename Traits::in_edge_iterator in_it; typename Traits::in_edge_iterator in_it;
typename Traits::out_edge_iterator out_it; typename Traits::out_edge_iterator out_it;
bool done_in = false; bool done_in = false;
@ -238,7 +238,7 @@ public:
: public boost::iterator_facade<edge_iterator, edge_descriptor, : public boost::iterator_facade<edge_iterator, edge_descriptor,
boost::forward_traversal_tag, boost::forward_traversal_tag,
edge_descriptor> { edge_descriptor> {
const base_type *g; const base_type *g = nullptr;
typename Traits::edge_iterator it; typename Traits::edge_iterator it;
public: public:
edge_iterator() = default; edge_iterator() = default;

View File

@ -64,6 +64,7 @@ public:
template<class, class> friend class iter_wrapper; template<class, class> friend class iter_wrapper;
template<class OtherIter, class OtherValue> template<class OtherIter, class OtherValue>
// cppcheck-suppress noExplicitConstructor
iter_wrapper(iter_wrapper<OtherIter, OtherValue> other, iter_wrapper(iter_wrapper<OtherIter, OtherValue> other,
typename std::enable_if<std::is_convertible< typename std::enable_if<std::is_convertible<
OtherIter, WrappedIter>::value>::type * = nullptr) OtherIter, WrappedIter>::value>::type * = nullptr)

View File

@ -228,6 +228,7 @@ public:
assert(sub != INVALID_SUBSET); assert(sub != INVALID_SUBSET);
ENSURE_AT_LEAST(&subset_count, sub + 1); ENSURE_AT_LEAST(&subset_count, sub + 1);
} }
// cppcheck-suppress unsignedPositive
assert(subset_count <= state_to_subset.size()); assert(subset_count <= state_to_subset.size());
subsets.resize(subset_count); subsets.resize(subset_count);

View File

@ -537,14 +537,14 @@ really_inline SuperVector<16> SuperVector<16>::Ones_vshl(uint8_t const N)
template <> template <>
really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr) really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr)
{ {
return SuperVector<16>(vec_xl(0, (const long64_t*)ptr)); return SuperVector<16>(vec_xl(0, reinterpret_cast<const long64_t*>(ptr)));
} }
template <> template <>
really_inline SuperVector<16> SuperVector<16>::load(void const *ptr) really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
{ {
assert(ISALIGNED_N(ptr, alignof(SuperVector::size))); assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
return SuperVector<16>(vec_xl(0, (const long64_t*)ptr)); return SuperVector<16>(vec_xl(0, reinterpret_cast<const long64_t*>(ptr)));
} }
template <> template <>

View File

@ -41,16 +41,16 @@
#include "unaligned.h" #include "unaligned.h"
// Aligned loads // Aligned loads
#ifndef __cplusplus__ #ifndef __cplusplus
#define load_u8(a) (*(const u8 *)(a)) #define load_u8(a) (*(const u8 *)(a))
#define load_u16(a) (*(const u16 *)(a)) #define load_u16(a) (*(const u16 *)(a))
#define load_u32(a) (*(const u32 *)(a)) #define load_u32(a) (*(const u32 *)(a))
#define load_u64a(a) (*(const u64a *)(a)) #define load_u64a(a) (*(const u64a *)(a))
#else #else
#define load_u8(a) (*(reinterpret_cast<const u8 *>(a)) #define load_u8(a) (*(reinterpret_cast<const u8 *>(a)))
#define load_u16(a) (*(reinterpret_cast<const u16 *>(a)) #define load_u16(a) (*(reinterpret_cast<const u16 *>(a)))
#define load_u32(a) (*(reinterpret_cast<const u32 *>(a)) #define load_u32(a) (*(reinterpret_cast<const u32 *>(a)))
#define load_u64a(a) (*(reinterpret_cast<const u64a *>(a)) #define load_u64a(a) (*(reinterpret_cast<const u64a *>(a)))
#endif // __cplusplus__ #endif // __cplusplus__
#define load_m128(a) load128(a) #define load_m128(a) load128(a)
#define load_m256(a) load256(a) #define load_m256(a) load256(a)
@ -58,7 +58,7 @@
#define load_m512(a) load512(a) #define load_m512(a) load512(a)
// Unaligned loads // Unaligned loads
#ifndef __cplusplus__ #ifndef __cplusplus
#define loadu_u8(a) (*(const u8 *)(a)) #define loadu_u8(a) (*(const u8 *)(a))
#define loadu_u16(a) unaligned_load_u16((const u8 *)(a)) #define loadu_u16(a) unaligned_load_u16((const u8 *)(a))
#define loadu_u32(a) unaligned_load_u32((const u8 *)(a)) #define loadu_u32(a) unaligned_load_u32((const u8 *)(a))
@ -68,31 +68,35 @@
#define loadu_u16(a) unaligned_load_u16(reinterpret_cast<const u8 *>(a)) #define loadu_u16(a) unaligned_load_u16(reinterpret_cast<const u8 *>(a))
#define loadu_u32(a) unaligned_load_u32(reinterpret_cast<const u8 *>(a)) #define loadu_u32(a) unaligned_load_u32(reinterpret_cast<const u8 *>(a))
#define loadu_u64a(a) unaligned_load_u64a(reinterpret_cast<const u8 *>(a)) #define loadu_u64a(a) unaligned_load_u64a(reinterpret_cast<const u8 *>(a))
#endif // __cplusplus__ #endif // __cplusplus
#define loadu_m128(a) loadu128(a) #define loadu_m128(a) loadu128(a)
#define loadu_m256(a) loadu256(a) #define loadu_m256(a) loadu256(a)
#define loadu_m384(a) loadu384(a) #define loadu_m384(a) loadu384(a)
#define loadu_m512(a) loadu512(a) #define loadu_m512(a) loadu512(a)
// Aligned stores // Aligned stores
#ifndef __cplusplus__ #ifndef __cplusplus
#define store_u8(ptr, a) do { *((u8 *)(ptr)) = (a); } while(0)
#define store_u16(ptr, a) do { *((u16 *)(ptr)) = (a); } while(0)
#define store_u32(ptr, a) do { *((u32 *)(ptr)) = (a); } while(0)
#define store_u64a(ptr, a) do { *((u64a *)(ptr)) = (a); } while(0)
#else
#define store_u8(ptr, a) do { *(reinterpret_cast<u8 *>(ptr)) = (a); } while(0) #define store_u8(ptr, a) do { *(reinterpret_cast<u8 *>(ptr)) = (a); } while(0)
#define store_u16(ptr, a) do { *(reinterpret_cast<u16 *>(ptr)) = (a); } while(0) #define store_u16(ptr, a) do { *(reinterpret_cast<u16 *>(ptr)) = (a); } while(0)
#define store_u32(ptr, a) do { *(reinterpret_cast<u32 *>(ptr)) = (a); } while(0) #define store_u32(ptr, a) do { *(reinterpret_cast<u32 *>(ptr)) = (a); } while(0)
#define store_u64a(ptr, a) do { *(reinterpret_cast<u64a *>(ptr)) = (a); } while(0) #define store_u64a(ptr, a) do { *(reinterpret_cast<u64a *>(ptr)) = (a); } while(0)
#else #endif // __cplusplus
#endif // __cplusplus__
#define store_m128(ptr, a) store128(ptr, a) #define store_m128(ptr, a) store128(ptr, a)
#define store_m256(ptr, a) store256(ptr, a) #define store_m256(ptr, a) store256(ptr, a)
#define store_m384(ptr, a) store384(ptr, a) #define store_m384(ptr, a) store384(ptr, a)
#define store_m512(ptr, a) store512(ptr, a) #define store_m512(ptr, a) store512(ptr, a)
// Unaligned stores // Unaligned stores
#ifndef __cplusplus__ #ifndef __cplusplus
#define storeu_u8(ptr, a) do { *(u8 *)(ptr) = (a); } while(0) #define storeu_u8(ptr, a) do { *(u8 *)(ptr) = (a); } while(0)
#else #else
#define storeu_u8(ptr, a) do { *(reinterpret_cast<u8 *>(ptr)) = (a); } while(0) #define storeu_u8(ptr, a) do { *(reinterpret_cast<u8 *>(ptr)) = (a); } while(0)
#endif // __cplusplus__ #endif // __cplusplus
#define storeu_u16(ptr, a) unaligned_store_u16(ptr, a) #define storeu_u16(ptr, a) unaligned_store_u16(ptr, a)
#define storeu_u32(ptr, a) unaligned_store_u32(ptr, a) #define storeu_u32(ptr, a) unaligned_store_u32(ptr, a)
#define storeu_u64a(ptr, a) unaligned_store_u64a(ptr, a) #define storeu_u64a(ptr, a) unaligned_store_u64a(ptr, a)

View File

@ -55,7 +55,7 @@ struct CompileCHStats {
class EngineCHContext : public EngineContext{ class EngineCHContext : public EngineContext{
public: public:
explicit EngineCHContext(const ch_database_t *db); explicit EngineCHContext(const ch_database_t *db);
~EngineCHContext(); virtual ~EngineCHContext() override;
ch_scratch_t *scratch = nullptr; ch_scratch_t *scratch = nullptr;
}; };
@ -64,7 +64,7 @@ public:
class EngineChimera : public Engine { class EngineChimera : public Engine {
public: public:
explicit EngineChimera(ch_database_t *db, CompileCHStats cs); explicit EngineChimera(ch_database_t *db, CompileCHStats cs);
~EngineChimera(); virtual ~EngineChimera() override;
std::unique_ptr<EngineContext> makeContext() const override; std::unique_ptr<EngineContext> makeContext() const override;

View File

@ -56,7 +56,7 @@ struct CompileHSStats {
class EngineHSContext : public EngineContext { class EngineHSContext : public EngineContext {
public: public:
explicit EngineHSContext(const hs_database_t *db); explicit EngineHSContext(const hs_database_t *db);
~EngineHSContext(); virtual ~EngineHSContext() override;
hs_scratch_t *scratch = nullptr; hs_scratch_t *scratch = nullptr;
}; };
@ -64,7 +64,7 @@ public:
/** Streaming mode scans have persistent stream state associated with them. */ /** Streaming mode scans have persistent stream state associated with them. */
class EngineHSStream : public EngineStream { class EngineHSStream : public EngineStream {
public: public:
~EngineHSStream(); virtual ~EngineHSStream() override;
hs_stream_t *id = nullptr; hs_stream_t *id = nullptr;
EngineHSContext *ctx = nullptr; EngineHSContext *ctx = nullptr;
}; };
@ -73,7 +73,7 @@ public:
class EngineHyperscan : public Engine { class EngineHyperscan : public Engine {
public: public:
explicit EngineHyperscan(hs_database_t *db, CompileHSStats cs); explicit EngineHyperscan(hs_database_t *db, CompileHSStats cs);
~EngineHyperscan(); virtual ~EngineHyperscan() override;
std::unique_ptr<EngineContext> makeContext() const override; std::unique_ptr<EngineContext> makeContext() const override;

View File

@ -54,7 +54,7 @@ struct CompilePCREStats {
class EnginePCREContext : public EngineContext{ class EnginePCREContext : public EngineContext{
public: public:
explicit EnginePCREContext(int capture_cnt); explicit EnginePCREContext(int capture_cnt);
~EnginePCREContext(); virtual ~EnginePCREContext() override;
int *ovec = nullptr; int *ovec = nullptr;
}; };
@ -72,7 +72,7 @@ class EnginePCRE : public Engine {
public: public:
explicit EnginePCRE(std::vector<std::unique_ptr<PcreDB>> dbs_in, explicit EnginePCRE(std::vector<std::unique_ptr<PcreDB>> dbs_in,
CompilePCREStats cs, int capture_cnt_in); CompilePCREStats cs, int capture_cnt_in);
~EnginePCRE(); virtual ~EnginePCRE() override;
std::unique_ptr<EngineContext> makeContext() const override; std::unique_ptr<EngineContext> makeContext() const override;

View File

@ -759,11 +759,9 @@ void displayResults(const vector<unique_ptr<ThreadContext>> &threads,
// Sanity check: all of our results should have the same match count. // Sanity check: all of our results should have the same match count.
for (const auto &t : threads) { for (const auto &t : threads) {
// cppcheck-suppress useStlAlgorithm if (!all_of(begin(t->results), end(t->results), [&matchesPerRun](const ResultEntry &e) {
if (!all_of(begin(t->results), end(t->results),
[&matchesPerRun](const ResultEntry &e) {
return e.matches == matchesPerRun; return e.matches == matchesPerRun;
})) { })) { // cppcheck-suppress useStlAlgorithm
printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n"); printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n");
break; break;
} }
@ -816,11 +814,9 @@ void displayCsvResults(const vector<unique_ptr<ThreadContext>> &threads,
// Sanity check: all of our results should have the same match count. // Sanity check: all of our results should have the same match count.
for (const auto &t : threads) { for (const auto &t : threads) {
// cppcheck-suppress useStlAlgorithm if (!all_of(begin(t->results), end(t->results), [&matchesPerRun](const ResultEntry &e) {
if (!all_of(begin(t->results), end(t->results),
[&matchesPerRun](const ResultEntry &e) {
return e.matches == matchesPerRun; return e.matches == matchesPerRun;
})) { })) { // cppcheck-suppress useStlAlgorithm
printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n"); printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n");
break; break;
} }
@ -871,11 +867,9 @@ void sqlResults(const vector<unique_ptr<ThreadContext>> &threads,
// Sanity check: all of our results should have the same match count. // Sanity check: all of our results should have the same match count.
for (const auto &t : threads) { for (const auto &t : threads) {
// cppcheck-suppress useStlAlgorithm if (!all_of(begin(t->results), end(t->results), [&matchesPerRun](const ResultEntry &e) {
if (!all_of(begin(t->results), end(t->results),
[&matchesPerRun](const ResultEntry &e) {
return e.matches == matchesPerRun; return e.matches == matchesPerRun;
})) { })) { // cppcheck-suppress useStlAlgorithm
printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n"); printf("\nWARNING: PER-SCAN MATCH COUNTS ARE INCONSISTENT!\n\n");
break; break;
} }
@ -963,6 +957,7 @@ void runBenchmark(const Engine &db,
for (unsigned i = 0; i < numThreads; i++) { for (unsigned i = 0; i < numThreads; i++) {
auto t = makeThreadContext(db, corpus_blocks, i, sync_barrier); auto t = makeThreadContext(db, corpus_blocks, i, sync_barrier);
// cppcheck-suppress knownConditionTrueFalse
int core = useAffinity ? (int)threadCores[i] : -1; int core = useAffinity ? (int)threadCores[i] : -1;
if (!t->start(core)) { if (!t->start(core)) {
printf("Unable to start processing thread %u\n", i); printf("Unable to start processing thread %u\n", i);

View File

@ -143,7 +143,7 @@ void usage(const char *name, const char *error) {
} }
static static
void processArgs(int argc, char *argv[], Grey &grey) { void processArgs(int argc, char *argv[], Grey &grey) { // cppcheck-suppress constParameterReference
static const char *options = "d:De:E:G:hLNo:Ps:VXx:z:8"; static const char *options = "d:De:E:G:hLNo:Ps:VXx:z:8";
static struct option longOptions[] = { static struct option longOptions[] = {
{"dump_db", no_argument, nullptr, 'D'}, {"dump_db", no_argument, nullptr, 'D'},
@ -294,7 +294,7 @@ void dumpDb(const struct hs_database *out, const Grey &grey) {
size_t len = 0; size_t len = 0;
hs_error_t err = hs_serialize_database(out, &bytes, &len); hs_error_t err = hs_serialize_database(out, &bytes, &len);
if (err != HS_SUCCESS) { if (err != HS_SUCCESS) {
printf("ERROR: hs_serialize_database() failed with error %u\n", err); printf("ERROR: hs_serialize_database() failed with error %d\n", err);
return; return;
} }
@ -331,7 +331,7 @@ void clearDir(const string &path) {
exit(1); exit(1);
} }
struct dirent *d_ent; const struct dirent *d_ent;
while (nullptr != (d_ent = readdir(dir))) { while (nullptr != (d_ent = readdir(dir))) {
string name(d_ent->d_name); string name(d_ent->d_name);
if (name == "." || name == "..") { if (name == "." || name == "..") {
@ -423,7 +423,7 @@ void dumpScratch(const hs_database_t *db, const Grey &grey) {
(grey.dumpPath + "scratch.txt").c_str(), strerror(errno)); (grey.dumpPath + "scratch.txt").c_str(), strerror(errno));
} }
} else { } else {
printf("ERROR: hs_alloc_scratch() failed with error %u\n", err); printf("ERROR: hs_alloc_scratch() failed with error %d\n", err);
} }
hs_free_scratch(scratch); hs_free_scratch(scratch);
} }
@ -442,7 +442,7 @@ void dumpInfo(const hs_database_t *db, const Grey &grey) {
(grey.dumpPath + "db_info.txt").c_str(), strerror(errno)); (grey.dumpPath + "db_info.txt").c_str(), strerror(errno));
} }
} else { } else {
printf("ERROR: hs_database_info() failed with error %u\n", err); printf("ERROR: hs_database_info() failed with error %d\n", err);
} }
free(info); free(info);
} }
@ -482,7 +482,7 @@ unsigned int dumpDataMulti(const vector<const char *> &patterns,
if (compile_err && compile_err->message) { if (compile_err && compile_err->message) {
printf("ERROR: Compile failed: %s\n", compile_err->message); printf("ERROR: Compile failed: %s\n", compile_err->message);
} else { } else {
printf("ERROR: hs_compile_multi_int() returned error %u", err); printf("ERROR: hs_compile_multi_int() returned error %d", err);
} }
hs_free_compile_error(compile_err); hs_free_compile_error(compile_err);
return 1; return 1;

View File

@ -192,6 +192,7 @@ void *count_malloc(size_t n) {
*(reinterpret_cast<size_t *>(pp)) = n; *(reinterpret_cast<size_t *>(pp)) = n;
void *p = static_cast<char *>(pp) + 16; void *p = static_cast<char *>(pp) + 16;
// cppcheck-suppress memleak
return p; return p;
} }
@ -218,6 +219,7 @@ void *count_malloc_b(size_t n) {
*(reinterpret_cast<size_t *>(pp)) = n; *(reinterpret_cast<size_t *>(pp)) = n;
void *p = static_cast<char *>(pp) + 32; void *p = static_cast<char *>(pp) + 32;
// cppcheck-suppress memleak
return p; return p;
} }

View File

@ -98,7 +98,6 @@ TEST(ng_charreach, assignment) {
cr2 = cr; cr2 = cr;
ASSERT_EQ(cr.count(), cr2.count()); ASSERT_EQ(cr.count(), cr2.count());
ASSERT_TRUE(cr == cr2);
} }
TEST(ng_charreach, flip) { TEST(ng_charreach, flip) {

View File

@ -138,7 +138,7 @@ vector<u32> getValidFdrEngines() {
static static
bytecode_ptr<FDR> buildFDREngineHinted(std::vector<hwlmLiteral> &lits, bytecode_ptr<FDR> buildFDREngineHinted(const std::vector<hwlmLiteral> &lits,
bool make_small, u32 hint, bool make_small, u32 hint,
const target_t &target, const target_t &target,
const Grey &grey) { const Grey &grey) {
@ -151,7 +151,7 @@ bytecode_ptr<FDR> buildFDREngineHinted(std::vector<hwlmLiteral> &lits,
} }
static static
bytecode_ptr<FDR> buildFDREngine(std::vector<hwlmLiteral> &lits, bytecode_ptr<FDR> buildFDREngine(const std::vector<hwlmLiteral> &lits,
bool make_small, const target_t &target, bool make_small, const target_t &target,
const Grey &grey) { const Grey &grey) {
auto proto = fdrBuildProto(HWLM_ENGINE_FDR, lits, make_small, target, grey); auto proto = fdrBuildProto(HWLM_ENGINE_FDR, lits, make_small, target, grey);

View File

@ -133,7 +133,7 @@ static vector<u32> getValidFdrEngines() {
} }
static static
bytecode_ptr<FDR> buildFDREngineHinted(std::vector<hwlmLiteral> &lits, bytecode_ptr<FDR> buildFDREngineHinted(const std::vector<hwlmLiteral> &lits,
bool make_small, u32 hint, bool make_small, u32 hint,
const target_t &target, const target_t &target,
const Grey &grey) { const Grey &grey) {

View File

@ -370,31 +370,24 @@ TEST(flat_map, get_allocator) {
TEST(flat_map, compare_ops) { TEST(flat_map, compare_ops) {
flat_map<u32, u32> f1 = {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}}; flat_map<u32, u32> f1 = {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}};
flat_map<u32, u32> f1_copy = f1;
flat_map<u32, u32> f2 = {{2, 1}, {4, 2}, {6, 3}, {8, 4}, {10, 5}, {12, 6}}; flat_map<u32, u32> f2 = {{2, 1}, {4, 2}, {6, 3}, {8, 4}, {10, 5}, {12, 6}};
EXPECT_TRUE(f1 == f1); EXPECT_TRUE(f1 == f1);
EXPECT_TRUE(f1 == f1_copy);
EXPECT_FALSE(f1 == f2); EXPECT_FALSE(f1 == f2);
EXPECT_FALSE(f1 != f1); EXPECT_FALSE(f1 != f1);
EXPECT_FALSE(f1 != f1_copy);
EXPECT_TRUE(f1 != f2); EXPECT_TRUE(f1 != f2);
EXPECT_FALSE(f1 < f1); EXPECT_FALSE(f1 < f1);
EXPECT_FALSE(f1 < f1_copy);
EXPECT_TRUE(f1 < f2); EXPECT_TRUE(f1 < f2);
EXPECT_TRUE(f1 <= f1); EXPECT_TRUE(f1 <= f1);
EXPECT_TRUE(f1 <= f1_copy);
EXPECT_TRUE(f1 <= f2); EXPECT_TRUE(f1 <= f2);
EXPECT_FALSE(f1 > f1); EXPECT_FALSE(f1 > f1);
EXPECT_FALSE(f1 > f1_copy);
EXPECT_FALSE(f1 > f2); EXPECT_FALSE(f1 > f2);
EXPECT_TRUE(f1 >= f1); EXPECT_TRUE(f1 >= f1);
EXPECT_TRUE(f1 >= f1_copy);
EXPECT_FALSE(f1 >= f2); EXPECT_FALSE(f1 >= f2);
} }

View File

@ -340,31 +340,24 @@ TEST(flat_set, iter_interop) {
TEST(flat_set, compare_ops) { TEST(flat_set, compare_ops) {
flat_set<u32> f1 = {1, 2, 3, 4, 5}; flat_set<u32> f1 = {1, 2, 3, 4, 5};
flat_set<u32> f1_copy = f1;
flat_set<u32> f2 = {2, 4, 6, 8, 10}; flat_set<u32> f2 = {2, 4, 6, 8, 10};
EXPECT_TRUE(f1 == f1); EXPECT_TRUE(f1 == f1);
EXPECT_TRUE(f1 == f1_copy);
EXPECT_FALSE(f1 == f2); EXPECT_FALSE(f1 == f2);
EXPECT_FALSE(f1 != f1); EXPECT_FALSE(f1 != f1);
EXPECT_FALSE(f1 != f1_copy);
EXPECT_TRUE(f1 != f2); EXPECT_TRUE(f1 != f2);
EXPECT_FALSE(f1 < f1); EXPECT_FALSE(f1 < f1);
EXPECT_FALSE(f1 < f1_copy);
EXPECT_TRUE(f1 < f2); EXPECT_TRUE(f1 < f2);
EXPECT_TRUE(f1 <= f1); EXPECT_TRUE(f1 <= f1);
EXPECT_TRUE(f1 <= f1_copy);
EXPECT_TRUE(f1 <= f2); EXPECT_TRUE(f1 <= f2);
EXPECT_FALSE(f1 > f1); EXPECT_FALSE(f1 > f1);
EXPECT_FALSE(f1 > f1_copy);
EXPECT_FALSE(f1 > f2); EXPECT_FALSE(f1 > f2);
EXPECT_TRUE(f1 >= f1); EXPECT_TRUE(f1 >= f1);
EXPECT_TRUE(f1 >= f1_copy);
EXPECT_FALSE(f1 >= f2); EXPECT_FALSE(f1 >= f2);
} }

View File

@ -55,11 +55,11 @@ public:
} }
operator u8 *() { operator u8 *() {
assert(data); assert(data);
return data.get() + 7; return reinterpret_cast<u8 *>(data.get()) + 7;
} }
operator const u8 *() const { operator const u8 *() const {
assert(data); assert(data);
return data.get() + 7; return reinterpret_cast<u8 *>(data.get()) + 7;
} }
private: private:

View File

@ -94,11 +94,11 @@ public:
} }
operator u8 *() { operator u8 *() {
assert(data); assert(data);
return data.get() + 7; return reinterpret_cast<u8 *>(data.get()) + 7;
} }
operator const u8 *() const { operator const u8 *() const {
assert(data); assert(data);
return data.get() + 7; return reinterpret_cast<u8 *>(data.get()) + 7;
} }
private: private:
@ -116,11 +116,11 @@ public:
} }
operator u8 *() { operator u8 *() {
assert(data); assert(data);
return data.get() + 7; return reinterpret_cast<u8 *>(data.get()) + 7;
} }
operator const u8 *() const { operator const u8 *() const {
assert(data); assert(data);
return data.get() + 7; return reinterpret_cast<u8 *>(data.get()) + 7;
} }
private: private:

View File

@ -66,6 +66,7 @@ ostream& operator<<(ostream &os, const RepeatInfo &info) {
class RepeatTest : public TestWithParam<RepeatTestInfo> { class RepeatTest : public TestWithParam<RepeatTestInfo> {
protected: protected:
RepeatTest() = default;
virtual void SetUp() { virtual void SetUp() {
test_info = GetParam(); test_info = GetParam();
@ -94,12 +95,12 @@ protected:
delete [] state_int; delete [] state_int;
} }
RepeatTestInfo test_info; // Test params RepeatTestInfo test_info{}; // Test params
RepeatInfo info; // Repeat info structure RepeatInfo info{}; // Repeat info structure
RepeatControl *ctrl; RepeatControl *ctrl = nullptr;
char *state; char *state = nullptr;
private: private:
char *state_int; char *state_int = nullptr;
}; };
@ -728,6 +729,7 @@ void test_sparse3entryExpire(const RepeatInfo *info, RepeatControl *ctrl,
class SparseOptimalTest : public TestWithParam<tuple<u32, RepeatTestInfo> > { class SparseOptimalTest : public TestWithParam<tuple<u32, RepeatTestInfo> > {
protected: protected:
SparseOptimalTest() = default;
virtual void SetUp() { virtual void SetUp() {
u32 period; u32 period;
tie(period, test_info) = GetParam(); tie(period, test_info) = GetParam();
@ -773,13 +775,13 @@ protected:
delete[] ptr; delete[] ptr;
} }
RepeatTestInfo test_info; // Test params RepeatTestInfo test_info{}; // Test params
RepeatInfo *info; // Repeat info structure RepeatInfo *info = nullptr; // Repeat info structure
RepeatControl *ctrl; RepeatControl *ctrl = nullptr;
char *state; char *state = nullptr;
private: private:
char *ptr; char *ptr = nullptr;
char *state_int; char *state_int = nullptr;
}; };

View File

@ -223,7 +223,7 @@ class CorpusGeneratorImpl : public CorpusGenerator {
public: public:
CorpusGeneratorImpl(const NGHolder &graph_in, const ExpressionInfo &expr_in, CorpusGeneratorImpl(const NGHolder &graph_in, const ExpressionInfo &expr_in,
CorpusProperties &props); CorpusProperties &props);
virtual ~CorpusGeneratorImpl() = default; virtual ~CorpusGeneratorImpl() override = default;
void generateCorpus(vector<string> &data) override; void generateCorpus(vector<string> &data) override;
@ -419,7 +419,7 @@ class CorpusGeneratorUtf8 : public CorpusGenerator {
public: public:
CorpusGeneratorUtf8(const NGHolder &graph_in, const ExpressionInfo &expr_in, CorpusGeneratorUtf8(const NGHolder &graph_in, const ExpressionInfo &expr_in,
CorpusProperties &props); CorpusProperties &props);
~CorpusGeneratorUtf8() = default; virtual ~CorpusGeneratorUtf8() override = default;
void generateCorpus(vector<string> &data) override; void generateCorpus(vector<string> &data) override;