]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
next batch
authorG.E <gregory.economou@vectorcamp.gr>
Thu, 16 May 2024 21:08:37 +0000 (00:08 +0300)
committerG.E <gregory.economou@vectorcamp.gr>
Thu, 16 May 2024 21:08:37 +0000 (00:08 +0300)
24 files changed:
src/nfagraph/ng_literal_analysis.cpp
src/nfagraph/ng_misc_opt.cpp
src/nfagraph/ng_prune.cpp
src/nfagraph/ng_puff.cpp
src/nfagraph/ng_redundancy.cpp
src/nfagraph/ng_region.cpp
src/nfagraph/ng_region_redundancy.cpp
src/nfagraph/ng_repeat.cpp
src/nfagraph/ng_reports.cpp
src/nfagraph/ng_restructuring.cpp
src/nfagraph/ng_sep.cpp
src/nfagraph/ng_small_literal_set.cpp
src/nfagraph/ng_som.cpp
src/nfagraph/ng_som_add_redundancy.cpp
src/nfagraph/ng_som_util.cpp
src/nfagraph/ng_squash.cpp
src/nfagraph/ng_util.cpp
src/nfagraph/ng_violet.cpp
src/parser/ComponentAlternation.cpp
src/parser/ComponentRepeat.cpp
src/parser/ComponentSequence.cpp
src/parser/buildstate.cpp
src/rose/rose_build_add.cpp
src/smallwrite/smallwrite_build.cpp

index ee3870dd2f182caf90e2d5584acfede6cb1eb7bf..9fdd8e65db16eb8ea807e247f385b90c9bfc677c 100644 (file)
@@ -674,9 +674,6 @@ u64a scoreSet(const set<ue2_literal> &s) {
     u64a score = 1ULL;
     auto cscore = [](u64a z, const ue2_literal &lit) { return z + calculateScore(lit); };
     score += std::accumulate(s.begin(), s.end(), 0, cscore);
-    // for (const auto &lit : s) {
-    //     score += calculateScore(lit);
-    // }
 
     return score;
 }
index 2b898cf764f84237422ba4e096d69b38716a5bf7..99c98a8149d45b7c62f9884da52eafa72308a44f 100644 (file)
@@ -154,6 +154,7 @@ void predCRIntersection(const NGHolder &g, NFAVertex v, CharReach &add) {
     add.setall();
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (u != v) {
+            // cppcheck-suppress useStlAlgorithm
             add &= g[u].char_reach;
         }
     }
@@ -165,6 +166,7 @@ void succCRIntersection(const NGHolder &g, NFAVertex v, CharReach &add) {
     add.setall();
     for (auto u : adjacent_vertices_range(v, g)) {
         if (u != v) {
+            // cppcheck-suppress useStlAlgorithm
             add &= g[u].char_reach;
         }
     }
@@ -195,6 +197,7 @@ set<NFAVertex> findSustainSet(const NGHolder &g, NFAVertex p,
             CharReach sus_cr;
             for (auto v : adjacent_vertices_range(u, g)) {
                 if (contains(cand, v)) {
+                    // cppcheck-suppress useStlAlgorithm
                     sus_cr |= g[v].char_reach;
                 }
             }
@@ -227,6 +230,7 @@ set<NFAVertex> findSustainSet_rev(const NGHolder &g, NFAVertex p,
             CharReach sus_cr;
             for (auto v : inv_adjacent_vertices_range(u, g)) {
                 if (contains(cand, v)) {
+                    // cppcheck-suppress useStlAlgorithm
                     sus_cr |= g[v].char_reach;
                 }
             }
@@ -282,6 +286,7 @@ bool enlargeCyclicVertex(NGHolder &g, som_type som, NFAVertex v) {
             CharReach sustain_cr;
             for (auto pv : adjacent_vertices_range(pp, g)) {
                 if (contains(sustain, pv)) {
+                    // cppcheck-suppress useStlAlgorithm
                     sustain_cr |= g[pv].char_reach;
                 }
             }
@@ -332,6 +337,7 @@ bool enlargeCyclicVertex_rev(NGHolder &g, NFAVertex v) {
             CharReach sustain_cr;
             for (auto pv : inv_adjacent_vertices_range(pp, g)) {
                 if (contains(sustain, pv)) {
+                    // cppcheck-suppress useStlAlgorithm
                     sustain_cr |= g[pv].char_reach;
                 }
             }
index 73d7e64b27f8a25d0d0fbb35069e26cecc9a569c..042807fab160f35b6d8160846a0cde73502345a6 100644 (file)
@@ -251,12 +251,14 @@ bool hasOnlySelfLoopAndExhaustibleAccepts(const NGHolder &g,
         return false;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto w : adjacent_vertices_range(v, g)) {
         if (w != v && w != g.accept) {
             return false;
         }
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &report_id : g[v].reports) {
         if (!isSimpleExhaustible(rm.getReport(report_id))) {
             return false;
index 9b03f4c07910e2110daeeefb44ee096c85fe6fc6..33bb2a9e0ed14a7d355f768ff90abece67fa94ea 100644 (file)
@@ -154,6 +154,7 @@ static
 bool triggerResetsPuff(const NGHolder &g, NFAVertex head) {
     const CharReach puff_escapes = ~g[head].char_reach;
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(head, g)) {
         if (!g[u].char_reach.isSubsetOf(puff_escapes)) {
             DEBUG_PRINTF("no reset on trigger %zu %zu\n", g[u].index,
@@ -187,6 +188,7 @@ bool triggerFloodsPuff(const NGHolder &g, NFAVertex head) {
         DEBUG_PRINTF("temp new head = %zu\n", g[head].index);
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto s : inv_adjacent_vertices_range(head, g)) {
         DEBUG_PRINTF("s = %zu\n", g[s].index);
         if (!puff_cr.isSubsetOf(g[s].char_reach)) {
@@ -224,6 +226,7 @@ u32 allowedSquashDistance(const CharReach &cr, u32 min_width, const NGHolder &g,
 
     /* TODO: inspect further back in the pattern */
     for (auto u : inv_adjacent_vertices_range(pv, g)) {
+        // cppcheck-suppress useStlAlgorithm
         accept_cr |= g[u].char_reach;
     }
 
@@ -367,6 +370,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a,
 
     if (!nodes.empty() && proper_in_degree(nodes.back(), g) != 1) {
         for (auto u : inv_adjacent_vertices_range(nodes.back(), g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (is_special(u, g)) {
                 DEBUG_PRINTF("pop\n");
                 a = nodes.back();
@@ -453,6 +457,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a,
     const auto &reports = g[nodes[0]].reports;
     assert(!reports.empty());
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto report : reports) {
         const Report &ir = rm.getReport(report);
         const bool highlander = ir.ekey != INVALID_EKEY;
@@ -499,6 +504,7 @@ bool splitOffPuffs(RoseBuild &rose, ReportManager &rm, NGHolder &g,
 
     for (auto v : inv_adjacent_vertices_range(g.accept, g)) {
         if (doComponent(rose, rm, g, v, dead, cc, prefilter)) {
+            // cppcheck-suppress useStlAlgorithm
             count++;
         }
     }
index a499a40d41fa6bd31fab59ccfd9e1c4942c3b875..6e89c5c8757d3aada01e11ff03b67338f0344237 100644 (file)
@@ -682,6 +682,7 @@ bool forwardPathReachSubset(const NFAEdge &e, const NFAVertex &dom,
 
 static
 bool allOutsSpecial(NFAVertex v, const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto w : adjacent_vertices_range(v, g)) {
         if (!is_special(w, g)) {
             return false;
@@ -692,6 +693,7 @@ bool allOutsSpecial(NFAVertex v, const NGHolder &g) {
 
 static
 bool allInsSpecial(NFAVertex v, const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (!is_special(u, g)) {
             return false;
@@ -704,6 +706,7 @@ bool allInsSpecial(NFAVertex v, const NGHolder &g) {
  * just a chain of vertices with no other edges. */
 static
 bool isIrreducible(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         // skip specials
         if (is_special(v, g)) {
index 1d5bc164b9109da0bf25b71d36cec288beca9e54..b53e6849db820eb89ceb78421fadb5040c6708fd 100644 (file)
@@ -153,6 +153,7 @@ bool exitValid(UNUSED const AcyclicGraph &g, const vector<exit_info> &exits,
     }
 
     for (auto it = begin(exits) + 1; it != end(exits); ++it) {
+        // cppcheck-suppress useStlAlgorithm
         if (it->open != enters) {
             return false;
         }
index a3ea558f8dc482dd4f74e22154639cbf446e2cbe..e876a1bd962c5db315b1228f4c59868c74ec09ad 100644 (file)
@@ -62,6 +62,7 @@ bool regionHasUnexpectedAccept(const NGHolder &g, const u32 region,
                        const flat_set<ReportID> &expected_reports,
                        const unordered_map<NFAVertex, u32> &region_map) {
     /* TODO: only check vertices connected to accept/acceptEOD */
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         if (region != region_map.at(v)) {
             continue;
@@ -71,7 +72,7 @@ bool regionHasUnexpectedAccept(const NGHolder &g, const u32 region,
             return true; /* encountering an actual special in the region is
                           * possible but definitely unexpected */
         }
-
+        // cppcheck-suppress useStlAlgorithm
         for (auto w : adjacent_vertices_range(v, g)) {
             if (is_any_accept(w, g) && g[v].reports != expected_reports) {
                 return true;
@@ -200,6 +201,7 @@ map<u32, RegionInfo> buildRegionInfoMap(const NGHolder &g,
 
 static
 bool hasNoStartAnchoring(const NGHolder &h) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(h.start, h)) {
         if (!edge(h.startDs, v, h).second) {
             return false;
index 2aa318089fba9116f653971c41281225f7459882..a0c2735f7f4962885725ba805e24ed4287eeb919 100644 (file)
@@ -260,6 +260,7 @@ bool vertexIsBad(const NGHolder &g, NFAVertex v,
     // We must drop any vertex that is the target of a back-edge within
     // our subgraph. The tail set contains all vertices that are after v in a
     // topo ordering.
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (contains(tail, u)) {
             DEBUG_PRINTF("back-edge (%zu,%zu) in subgraph found\n",
@@ -343,6 +344,7 @@ static
 void findFirstReports(const NGHolder &g, const ReachSubgraph &rsi,
                       flat_set<ReportID> &reports) {
     for (auto v : rsi.vertices) {
+        // cppcheck-suppress useStlAlgorithm
         if (is_match_vertex(v, g)) {
             reports = g[v].reports;
             return;
@@ -620,6 +622,7 @@ bool processSubgraph(const NGHolder &g, ReachSubgraph &rsi,
 static
 bool allPredsInSubgraph(NFAVertex v, const NGHolder &g,
                         const unordered_set<NFAVertex> &involved) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (!contains(involved, u)) {
             return false;
@@ -688,6 +691,7 @@ u32 isCloseToAccept(const NGHolder &g, NFAVertex v) {
     }
 
     for (auto w : adjacent_vertices_range(v, g)) {
+        // cppcheck-suppress useStlAlgorithm
         if (is_any_accept(w, g)) {
             return 1;
         }
@@ -702,6 +706,7 @@ u32 unpeelAmount(const NGHolder &g, const ReachSubgraph &rsi) {
     u32 rv = 0;
 
     for (auto v : adjacent_vertices_range(last, g)) {
+        // cppcheck-suppress useStlAlgorithm
         rv = max(rv, isCloseToAccept(g, v));
     }
 
@@ -995,6 +1000,7 @@ bool peelSubgraph(const NGHolder &g, const Grey &grey, ReachSubgraph &rsi,
 
     // If vertices in the middle are involved in other repeats, it's a definite
     // no-no.
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : rsi.vertices) {
         if (contains(created, v)) {
             DEBUG_PRINTF("vertex %zu is in another repeat\n", g[v].index);
@@ -1075,7 +1081,9 @@ bool hasSkipEdges(const NGHolder &g, const ReachSubgraph &rsi) {
     const NFAVertex last = rsi.vertices.back();
 
     // All of the preds of first must have edges to all the successors of last.
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(first, g)) {
+        // cppcheck-suppress useStlAlgorithm
         for (auto v : adjacent_vertices_range(last, g)) {
             if (!edge(u, v, g).second) {
                 return false;
@@ -1114,6 +1122,7 @@ bool entered_at_fixed_offset(NFAVertex v, const NGHolder &g,
     }
     DEBUG_PRINTF("first is at least %s from start\n", first.str().c_str());
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         const depth &u_max_depth = depths.at(u).fromStart.max;
         DEBUG_PRINTF("pred %zu max depth %s from start\n", g[u].index,
@@ -1204,6 +1213,7 @@ static
 CharReach predReach(const NGHolder &g, NFAVertex v) {
     CharReach cr;
     for (auto u : inv_adjacent_vertices_range(v, g)) {
+        // cppcheck-suppress useStlAlgorithm
         cr |= g[u].char_reach;
     }
     return cr;
@@ -1431,6 +1441,7 @@ struct StrawWalker {
      * inf max bound). */
     bool isBoundedRepeatCyclic(NFAVertex v) const {
         for (const auto &r : repeats) {
+            // cppcheck-suppress useStlAlgorithm
             if (r.repeatMax.is_finite() && r.cyclic == v) {
                 return true;
             }
@@ -1580,6 +1591,7 @@ bool hasCyclicSupersetExitPath(const NGHolder &g, const ReachSubgraph &rsi,
 static
 bool leadsOnlyToAccept(const NGHolder &g, const ReachSubgraph &rsi) {
     const NFAVertex u = rsi.vertices.back();
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(u, g)) {
         if (v != g.accept) {
             return false;
@@ -1593,6 +1605,7 @@ static
 bool allSimpleHighlander(const ReportManager &rm,
                          const flat_set<ReportID> &reports) {
     assert(!reports.empty());
+    // cppcheck-suppress useStlAlgorithm
     for (auto report : reports) {
         if (!isSimpleExhaustible(rm.getReport(report))) {
             return false;
@@ -1909,6 +1922,7 @@ bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd,
         DEBUG_PRINTF("startDs has other successors\n");
         return false;
     }
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &v : straw) {
         if (proper_out_degree(v, g) != 1) {
             DEBUG_PRINTF("branch between startDs and repeat, from vertex %zu\n",
index 4e9b498df06f60b6d70ab4ab1fe473fccf899f18..c990a57a9fb8b6a310fe162737c16b549e417151 100644 (file)
@@ -56,6 +56,7 @@ set<ReportID> all_reports(const NGHolder &g) {
 
 /** True if *all* reports in the graph are exhaustible. */
 bool can_exhaust(const NGHolder &g, const ReportManager &rm) {
+    // cppcheck-suppress useStlAlgorithm
     for (ReportID report_id : all_reports(g)) {
         if (rm.getReport(report_id).ekey == INVALID_EKEY) {
             return false;
index 73b4d23e5f6bbbfce034e33d974ab5c42b2e10b5..50c4d64d683f58c800aa9f13c7185ce0c4750e57 100644 (file)
@@ -210,6 +210,7 @@ u32 countStates(const unordered_map<NFAVertex, u32> &state_ids) {
     u32 max_state = 0;
     for (const auto &m : state_ids) {
         if (m.second != NO_STATE) {
+            // cppcheck-suppress useStlAlgorithm
             max_state = max(m.second, max_state);
         }
     }
index 86528b4a00e287e62378e856ebc04398ca6f4d9e..a328679a153b0c00fe6cb783a6532fb21f867c92 100644 (file)
@@ -56,6 +56,7 @@ namespace ue2 {
 
 static
 bool checkFromVertex(const NGHolder &g, NFAVertex start) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(start, g)) {
         if (v == g.startDs) {
             continue;
index 9c2d9ba38d16e0fdbf7819a772552aa74241239c..d2efbc89d25b69cd270f5381c94ca50319da477b 100644 (file)
@@ -103,6 +103,7 @@ bool checkLongMixedSensitivityLiterals(
         const map<sls_literal, flat_set<ReportID>> &literals) {
     const size_t len = MAX_MASK2_WIDTH;
 
+    // cppcheck-suppress useStlAlgorithm
     for (const sls_literal &lit : literals | map_keys) {
         if (mixed_sensitivity(lit.s) && lit.s.length() > len) {
             return false;
@@ -202,6 +203,7 @@ size_t min_period(const map<sls_literal, flat_set<ReportID>> &literals) {
     size_t rv = SIZE_MAX;
 
     for (const sls_literal &lit : literals | map_keys) {
+        // cppcheck-suppress useStlAlgorithm
         rv = min(rv, minStringPeriod(lit.s));
     }
     DEBUG_PRINTF("min period %zu\n", rv);
index 359fa17bc33945f1e2484c2f3d93606f22708c7e..d40bbdef3a22b940ae182f6927ad07b3bcb25f89 100644 (file)
@@ -545,6 +545,7 @@ bool finalRegion(const NGHolder &g,
                  const unordered_map<NFAVertex, u32> &regions,
                  NFAVertex v) {
     u32 region = regions.at(v);
+    // cppcheck-suppress useStlAlgorithm
     for (auto w : adjacent_vertices_range(v, g)) {
         if (w != g.accept && w != g.acceptEod && regions.at(w) != region) {
             return false;
@@ -2331,6 +2332,7 @@ bool splitOffLeadingLiterals(const NGHolder &g, set<ue2_literal> *lit_out,
     assert(!terms.empty());
     set<NFAVertex> adj_term1;
     insert(&adj_term1, adjacent_vertices(*terms.begin(), g));
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : terms) {
         DEBUG_PRINTF("term %zu\n", g[v].index);
         set<NFAVertex> temp;
index 871679d99297ee3e008c9dc49fee90df17acc32a..50b49abdedc27e984b267afdebef14f8a56a5bba 100644 (file)
@@ -86,6 +86,7 @@ const DepthMinMax &getDepth(NFAVertex v, const NGHolder &g,
 static
 bool hasFloatingPred(NFAVertex v, const NGHolder &g,
                      const vector<DepthMinMax> &depths) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         const DepthMinMax &d = getDepth(u, g, depths);
         if (d.min != d.max) {
index 82277c061fe18fe8b4cce5ab73783e17f6d9941b..f2501c763f1d79a594f3841e53da2dcc4f17e465 100644 (file)
@@ -151,6 +151,7 @@ bool firstMatchIsFirst(const NGHolder &p) {
     /* run the prefix the main graph */
     states = execute_graph(p, p, states);
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : states) {
         /* need to check if this vertex may represent an infix match - ie
          * it does not have an edge to accept. */
@@ -252,6 +253,7 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
             continue;
         }
         for (auto v : adjacent_vertices_range(t, g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (contains(u_succ, v)) {
                 /* due to virtual starts being aliased with normal starts in the
                  * copy of the graph, we may have already added the edges. */
index 0b51792b14c48b27100325bb2b93563acee980c2..eba642dc62ca1f7e1298f01dcea33d77ffa7731b 100644 (file)
@@ -281,6 +281,7 @@ void findDerivedSquashers(const NGHolder &g, const vector<NFAVertex> &vByIndex,
                           smgb_cache &cache) {
     deque<NFAVertex> remaining;
     for (const auto &m : *squash) {
+        // cppcheck-suppress useStlAlgorithm
         remaining.emplace_back(m.first);
     }
 
index b1d39d2e3a6d5019a7cdba600edb0578fa3ff879..d6a90146da620426162366ad9fe826a1f5b63fba 100644 (file)
@@ -177,6 +177,7 @@ bool isVacuous(const NGHolder &h) {
 }
 
 bool isAnchored(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(g.startDs, g)) {
         if (v != g.startDs) {
             return false;
@@ -186,6 +187,7 @@ bool isAnchored(const NGHolder &g) {
 }
 
 bool isFloating(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(g.start, g)) {
         if (v != g.startDs && !edge(g.startDs, v, g).second) {
             return false;
@@ -228,6 +230,7 @@ bool hasBigCycles(const NGHolder &g) {
     boost::depth_first_search(g, backEdgeVisitor, make_small_color_map(g),
                               g.start);
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : dead) {
         if (source(e, g) != target(e, g)) {
             return true;
@@ -259,6 +262,7 @@ bool can_match_at_eod(const NGHolder &h) {
         return true;
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto e : in_edges_range(h.accept, h)) {
         if (h[e].assert_flags) {
             DEBUG_PRINTF("edge to accept has assert flags %d\n",
index 02461e9818fed2495af143d9c1275fc34d83a6b6..635f9400bb2a8fafc8c53bc13bb73bd7ed920bf6 100644 (file)
@@ -89,9 +89,11 @@ bool createsAnchoredLHS(const NGHolder &g, const vector<NFAVertex> &vv,
                         const Grey &grey, depth max_depth = depth::infinity()) {
     max_depth = min(max_depth, depth(grey.maxAnchoredRegion));
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vv) {
         /* avoid issues of self loops blowing out depths:
          *     look at preds, add 1 */
+        // cppcheck-suppress useStlAlgorithm
         for (auto u : inv_adjacent_vertices_range(v, g)) {
             if (u == v) {
                 continue;
@@ -116,9 +118,11 @@ bool createsTransientLHS(const NGHolder &g, const vector<NFAVertex> &vv,
                          const Grey &grey) {
     const depth max_depth(grey.maxHistoryAvailable);
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vv) {
         /* avoid issues of self loops blowing out depths:
          *     look at preds, add 1 */
+        // cppcheck-suppress useStlAlgorithm
         for (auto u : inv_adjacent_vertices_range(v, g)) {
             if (u == v) {
                 continue;
@@ -162,6 +166,7 @@ u32 min_len(const set<ue2_literal> &s) {
     u32 rv = ~0U;
 
     for (const auto &lit : s) {
+        // cppcheck-suppress useStlAlgorithm
         rv = min(rv, (u32)lit.length());
     }
 
@@ -173,6 +178,7 @@ u32 min_period(const set<ue2_literal> &s) {
     u32 rv = ~0U;
 
     for (const auto &lit : s) {
+        // cppcheck-suppress useStlAlgorithm
         rv = min(rv, (u32)minStringPeriod(lit));
     }
     DEBUG_PRINTF("min period %u\n", rv);
@@ -394,6 +400,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored,
 
     lits->reserve(lit_info.size());
     for (auto &m : lit_info) {
+        // cppcheck-suppress useStlAlgorithm
         lits->emplace_back(std::move(m.second));
     }
     DEBUG_PRINTF("%zu candidate literal sets\n", lits->size());
@@ -1196,6 +1203,7 @@ bool checkValidNetflowLits(NGHolder &h, const vector<u64a> &scores,
 
         for (const auto &lit : cut.second) {
             if (lit.length() == 2) {
+                // cppcheck-suppress useStlAlgorithm
                 len_2_count++;
             }
         }
@@ -1807,6 +1815,7 @@ void removeRedundantLiterals(RoseInGraph &g, const CompileContext &cc) {
 static
 RoseInVertex getStart(RoseInGraph &vg) {
     for (RoseInVertex v : vertices_range(vg)) {
+        // cppcheck-suppress useStlAlgorithm
         if (vg[v].type == RIV_START || vg[v].type == RIV_ANCHORED_START) {
             return v;
         }
@@ -1822,6 +1831,7 @@ RoseInVertex getStart(RoseInGraph &vg) {
 static
 RoseInVertex getPrimaryAccept(RoseInGraph &vg) {
     for (RoseInVertex v : vertices_range(vg)) {
+        // cppcheck-suppress useStlAlgorithm
         if (vg[v].type == RIV_ACCEPT && vg[v].reports.empty()) {
             return v;
         }
@@ -2833,6 +2843,7 @@ bool doEarlyDfa(RoseBuild &rose, RoseInGraph &vg, NGHolder &h,
     DEBUG_PRINTF("trying for dfa\n");
 
     bool single_trigger;
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : edges) {
         if (vg[target(e, vg)].type == RIV_ACCEPT_EOD) {
             /* TODO: support eod prefixes */
index e38c9ce79fd1dba2db2e7680733629cb1a8969d2..2eee705a72127895b3c4428f33d302c1bf0f4263 100644 (file)
@@ -130,6 +130,7 @@ vector<PositionInfo> ComponentAlternation::last() const {
 
 bool ComponentAlternation::empty(void) const {
     // an alternation can be empty if any of its components are empty
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &c : children) {
         if (c->empty()) {
             return true;
@@ -173,6 +174,7 @@ bool ComponentAlternation::checkEmbeddedEndAnchor(bool at_end) const {
 }
 
 bool ComponentAlternation::vacuous_everywhere(void) const {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &c : children) {
         if (c->vacuous_everywhere()) {
             return true;
index 7090459f51478e4a24454c1068a552c21e945874..f4c7e3704960a4e3041d4b3d892c5bb34dd65586 100644 (file)
@@ -113,6 +113,7 @@ static
 void checkPositions(vector<PositionInfo> &v, const GlushkovBuildState &bs) {
     const NFABuilder& builder = bs.getBuilder();
     for (const auto &e : v) {
+        // cppcheck-suppress useStlAlgorithm
         if (builder.isSpecialState(e.pos)) {
             throw ParseError("Embedded anchors not supported.");
         }
@@ -341,6 +342,7 @@ inf_check:
 
 static
 bool hasPositionFlags(const Component &c) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : c.first()) {
         if (e.flags) {
             return true;
index 2b78177b8ae87a2b30e15b73a29133b639544197..40f4122513b956163c9a572d7b528d142df3f584 100644 (file)
@@ -253,6 +253,7 @@ vector<PositionInfo> ComponentSequence::last() const {
 
 bool ComponentSequence::empty(void) const {
     // a sequence can be empty if all its subcomponents can be empty
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &c : children) {
         if (!c->empty()) {
             return false;
@@ -342,6 +343,7 @@ bool ComponentSequence::checkEmbeddedEndAnchor(bool at_end) const {
 }
 
 bool ComponentSequence::vacuous_everywhere() const {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &c : children) {
         if (!c->vacuous_everywhere()) {
             return false;
index 96f91cb6cd5865b4aa561ddf03bd9bb6d2b2192a..5bdd0f14408c8615dfd7fb758b3820f3992c22f8 100644 (file)
@@ -175,6 +175,7 @@ void checkEmbeddedEndAnchor(const PositionInfo &from,
     }
 
     for (const auto &first : firsts) {
+        // cppcheck-suppress useStlAlgorithm
         if (first.pos != GlushkovBuildStateImpl::POS_EPSILON) {
             /* can make it through the parse tree */
             throw ParseError("Embedded end anchors not supported.");
index 5aed21f573616c4b0c6213e60cea42b1818a8750..3f27dba1c49b8ed7cef5c6114de812214710242b 100644 (file)
@@ -241,6 +241,7 @@ RoseRoleHistory selectHistory(const RoseBuildImpl &tbi, const RoseBuildData &bd,
 
 static
 bool hasSuccessorLiterals(RoseInVertex iv, const RoseInGraph &ig) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(iv, ig)) {
         if (ig[v].type != RIV_ACCEPT) {
             return true;
@@ -833,6 +834,7 @@ bool suitableForEod(const RoseInGraph &ig, vector<RoseInVertex> topo,
 
         if (ig[v].type == RIV_ACCEPT) {
             DEBUG_PRINTF("[ACCEPT]\n");
+            // cppcheck-suppress useStlAlgorithm
             for (const auto &e : in_edges_range(v, ig)) {
                 if (!ig[e].graph || !can_only_match_at_eod(*ig[e].graph)) {
                     DEBUG_PRINTF("floating accept\n");
@@ -1057,6 +1059,7 @@ static
 bool predsAreDelaySensitive(const RoseInGraph &ig, RoseInVertex v) {
     assert(in_degree(v, ig));
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : in_edges_range(v, ig)) {
         if (ig[e].graph || ig[e].haig) {
             DEBUG_PRINTF("edge graph\n");
@@ -1626,6 +1629,7 @@ bool roseCheckRose(const RoseInGraph &ig, bool prefilter,
         graphs.emplace_back(ig[e].graph.get());
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &g : graphs) {
         if (!canImplementGraph(*g, prefilter, rm, cc)) {
             return false;
@@ -1930,6 +1934,7 @@ bool RoseBuildImpl::addAnchoredAcyclic(const NGHolder &h) {
     flat_set<u32> added_lit_ids;          /* literal ids added for this NFA */
 
     for (auto v : inv_adjacent_vertices_range(h.accept, h)) {
+        // cppcheck-suppress useStlAlgorithm
         if (!prepAcceptForAddAnchoredNFA(*this, h, v, vertexDepths, depthMap,
                                          reportMap, allocated_reports,
                                          added_lit_ids)) {
index e1d2f1f31473db305c2f12a79ca584442871ce20..df8b73f2a01b682c03989fcdbdb08e5656f6ac44 100644 (file)
@@ -241,6 +241,7 @@ bool mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, const ReportManager &rm,
     vector<const raw_dfa *> dfa_ptrs;
     dfa_ptrs.reserve(dfas.size());
     for (auto &d : dfas) {
+        // cppcheck-suppress useStlAlgorithm
         dfa_ptrs.emplace_back(d.get());
     }
 
@@ -331,6 +332,7 @@ bool add_to_trie(const ue2_literal &literal, ReportID report, LitTrie &trie) {
     for (const auto &c : literal) {
         auto next = LitTrie::null_vertex();
         for (auto v : adjacent_vertices_range(u, trie)) {
+            // cppcheck-suppress useStlAlgorithm
             if (trie[v].c == (u8)c.c) {
                 next = v;
                 break;
@@ -409,6 +411,7 @@ struct ACVisitor : public boost::default_bfs_visitor {
         while (u != trie.root) {
             auto f = failure_map.at(u);
             for (auto w : adjacent_vertices_range(f, trie)) {
+                // cppcheck-suppress useStlAlgorithm
                 if (trie[w].c == c) {
                     return w;
                 }