Cppcheck errors fixed and suppressed (#319)

* supress knownConditionTrueFalse

* cppcheck suppress redundantInitialization

* cppcheck solve stlcstrStream

* cppcheck suppress useStlAlgorithm

* cppcheck-suppress derefInvalidIteratorRedundantCheck

* cppcheck solvwe constParameterReference

* const parameter reference cppcheck

* removed wrong fix

* cppcheck-suppress memsetClassFloat

* cppcheck fix memsetClassFloat

* cppcheck fix unsignedLessThanZero

* supressing all errors on simde gitmodule

* fix typo (unsignedLessThanZero)

* fix cppcheck suppress simde gitmodule

* cppcheck-suppress unsignedLessThanZero

---------

Co-authored-by: gtsoul-tech <gtsoulkanakis@gmail.com>
This commit is contained in:
gtsoul-tech
2024-11-12 10:01:11 +02:00
committed by GitHub
parent 7146d5e225
commit 79b016a6e8
12 changed files with 33 additions and 24 deletions

View File

@@ -431,6 +431,7 @@ accel_dfa_build_strat::buildAccel(UNUSED dstate_id_t this_idx,
DEBUG_PRINTF("accelerations scheme has offset s%u/d%u\n", info.offset,
info.double_offset);
// cppcheck-suppress redundantInitialization
accel->generic.offset = verify_u8(info.offset);
if (double_byte_ok(info) && info.double_cr.none() &&

View File

@@ -331,6 +331,7 @@ void buildReachMapping(const build_info &args, vector<NFAStateSet> &reach,
vector<NFAVertex> verts;
verts.reserve(args.num_states);
auto sidat = [&state_ids=state_ids](const NFAVertex &v) {
// cppcheck-suppress knownConditionTrueFalse
return (state_ids.at(v) != NO_STATE);
};
const auto &vr = vertices_range(h);
@@ -921,11 +922,13 @@ void buildAccel(const build_info &args, NFAStateSet &accelMask,
// Start with the NONE case.
auxvec.emplace_back(AccelAux());
// cppcheck-suppress memsetClassFloat
memset(&auxvec[0], 0, sizeof(AccelAux));
auxvec[0].accel_type = ACCEL_NONE; // no states on.
AccelAux aux;
for (u32 i = 1; i < accelCount; i++) {
// cppcheck-suppress memsetClassFloat
memset(&aux, 0, sizeof(aux));
NFAStateSet effective_states(args.num_states);
@@ -1218,10 +1221,11 @@ bool hasSquashableInitDs(const build_info &args) {
static
bool hasInitDsStates(const NGHolder &h,
const unordered_map<NFAVertex, u32> &state_ids) {
// cppcheck-suppress knownConditionTrueFalse
if (state_ids.at(h.startDs) != NO_STATE) {
return true;
}
// cppcheck-suppress knownConditionTrueFalse
if (is_triggered(h) && state_ids.at(h.start) != NO_STATE) {
return true;
}
@@ -1696,7 +1700,7 @@ static
bool cannotDie(const build_info &args) {
const auto &h = args.h;
const auto &state_ids = args.state_ids;
// cppcheck-suppress knownConditionTrueFalse
// If we have a startDs we're actually using, we can't die.
if (state_ids.at(h.startDs) != NO_STATE) {
DEBUG_PRINTF("is using startDs\n");