]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
next batch
authorG.E <gregory.economou@vectorcamp.gr>
Fri, 17 May 2024 07:44:28 +0000 (10:44 +0300)
committerG.E <gregory.economou@vectorcamp.gr>
Fri, 17 May 2024 07:44:28 +0000 (10:44 +0300)
20 files changed:
src/rose/rose_build_add_mask.cpp
src/rose/rose_build_anchored.cpp
src/rose/rose_build_bytecode.cpp
src/rose/rose_build_castle.cpp
src/rose/rose_build_compile.cpp
src/rose/rose_build_dedupe.cpp
src/rose/rose_build_exclusive.cpp
src/rose/rose_build_groups.cpp
src/rose/rose_build_lookaround.cpp
src/rose/rose_build_matchers.cpp
src/rose/rose_build_merge.cpp
src/rose/rose_build_misc.cpp
src/rose/rose_build_program.cpp
src/rose/rose_build_role_aliasing.cpp
src/rose/rose_build_width.cpp
src/util/ue2string.cpp
tools/hsbench/main.cpp
unit/internal/graph_undirected.cpp
util/cross_compile.cpp
util/ng_corpus_generator.cpp

index c3736f62f48bd845d5312fe7dee3ef811a08c372..95c32cba2f24ab6d4906abd7124ba08b80a6fc0b 100644 (file)
@@ -262,6 +262,7 @@ bool findMaskLiterals(const vector<CharReach> &mask, vector<ue2_literal> *lit,
 
         // Candidates have been expanded in reverse order.
         for (auto &cand : candidates) {
+            // cppcheck-suppress useStlAlgorithm
             cand = reverse_literal(cand);
         }
 
@@ -443,7 +444,9 @@ bool maskIsNeeded(const ue2_literal &lit, const NGHolder &g) {
         curr.swap(next);
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : curr) {
+        // cppcheck-suppress useStlAlgorithm
         for (auto u : inv_adjacent_vertices_range(v, g)) {
             if (u == g.start || u == g.startDs) {
                 DEBUG_PRINTF("literal spans graph from start to accept\n");
index 027aefd0b8cdf6701d57d01e9d884d9692c32a34..281b39cf6b9e8de82f1ff2e74581e68cd2beceba 100644 (file)
@@ -158,9 +158,11 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
 
     // Rehome our groups into one vector.
     for (auto &rdfa : small_starts) {
+        // cppcheck-suppress useStlAlgorithm
         dfas.emplace_back(std::move(rdfa));
     }
     for (auto &rdfa : big_starts) {
+        // cppcheck-suppress useStlAlgorithm
         dfas.emplace_back(std::move(rdfa));
     }
 
@@ -784,6 +786,7 @@ vector<unique_ptr<raw_dfa>> getAnchoredDfas(RoseBuildImpl &build,
     // DFAs that already exist as raw_dfas.
     for (auto &anch_dfas : build.anchored_nfas) {
         for (auto &rdfa : anch_dfas.second) {
+            // cppcheck-suppress useStlAlgorithm
             dfas.emplace_back(std::move(rdfa));
         }
     }
index 06f36582b38c714f43f0982de0a0ba1ac9de68fe..ef3f6fddd63172d048f8c4a0ae3f8623bff0ca02 100644 (file)
@@ -208,6 +208,7 @@ u32 countRosePrefixes(const vector<LeftNfaInfo> &roses) {
     u32 num = 0;
     for (const auto &r : roses) {
         if (!r.infix) {
+            // cppcheck-suppress useStlAlgorithm
             num++;
         }
     }
@@ -242,6 +243,7 @@ bool needsCatchup(const RoseBuildImpl &build) {
 
     const RoseGraph &g = build.g;
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         if (g[v].suffix) {
             /* TODO: check that they have non-eod reports */
@@ -304,6 +306,7 @@ bool isPureFloating(const RoseResources &resources, const CompileContext &cc) {
 
 static
 bool isSingleOutfix(const RoseBuildImpl &tbi) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(tbi.g)) {
         if (tbi.isAnyStart(v)) {
             continue;
@@ -986,6 +989,7 @@ bool checkSuitableForEager(bool is_prefix, const left_id &left,
         return false;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (RoseVertex s : succs) {
         if (build.isInETable(s)
             || contains(rg[s].literals, build.eod_event_literal_id)) {
@@ -1599,6 +1603,7 @@ void findSuffixTriggers(const RoseBuildImpl &tbi,
 
 static
 bool hasNonSmallBlockOutfix(const vector<OutfixInfo> &outfixes) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &out : outfixes) {
         if (!out.in_sbmatcher) {
             return true;
@@ -1948,6 +1953,7 @@ bool buildSuffixes(const RoseBuildImpl &tbi, build_context &bc,
     // order.
     vector<pair<u32, suffix_id>> ordered;
     for (const auto &e : bc.suffixes) {
+        // cppcheck-suppress useStlAlgorithm
         ordered.emplace_back(e.second, e.first);
     }
     sort(begin(ordered), end(ordered));
@@ -2294,6 +2300,7 @@ u32 buildEodNfaIterator(build_context &bc, const u32 activeQueueCount) {
 
 static
 bool hasMpvTrigger(const set<u32> &reports, const ReportManager &rm) {
+    // cppcheck-suppress useStlAlgorithm
     for (u32 r : reports) {
         if (rm.getReport(r).type == INTERNAL_ROSE_CHAIN) {
             return true;
@@ -2324,6 +2331,7 @@ bool anyEndfixMpvTriggers(const RoseBuildImpl &build) {
     }
 
     /* outfixes */
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &out : build.outfixes) {
         if (hasMpvTrigger(all_reports(out), build.rm)) {
             return true;
@@ -2607,6 +2615,7 @@ unordered_map<RoseVertex, u32> assignStateIndices(const RoseBuildImpl &build) {
         // eagerly-reported EOD vertices.
         bool needs_state_index = false;
         for (const auto &e : out_edges_range(v, g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (!canEagerlyReportAtEod(build, e)) {
                 needs_state_index = true;
                 break;
@@ -2797,6 +2806,7 @@ bool isUsedLiteral(const RoseBuildImpl &build, u32 lit_id) {
         return true;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const u32 &delayed_id : info.delayed_ids) {
         assert(delayed_id < build.literal_info.size());
         const rose_literal_info &delayed_info = build.literal_info[delayed_id];
@@ -3225,6 +3235,7 @@ pair<u32, u32> buildReportPrograms(const RoseBuildImpl &build,
 static
 bool hasEodAnchoredSuffix(const RoseBuildImpl &build) {
     const RoseGraph &g = build.g;
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         if (g[v].suffix && build.isInETable(v)) {
             DEBUG_PRINTF("vertex %zu is in eod table and has a suffix\n",
@@ -3238,6 +3249,7 @@ bool hasEodAnchoredSuffix(const RoseBuildImpl &build) {
 static
 bool hasEodMatcher(const RoseBuildImpl &build) {
     const RoseGraph &g = build.g;
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         if (build.isInETable(v)) {
             DEBUG_PRINTF("vertex %zu is in eod table\n", g[v].index);
index f3357982e5f238ae633e2139ce9fa93315c90c54..14b67fdc72764addaa10b17b642a8303fec55475 100644 (file)
@@ -130,6 +130,7 @@ vector<rose_literal_id> literals_for_vertex(const RoseBuildImpl &tbi,
     vector<rose_literal_id> rv;
 
     for (const u32 id : tbi.g[v].literals) {
+        // cppcheck-suppress useStlAlgorithm
         rv.emplace_back(tbi.literals.at(id));
     }
 
index e67c9149a33aa4780e3617fed7035a797d44f20e..808d0774a79a950d3e0a7413a8c208fcf3a6dae4 100644 (file)
@@ -96,6 +96,7 @@ bool limited_explosion(const ue2_literal &s) {
 
     for (const auto &e : s) {
         if (e.nocase) {
+            // cppcheck-suppress useStlAlgorithm
             nc_count++;
         }
     }
@@ -268,6 +269,7 @@ bool RoseBuildImpl::isPseudoStarOrFirstOnly(const RoseEdge &e) const {
 }
 
 bool RoseBuildImpl::hasOnlyPseudoStarInEdges(RoseVertex v) const {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : in_edges_range(v, g)) {
         if (!isPseudoStar(e)) {
             return false;
@@ -413,6 +415,7 @@ bool RoseBuildImpl::isDirectReport(u32 id) const {
         }
 
         // Use the program to handle cases that aren't external reports.
+        // cppcheck-suppress useStlAlgorithm
         for (const ReportID &rid : g[v].reports) {
             if (!isExternalReport(rm.getReport(rid))) {
                 return false;
@@ -451,6 +454,7 @@ bool RoseBuildImpl::isDirectReport(u32 id) const {
  * larger than avoiding running an eod table over the last N bytes. */
 static
 bool checkFloatingKillableByPrefixes(const RoseBuildImpl &tbi) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(tbi.g)) {
         if (!tbi.isRootSuccessor(v)) {
             continue;
@@ -699,6 +703,7 @@ bool suitableForAnchored(const RoseBuildImpl &tbi, const rose_literal_id &l_id,
             return false;
         }
 
+        // cppcheck-suppress useStlAlgorithm
         for (auto w : adjacent_vertices_range(v, g)) {
             if (!g[w].eod_accept) {
                 DEBUG_PRINTF("non eod accept literal\n");
@@ -771,6 +776,7 @@ bool RoseBuildImpl::isDelayed(u32 id) const {
 }
 
 bool RoseBuildImpl::hasDelayedLiteral(RoseVertex v) const {
+    // cppcheck-suppress useStlAlgorithm
     for (u32 lit_id : g[v].literals) {
         if (literals.at(lit_id).delay) {
             return true;
@@ -781,6 +787,7 @@ bool RoseBuildImpl::hasDelayedLiteral(RoseVertex v) const {
 }
 
 bool RoseBuildImpl::hasDelayPred(RoseVertex v) const {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (hasDelayedLiteral(u)) {
             return true;
@@ -791,6 +798,7 @@ bool RoseBuildImpl::hasDelayPred(RoseVertex v) const {
 }
 
 bool RoseBuildImpl::hasAnchoredTablePred(RoseVertex v) const {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (isAnchored(u)) {
             return true;
@@ -956,6 +964,7 @@ bool reduceTopTriggerLoad(RoseBuildImpl &build, NGHolder &h, RoseVertex u) {
     u32 new_top = ~0U;
     /* check if there is already a top with the right the successor set */
     for (const auto &elem : h_top_info) {
+        // cppcheck-suppress useStlAlgorithm
         if (elem.second == edges_to_trigger) {
             new_top = elem.first;
             break;
@@ -1497,6 +1506,7 @@ bool extractSEPLiterals(const raw_dfa &rdfa,
 
         CharReach cr;
         for (const auto &sym : symbols) {
+            // cppcheck-suppress useStlAlgorithm
             cr |= reach[sym];
         }
 
@@ -1522,6 +1532,7 @@ bool extractSEPLiterals(const OutfixInfo &outfix, const ReportManager &rm,
         return false;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &report_id : all_reports(outfix)) {
         const auto &report = rm.getReport(report_id);
         if (!isSimpleExhaustible(report)) {
@@ -1556,6 +1567,7 @@ void addAnchoredSmallBlockLiterals(RoseBuildImpl &tbi) {
     // literals are direct reports (i.e. leaf nodes in the Rose graph).
     for (const set<u32> &lits : tbi.anchored_simple | map_values) {
         for (u32 lit_id : lits) {
+            // cppcheck-suppress useStlAlgorithm
             if (!tbi.isDirectReport(lit_id)) {
                 DEBUG_PRINTF("not all anchored lits are direct reports\n");
                 return;
index 0a19480a472e4d21c34666118273cf11ae6d6e86..f788ee1a328b2a6a457ada6d54907be20f91a788 100644 (file)
@@ -307,6 +307,7 @@ bool RoseDedupeAuxImpl::requiresDedupeSupport(
 
     /* literals */
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &m : lits) {
         if (m.second > 1) {
             DEBUG_PRINTF("lit %u used by >1 reporting roles\n", m.first);
index bc9b15582ce5865a186e2e72cb5cfbd6b809a3d4..999f769f429a7c170773853142cace238d3bd6fd 100644 (file)
@@ -54,6 +54,7 @@ CharReach getReachability(const NGHolder &h) {
     CharReach cr;
     for (const auto &v : vertices_range(h)) {
         if (!is_special(v, h)) {
+            // cppcheck-suppress useStlAlgorithm
             cr |= h[v].char_reach;
         }
     }
@@ -140,6 +141,7 @@ bool isSuffix(const vector<vector<CharReach>> &triggers1,
               const vector<vector<CharReach>> &triggers2) {
     // literal suffix test
     for (const auto &lit1 : triggers1) {
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &lit2 : triggers2) {
             const size_t len = min(lit1.size(), lit2.size());
             if (equal(lit1.rbegin(), lit1.rbegin() + len,
@@ -240,6 +242,7 @@ bool isExclusive(const NGHolder &h,
             // Check if only literal states are on
             for (const auto &s : activeStates) {
                 if ((!is_any_start(s, h) && h[s].index <= num) ||
+                    // cppcheck-suppress useStlAlgorithm
                     contains(tailId, h[s].index)) {
                     skipList[id2].insert(id1);
                     return false;
index d8b9c95143ba67a6506f9d281a710cbdebdc32c6..9aaf349b9c33cf33e16ec766f4c4675f9da03398 100644 (file)
@@ -84,6 +84,7 @@ bool eligibleForAlwaysOnGroup(const RoseBuildImpl &build, u32 id) {
         return true;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (u32 delayed_id : build.literal_info[id].delayed_ids) {
         if (any_of_in(build.literal_info[delayed_id].vertices, eligble)) {
             return true;
@@ -130,6 +131,7 @@ rose_group calcLocalGroup(const RoseVertex v, const RoseGraph &g,
         for (auto w : adjacent_vertices_range(u, g)) {
             if (!small_literal_count || g[v].left == g[w].left) {
                 for (u32 lit_id : g[w].literals) {
+                    // cppcheck-suppress useStlAlgorithm
                     local_group |= literal_info[lit_id].group_mask;
                 }
             } else {
@@ -409,6 +411,7 @@ rose_group RoseBuildImpl::getSuccGroups(RoseVertex start) const {
     rose_group initialGroups = 0;
 
     for (auto v : adjacent_vertices_range(start, g)) {
+        // cppcheck-suppress useStlAlgorithm
         initialGroups |= getGroups(v);
     }
 
@@ -536,6 +539,7 @@ bool coversGroup(const RoseBuildImpl &build,
     rose_group groups = lit_info.group_mask;
     while (groups) {
         u32 group_id = findAndClearLSB_64(&groups);
+        // cppcheck-suppress useStlAlgorithm
         for (u32 id : build.group_to_literal.at(group_id)) {
             DEBUG_PRINTF(" checking against friend %u\n", id);
             if (!is_subset_of(build.literal_info[id].vertices,
@@ -611,6 +615,7 @@ bool isGroupSquasher(const RoseBuildImpl &build, const u32 id /* literal id */,
         }
 
         // Out-edges must have inf max bound, + no other shenanigans */
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &e : out_edges_range(v, g)) {
             if (g[e].maxBound != ROSE_BOUND_INF) {
                 return false;
@@ -629,6 +634,7 @@ bool isGroupSquasher(const RoseBuildImpl &build, const u32 id /* literal id */,
     }
 
     // Multiple-vertex case
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : lit_info.vertices) {
         assert(!build.isAnyStart(v));
 
@@ -650,6 +656,7 @@ bool isGroupSquasher(const RoseBuildImpl &build, const u32 id /* literal id */,
 
         // Out-edges must have inf max bound and not directly lead to another
         // vertex with this group, e.g. 'foobar.*foobar'.
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &e : out_edges_range(v, g)) {
             if (g[e].maxBound != ROSE_BOUND_INF) {
                 return false;
@@ -660,6 +667,7 @@ bool isGroupSquasher(const RoseBuildImpl &build, const u32 id /* literal id */,
                 return false; /* is an infix rose trigger */
             }
 
+            // cppcheck-suppress useStlAlgorithm
             for (u32 lit_id : g[t].literals) {
                 if (build.literal_info[lit_id].group_mask &
                     lit_info.group_mask) {
@@ -671,6 +679,7 @@ bool isGroupSquasher(const RoseBuildImpl &build, const u32 id /* literal id */,
         // In-edges must all be dot-stars with no overlap at all, as overlap
         // also causes history to be used.
         /* Different tables are already forbidden by previous checks */
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &e : in_edges_range(v, g)) {
             if (!(g[e].minBound == 0 && g[e].maxBound == ROSE_BOUND_INF)) {
                 return false;
index 88e8d4748c8606ce0fc21dbfa423fdaa26ea9683..fecc73b473a8f6152691ca8fd04d05a7148bc15a 100644 (file)
@@ -347,6 +347,7 @@ private:
 
 static
 bool isFloodProne(const map<s32, CharReach> &look, const CharReach &flood_cr) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &m : look) {
         const CharReach &look_cr = m.second;
         if (!overlaps(look_cr, flood_cr)) {
@@ -365,6 +366,7 @@ bool isFloodProne(const map<s32, CharReach> &look,
         return false;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const CharReach &flood_cr : flood_reach) {
         if (isFloodProne(look, flood_cr)) {
             return true;
@@ -748,6 +750,7 @@ bool getTransientPrefixReach(const NGHolder &g, ReportID report, u32 lag,
             assert(!is_special(v, g));
 
             for (auto u : inv_adjacent_vertices_range(v, g)) {
+                // cppcheck-suppress useStlAlgorithm
                 if (u == g.start || u == g.startDs) {
                     curr[idx] = g.startDs;
                     break;
index aa7a794d57f632785edf77c959d4e9ebed38b738..d644bcd5707a21eb4bb1456628a473441bbc73eb 100644 (file)
@@ -490,6 +490,7 @@ bool isNoRunsVertex(const RoseBuildImpl &build, RoseVertex u) {
         return false;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &oe : out_edges_range(u, g)) {
         RoseVertex v = target(oe, g);
         if (g[oe].maxBound != ROSE_BOUND_INF) {
@@ -532,6 +533,7 @@ bool isNoRunsLiteral(const RoseBuildImpl &build, const u32 id,
     }
 
     // Undelayed vertices.
+    // cppcheck-suppress useStlAlgorithm
     for (RoseVertex v : info.vertices) {
         if (!isNoRunsVertex(build, v)) {
             return false;
@@ -543,6 +545,7 @@ bool isNoRunsLiteral(const RoseBuildImpl &build, const u32 id,
         assert(d < build.literal_info.size());
         const rose_literal_info &delayed_info = build.literal_info.at(d);
         assert(delayed_info.undelayed_id == id);
+        // cppcheck-suppress useStlAlgorithm
         for (RoseVertex v : delayed_info.vertices) {
             if (!isNoRunsVertex(build, v)) {
                 return false;
index cddbb760b7640549b3c167c9e4d32a1b6c453d87..69f688c5534998efb4ef5eb820aa78afe626215a 100644 (file)
@@ -582,6 +582,7 @@ bool compatibleLiteralsForMerge(
     }
 
     // We don't handle delayed cases yet.
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &ue : ulits) {
         const rose_literal_id &ul = *ue.first;
         if (ul.delay) {
@@ -589,6 +590,7 @@ bool compatibleLiteralsForMerge(
         }
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &ve : vlits) {
         const rose_literal_id &vl = *ve.first;
         if (vl.delay) {
@@ -601,10 +603,12 @@ bool compatibleLiteralsForMerge(
        checked its status at offset X and X > Y). If we can not establish that
        the literals used for triggering will satisfy this property, then it is
        not safe to merge the engine. */
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &ue : ulits) {
         const rose_literal_id &ul = *ue.first;
         u32 ulag = ue.second;
 
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &ve : vlits) {
             const rose_literal_id &vl = *ve.first;
             u32 vlag = ve.second;
@@ -743,6 +747,7 @@ bool mergeableRoseVertices(const RoseBuildImpl &tbi, RoseVertex u,
     vector<pair<const rose_literal_id *, u32>> ulits;
     ulits.reserve(tbi.g[u].literals.size());
     for (u32 id : tbi.g[u].literals) {
+        // cppcheck-suppress useStlAlgorithm
         ulits.emplace_back(&tbi.literals.at(id), ulag);
     }
 
@@ -750,6 +755,7 @@ bool mergeableRoseVertices(const RoseBuildImpl &tbi, RoseVertex u,
     vector<pair<const rose_literal_id *, u32>> vlits;
     vlits.reserve(tbi.g[v].literals.size());
     for (u32 id : tbi.g[v].literals) {
+        // cppcheck-suppress useStlAlgorithm
         vlits.emplace_back(&tbi.literals.at(id), vlag);
     }
 
@@ -820,6 +826,7 @@ bool checkPredDelays(const RoseBuildImpl &build, const VertexCont &v1,
     vector<const rose_literal_id *> pred_rose_lits;
     pred_rose_lits.reserve(pred_lits.size());
     for (const auto &p : pred_lits) {
+        // cppcheck-suppress useStlAlgorithm
         pred_rose_lits.emplace_back(&build.literals.at(p));
     }
 
@@ -885,6 +892,7 @@ bool mergeableRoseVertices(const RoseBuildImpl &tbi,
 
         u32 ulag = tbi.g[a].left.lag;
         for (u32 id : tbi.g[a].literals) {
+            // cppcheck-suppress useStlAlgorithm
             ulits.emplace_back(&tbi.literals.at(id), ulag);
         }
     }
@@ -897,6 +905,7 @@ bool mergeableRoseVertices(const RoseBuildImpl &tbi,
 
         u32 vlag = tbi.g[a].left.lag;
         for (u32 id : tbi.g[a].literals) {
+            // cppcheck-suppress useStlAlgorithm
             vlits.emplace_back(&tbi.literals.at(id), vlag);
         }
     }
@@ -1050,6 +1059,7 @@ bool checkVerticesOkForLeftfixMerge(const RoseBuildImpl &build,
     for (auto a : targets_1) {
         u32 ulag = build.g[a].left.lag;
         for (u32 id : build.g[a].literals) {
+            // cppcheck-suppress useStlAlgorithm
             ulits.emplace_back(&build.literals.at(id), ulag);
         }
     }
@@ -1058,6 +1068,7 @@ bool checkVerticesOkForLeftfixMerge(const RoseBuildImpl &build,
     for (auto a : targets_2) {
         u32 vlag = build.g[a].left.lag;
         for (u32 id : build.g[a].literals) {
+            // cppcheck-suppress useStlAlgorithm
             vlits.emplace_back(&build.literals.at(id), vlag);
         }
     }
index d3ff236d2932631e66706783928ee5dfa26f180f..98273086633e0b10f997b5da4386ad5f0c9a10ef 100644 (file)
@@ -106,6 +106,7 @@ bool RoseVertexProps::fixedOffset(void) const {
 }
 
 bool RoseBuildImpl::isRootSuccessor(const RoseVertex &v) const {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (isAnyStart(u)) {
             return true;
@@ -115,6 +116,7 @@ bool RoseBuildImpl::isRootSuccessor(const RoseVertex &v) const {
 }
 
 bool RoseBuildImpl::isNonRootSuccessor(const RoseVertex &v) const {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (!isAnyStart(u)) {
             return true;
@@ -124,6 +126,7 @@ bool RoseBuildImpl::isNonRootSuccessor(const RoseVertex &v) const {
 }
 
 bool hasAnchHistorySucc(const RoseGraph &g, RoseVertex v) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : out_edges_range(v, g)) {
         if (g[e].history == ROSE_ROLE_HISTORY_ANCH) {
             return true;
@@ -134,6 +137,7 @@ bool hasAnchHistorySucc(const RoseGraph &g, RoseVertex v) {
 }
 
 bool hasLastByteHistorySucc(const RoseGraph &g, RoseVertex v) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : out_edges_range(v, g)) {
         if (g[e].history == ROSE_ROLE_HISTORY_LAST_BYTE) {
             return true;
@@ -183,6 +187,7 @@ bool RoseBuildImpl::hasLiteralInTable(RoseVertex v,
 /* Indicates that the floating table (if it exists) will be only run
    conditionally based on matches from the anchored table. */
 bool RoseBuildImpl::hasNoFloatingRoots() const {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(root, g)) {
         if (isFloating(v)) {
             DEBUG_PRINTF("direct floating root %zu\n", g[v].index);
@@ -191,6 +196,7 @@ bool RoseBuildImpl::hasNoFloatingRoots() const {
     }
 
     /* need to check if the anchored_root has any literals which are too deep */
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(anchored_root, g)) {
         if (isFloating(v)) {
             DEBUG_PRINTF("indirect floating root %zu\n", g[v].index);
@@ -208,6 +214,7 @@ size_t RoseBuildImpl::maxLiteralLen(RoseVertex v) const {
     size_t maxlen = 0;
 
     for (const auto &lit_id : lit_ids) {
+        // cppcheck-suppress useStlAlgorithm
         maxlen = max(maxlen, literals.at(lit_id).elength());
     }
 
@@ -221,6 +228,7 @@ size_t RoseBuildImpl::minLiteralLen(RoseVertex v) const {
     size_t minlen = ROSE_BOUND_INF;
 
     for (const auto &lit_id : lit_ids) {
+        // cppcheck-suppress useStlAlgorithm
         minlen = min(minlen, literals.at(lit_id).elength());
     }
 
@@ -880,6 +888,7 @@ u32 findMinOffset(const RoseBuildImpl &build, u32 lit_id) {
 
     u32 min_offset = UINT32_MAX;
     for (const auto &v : lit_vertices) {
+        // cppcheck-suppress useStlAlgorithm
         min_offset = min(min_offset, build.g[v].min_offset);
     }
 
@@ -892,6 +901,7 @@ u32 findMaxOffset(const RoseBuildImpl &build, u32 lit_id) {
 
     u32 max_offset = 0;
     for (const auto &v : lit_vertices) {
+        // cppcheck-suppress useStlAlgorithm
         max_offset = max(max_offset, build.g[v].max_offset);
     }
 
index 861855b54eeeaeebf82ea67cd467de4d71b5a018..bc343a5529b54fbcc06ad703f7d04be497845024 100644 (file)
@@ -292,6 +292,7 @@ void stripCheckHandledInstruction(RoseProgram &prog) {
 /** Returns true if the program may read the interpreter's work_done flag */
 static
 bool reads_work_done_flag(const RoseProgram &prog) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &ri : prog) {
         if (dynamic_cast<const RoseInstrSquashGroups *>(ri.get())) {
             return true;
@@ -914,6 +915,7 @@ void makeRoleGroups(const RoseGraph &g, ProgramBuild &prog_build,
     assert(in_degree(v, g) > 0);
     rose_group already_on = ~rose_group{0};
     for (const auto &u : inv_adjacent_vertices_range(v, g)) {
+        // cppcheck-suppress useStlAlgorithm
         already_on &= prog_build.vertex_group_map.at(u);
     }
 
@@ -2020,6 +2022,7 @@ bool onlyAtEod(const RoseBuildImpl &tbi, RoseVertex v) {
         return false;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : out_edges_range(v, g)) {
         RoseVertex w = target(e, g);
         if (!g[w].eod_accept) {
index 2888b9a0f0969a5a8f3ed5c656a71920b9344f8e..0404a0c2296f30e55f8550d6726d7c5d4e096dbb 100644 (file)
@@ -258,6 +258,7 @@ bool samePredecessors(RoseVertex a, RoseVertex b, const RoseGraph &g) {
             return false;
         }
 
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &e_a : in_edges_range(a, g)) {
             RoseEdge e = edge(source(e_a, g), b, g);
             if (!e || g[e].rose_top != g[e_a].rose_top) {
@@ -273,6 +274,7 @@ bool samePredecessors(RoseVertex a, RoseVertex b, const RoseGraph &g) {
 static
 bool hasCommonSuccWithBadBounds(RoseVertex a, RoseVertex b,
                                 const RoseGraph &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e_a : out_edges_range(a, g)) {
         if (RoseEdge e = edge(b, target(e_a, g), g)) {
             if (g[e_a].maxBound < g[e].minBound
@@ -292,6 +294,7 @@ bool hasCommonSuccWithBadBounds(RoseVertex a, RoseVertex b,
 static
 bool hasCommonPredWithBadBounds(RoseVertex a, RoseVertex b,
                                 const RoseGraph &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e_a : in_edges_range(a, g)) {
         if (RoseEdge e = edge(source(e_a, g), b, g)) {
             if (g[e_a].maxBound < g[e].minBound
@@ -328,8 +331,10 @@ bool canMergeLiterals(RoseVertex a, RoseVertex b, const RoseBuildImpl &build) {
     }
 
     // Otherwise, all the literals involved must have the same length.
+    // cppcheck-suppress useStlAlgorithm
     for (u32 a_id : lits_a) {
         const rose_literal_id &la = build.literals.at(a_id);
+        // cppcheck-suppress useStlAlgorithm
         for (u32 b_id : lits_b) {
             const rose_literal_id &lb = build.literals.at(b_id);
 
@@ -699,6 +704,7 @@ bool hasCommonPredWithDiffRoses(RoseVertex a, RoseVertex b,
 
     const bool equal_roses = hasEqualLeftfixes(a, b, g);
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e_a : in_edges_range(a, g)) {
         if (RoseEdge e = edge(source(e_a, g), b, g)) {
             DEBUG_PRINTF("common pred, e_r=%d r_t %u,%u\n",
@@ -723,6 +729,7 @@ void pruneReportIfUnused(const RoseBuildImpl &build, shared_ptr<NGHolder> h,
     DEBUG_PRINTF("trying to prune %u from %p (v %zu)\n", report, h.get(),
                  verts.size());
     for (RoseVertex v : verts) {
+        // cppcheck-suppress useStlAlgorithm
         if (build.g[v].left.graph == h &&
             build.g[v].left.leftfix_report == report) {
             DEBUG_PRINTF("report %u still in use\n", report);
@@ -1942,6 +1949,7 @@ bool hasNoDiamondSiblings(const RoseGraph &g, RoseVertex v) {
     if (has_successor(v, g)) {
         bool only_succ = true;
         for (const auto &w : adjacent_vertices_range(v, g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (in_degree(w, g) > 1) {
                 only_succ = false;
                 break;
@@ -1958,6 +1966,7 @@ bool hasNoDiamondSiblings(const RoseGraph &g, RoseVertex v) {
 
     bool only_pred = true;
     for (const auto &u : inv_adjacent_vertices_range(v, g)) {
+        // cppcheck-suppress useStlAlgorithm
         if (out_degree(u, g) > 1) {
             only_pred = false;
             break;
index 327911eacde345731dc4db1c95f07ab160d54731..2e29a8be966d45d0c550b946dbf73ec083d8bdd6 100644 (file)
@@ -44,6 +44,7 @@ namespace ue2 {
 
 static
 bool is_end_anchored(const RoseGraph &g, RoseVertex v) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto w : adjacent_vertices_range(v, g)) {
         if (g[w].eod_accept) {
             return true;
index 50b2bbcc89a7087710a47994125d37585c775940..63e633da43acb88a08a2c34b615977b7559c2df0 100644 (file)
@@ -134,6 +134,7 @@ string dumpString(const ue2_literal &lit) {
 
 void upperString(string &s) {
     for (auto &c : s) {
+        // cppcheck-suppress useStlAlgorithm
         c = mytoupper(c);
     }
 }
@@ -341,6 +342,7 @@ void make_nocase(ue2_literal *lit) {
     ue2_literal rv;
 
     for (const auto &elem: *lit) {
+        // cppcheck-suppress useStlAlgorithm
         rv.push_back(elem.c, ourisalpha(elem.c));
     }
 
index 1a19d510fe86d668b8ae3ddce4ea8335479caee1..8a78881a75ccc2769e85df1098422b4dcba747ff 100644 (file)
@@ -727,6 +727,7 @@ double fastestResult(const vector<unique_ptr<ThreadContext>> &threads) {
     double best = threads[0]->results[0].seconds;
     for (const auto &t : threads) {
         for (const auto &r : t->results) {
+            // cppcheck-suppress useStlAlgorithm
             best = min(best, r.seconds);
         }
     }
@@ -737,6 +738,7 @@ static
 u64a byte_size(const vector<DataBlock> &corpus_blocks) {
     u64a total = 0;
     for (const DataBlock &block : corpus_blocks) {
+        // cppcheck-suppress useStlAlgorithm
         total += block.payload.size();
     }
 
@@ -757,6 +759,7 @@ void displayResults(const vector<unique_ptr<ThreadContext>> &threads,
 
     // Sanity check: all of our results should have the same match count.
     for (const auto &t : threads) {
+        // cppcheck-suppress useStlAlgorithm
         if (!all_of(begin(t->results), end(t->results),
                     [&matchesPerRun](const ResultEntry &e) {
                         return e.matches == matchesPerRun;
@@ -813,6 +816,7 @@ void displayCsvResults(const vector<unique_ptr<ThreadContext>> &threads,
 
     // Sanity check: all of our results should have the same match count.
     for (const auto &t : threads) {
+        // cppcheck-suppress useStlAlgorithm
         if (!all_of(begin(t->results), end(t->results),
                     [&matchesPerRun](const ResultEntry &e) {
                         return e.matches == matchesPerRun;
@@ -867,6 +871,7 @@ void sqlResults(const vector<unique_ptr<ThreadContext>> &threads,
 
     // Sanity check: all of our results should have the same match count.
     for (const auto &t : threads) {
+        // cppcheck-suppress useStlAlgorithm
         if (!all_of(begin(t->results), end(t->results),
                     [&matchesPerRun](const ResultEntry &e) {
                         return e.matches == matchesPerRun;
index 73d3e3570dabe88ac8aa4a0ed5118ef44f9c4945..759479622c430cdc8e780d48c7190f62e937d565 100644 (file)
@@ -57,6 +57,7 @@ template<typename Graph, typename Range>
 vector<size_t> to_indices(const Range &range, const Graph &g) {
     vector<size_t> indices;
     for (const auto &elem : range) {
+        // cppcheck-suppress useStlAlgorithm
         indices.push_back(g[elem].index);
     }
     sort(indices.begin(), indices.end());
@@ -68,6 +69,7 @@ vector<size_t> to_indices(const std::initializer_list<T> &range,
                           const Graph &g) {
     vector<size_t> indices;
     for (const auto &elem : range) {
+        // cppcheck-suppress useStlAlgorithm
         indices.push_back(g[elem].index);
     }
     sort(indices.begin(), indices.end());
index df2aff5a007c0370c5bfe4b2410a91deb27227fd..0da620ff981dab1b0e7a35537e4789d9e577bd01 100644 (file)
@@ -61,6 +61,7 @@ unique_ptr<hs_platform_info> xcompileReadMode(const char *s) {
 
     if (!opt.empty()) {
         for (const auto &xcompile : xcompile_options) {
+            // cppcheck-suppress useStlAlgorithm
             if (opt == xcompile.name) {
                 rv.cpu_features = xcompile.cpu_features;
                 found_mode = true;
index 6c3f613d214ae957170cbd754a60133cfedeb483..1be7112decd36c470a932978ae3dd2729cae9302 100644 (file)
@@ -80,11 +80,13 @@ string pathToString(const NGHolder &g, const VertexPath &p) {
 /** True if this graph has no non-special successors of start or startDs. */
 static
 bool graph_is_empty(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &v : adjacent_vertices_range(g.start, g)) {
         if (!is_special(v, g)) {
             return false;
         }
     }
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &v : adjacent_vertices_range(g.start, g)) {
         if (!is_special(v, g)) {
             return false;
@@ -468,6 +470,7 @@ void CorpusGeneratorUtf8::generateCorpus(vector<string> &data) {
     }
 
     for (const auto &e : raw) {
+        // cppcheck-suppress useStlAlgorithm
         data.push_back(encodeUtf8(e));
     }
 }
@@ -545,6 +548,7 @@ CorpusGeneratorUtf8::pathToCorpus(const vector<CodePointSet> &path) {
 
     // Generate a corpus from our path
     for (const auto &e : path) {
+        // cppcheck-suppress useStlAlgorithm
         s.push_back(getChar(e));
     }