]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
first batch of cppcheck disables and a few more stl-ifications,
authorG.E <gregory.economou@vectorcamp.gr>
Thu, 16 May 2024 20:01:17 +0000 (23:01 +0300)
committerG.E <gregory.economou@vectorcamp.gr>
Thu, 16 May 2024 20:01:17 +0000 (23:01 +0300)
involving use of accumulate() .

29 files changed:
src/compiler/asserts.cpp
src/fdr/fdr_compile.cpp
src/fdr/fdr_confirm_compile.cpp
src/fdr/teddy_engine_description.cpp
src/nfa/accel_dfa_build_strat.cpp
src/nfa/castlecompile.cpp
src/nfa/dfa_min.cpp
src/nfa/goughcompile.cpp
src/nfa/goughcompile_accel.cpp
src/nfa/goughcompile_reg.cpp
src/nfa/limex_compile.cpp
src/nfa/mcclellancompile.cpp
src/nfa/mcclellancompile_util.cpp
src/nfa/shufticompile.cpp
src/nfa/tamaramacompile.cpp
src/nfagraph/ng_anchored_dots.cpp
src/nfagraph/ng_calc_components.cpp
src/nfagraph/ng_depth.cpp
src/nfagraph/ng_edge_redundancy.cpp
src/nfagraph/ng_equivalence.cpp
src/nfagraph/ng_expr_info.cpp
src/nfagraph/ng_extparam.cpp
src/nfagraph/ng_fuzzy.cpp
src/nfagraph/ng_haig.cpp
src/nfagraph/ng_is_equal.cpp
src/nfagraph/ng_literal_analysis.cpp
src/nfagraph/ng_region.h
src/util/bitfield.h
src/util/ue2_graph.h

index 51a052b04f4435e897f0518b35c61689c6092ef1..b3e89a3a822553af9a6e50ef044cd3785371331b 100644 (file)
@@ -251,6 +251,7 @@ void checkForMultilineStart(ReportManager &rm, NGHolder &g,
 
 static
 bool hasAssertVertices(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         int flags = g[v].assert_flags;
         if (flags & WORDBOUNDARY_FLAGS) {
index d15e4537b40063780aeb9743e816105b5f8d2af6..f087e958522572f728a1b456487bc43cc609adfe 100644 (file)
@@ -136,6 +136,7 @@ void FDRCompiler::createInitialState(FDR *fdr) {
         const vector<LiteralIndex> &bucket_lits = bucketToLits[b];
         u32 min_len = ~0U;
         for (const LiteralIndex &lit_idx : bucket_lits) {
+            // cppcheck-suppress useStlAlgorithm
             min_len = min(min_len, verify_u32(lits[lit_idx].s.length()));
         }
 
index 75b237b0692659895eb23dec77df5ee9352d2518..edd68e0b96fe00fd5baa5ecc1c175de29f4e61ed 100644 (file)
@@ -303,6 +303,7 @@ setupFullConfs(const vector<hwlmLiteral> &lits,
         if (contains(bucketToLits, b)) {
             vector<hwlmLiteral> vl;
             for (const LiteralIndex &lit_idx : bucketToLits.at(b)) {
+                // cppcheck-suppress useStlAlgorithm
                 vl.emplace_back(lits[lit_idx]);
             }
 
index 7cd33ab23ec4bd794464745fa47fd9b22025875b..47c79ef4f4772695bde67096325237aa0ae97ad5 100644 (file)
@@ -71,6 +71,7 @@ void getTeddyDescriptions(vector<TeddyEngineDescription> *out) {
     };
     out->clear();
     for (const auto &def : defns) {
+        // cppcheck-suppress useStlAlgorithm
         out->emplace_back(def);
     }
 }
@@ -123,6 +124,7 @@ bool isAllowed(const vector<hwlmLiteral> &vl, const TeddyEngineDescription &eng,
         u32 n_small_lits = 0;
         for (const auto &lit : vl) {
             if (lit.s.length() < eng.numMasks) {
+                // cppcheck-suppress useStlAlgorithm
                 n_small_lits++;
             }
         }
@@ -204,6 +206,7 @@ unique_ptr<TeddyEngineDescription> getTeddyDescription(u32 engineID) {
     getTeddyDescriptions(&descs);
 
     for (const auto &desc : descs) {
+        // cppcheck-suppress useStlAlgorithm
         if (desc.getID() == engineID) {
             return std::make_unique<TeddyEngineDescription>(desc);
         }
index 7139d5bea7092fa6038df7a90705ffa57e065939..6a8488124b36df085e1d41f25f652d157bd8fafa 100644 (file)
@@ -182,6 +182,7 @@ vector<vector<CharReach>> generate_paths(const raw_dfa &rdfa,
     vector<vector<CharReach>> rv;
     rv.reserve(paths.size());
     for (auto &p : paths) {
+        // cppcheck-suppress useStlAlgorithm
         rv.emplace_back(vector<CharReach>(std::make_move_iterator(p.reach.begin()),
                                        std::make_move_iterator(p.reach.end())));
     }
index 56b12700f32f683cef04c6707b879a67932f0774..2b157d1c2fc643b460cba3855ee7786052073d7f 100644 (file)
@@ -672,6 +672,7 @@ set<ReportID> all_reports(const CastleProto &proto) {
 depth findMinWidth(const CastleProto &proto) {
     depth min_width(depth::infinity());
     for (const PureRepeat &pr : proto.repeats | map_values) {
+        // cppcheck-suppress useStlAlgorithm
         min_width = min(min_width, pr.bounds.min);
     }
     return min_width;
@@ -680,6 +681,7 @@ depth findMinWidth(const CastleProto &proto) {
 depth findMaxWidth(const CastleProto &proto) {
     depth max_width(0);
     for (const PureRepeat &pr : proto.repeats | map_values) {
+        // cppcheck-suppress useStlAlgorithm
         max_width = max(max_width, pr.bounds.max);
     }
     return max_width;
@@ -746,6 +748,7 @@ u32 CastleProto::merge(const PureRepeat &pr) {
 
     // First, see if this repeat is already in this castle.
     for (const auto &m : repeats) {
+        // cppcheck-suppress useStlAlgorithm
         if (m.second == pr) {
             DEBUG_PRINTF("repeat already present, with top %u\n", m.first);
             return m.first;
@@ -970,6 +973,7 @@ void addToHolder(NGHolder &g, u32 top, const PureRepeat &pr) {
 static
 bool hasZeroMinBound(const CastleProto &proto) {
     const depth zero(0);
+    // cppcheck-suppress useStlAlgorithm
     for (const PureRepeat &pr : proto.repeats | map_values) {
         if (pr.bounds.min == zero) {
             return true;
index 757fffbe96fd8764055e0860e9f0e0170dfe56d7..2d251a8968cadc717f5f9f7ffcdfa608abc1fb79 100644 (file)
@@ -263,6 +263,7 @@ void mapping_new_states(const HopcroftInfo &info,
     new_states.reserve(num_partitions);
 
     for (const auto &m : ordering) {
+        // cppcheck-suppress useStlAlgorithm    
         new_states.emplace_back(rdfa.states[m.first]);
     }
     rdfa.states = std::move(new_states);
index 59ef052fe8a2bba47f898e8f7c005915ec55e090..e3f0a71047f007859e91f448040af979ca739c58 100644 (file)
@@ -650,6 +650,7 @@ void GoughSSAVarJoin::generate(UNUSED vector<gough_ins> *out) const {
 
 GoughSSAVar *GoughSSAVarJoin::get_input(const GoughEdge &prev) const {
     for (const auto &var_edge : input_map) {
+        // cppcheck-suppress useStlAlgorithm
         if (contains(var_edge.second, prev)) {
             return var_edge.first;
         }
@@ -992,6 +993,7 @@ 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) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : out_edges_range(v, g)) {
         if (target(e, g) != v) {
             continue;
index 849202a1920af1b4d3b406ce529605e336cc4b03..2a1dba66e9a0a94c3e6b4964ba4a913d9c5a4e85 100644 (file)
@@ -146,6 +146,7 @@ bool verify_neighbour(const GoughGraph &g, GoughVertex u,
                       const map<gough_edge_id, vector<gough_ins> > &blocks,
                       const set<GoughVertex> &succs,
                       const vector<gough_ins> &block_sl) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : out_edges_range(u, g)) {
         if (!g[e].reach.any()) { /* ignore top edges */
             continue;
@@ -172,6 +173,7 @@ static
 bool verify_neighbour_no_block(const GoughGraph &g, GoughVertex u,
                         const map<gough_edge_id, vector<gough_ins> > &blocks,
                         const set<GoughVertex> &succs) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : out_edges_range(u, g)) {
         if (!g[e].reach.any()) { /* ignore top edges */
             continue;
@@ -229,6 +231,7 @@ bool allow_two_byte_accel(const GoughGraph &g,
             succs.insert(target(e, g));
         }
 
+        // cppcheck-suppress useStlAlgorithm
         for (auto w : adjacent_vertices_range(v, g)) {
             if (w != v && !verify_neighbour(g, w, blocks, succs, block_sl)) {
                 return false;
@@ -249,6 +252,7 @@ bool allow_two_byte_accel(const GoughGraph &g,
             }
             succs.insert(target(e, g));
 
+            // cppcheck-suppress useStlAlgorithm
             for (auto w : adjacent_vertices_range(v, g)) {
                 if (w != v && !verify_neighbour_no_block(g, w, blocks, succs)) {
                     return false;
index d088e1c0401da4ebca8885b86ce127a14272fad2..6096d9f7649684b458028f69952537b8ffb4ff67 100644 (file)
@@ -50,6 +50,7 @@ namespace ue2 {
 
 template<typename VarP, typename VarQ>
 void emplace_back_all_raw(vector<VarP> *out, const vector<VarQ> &in) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &var : in) {
         out->emplace_back(var.get());
     }
@@ -380,6 +381,7 @@ template<typename VarP>
 void add_to_dom_ordering(const vector<VarP> &vars,
                          vector<GoughSSAVar *> *out) {
     for (const auto &var : vars) {
+        // cppcheck-suppress useStlAlgorithm
         out->emplace_back(var.get());
     }
 }
index f84cdc32fccd7d998a5ba7d501a33bd079145e03..54859f6ad8839531a2e328226364c1911ca5675f 100644 (file)
@@ -482,6 +482,7 @@ bool allow_wide_accel(NFAVertex v, const NGHolder &g, NFAVertex sds_or_proxy) {
 static
 bool allow_wide_accel(const vector<NFAVertex> &vv, const NGHolder &g,
                       NFAVertex sds_or_proxy) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vv) {
         if (allow_wide_accel(v, g, sds_or_proxy)) {
             return true;
@@ -623,6 +624,7 @@ void fillAccelInfo(build_info &bi) {
 
     vector<NFAVertex> astates;
     for (const auto &m : accel_map) {
+        // cppcheck-suppress useStlAlgorithm
         astates.emplace_back(m.first);
     }
 
@@ -799,12 +801,14 @@ u32 getEffectiveAccelStates(const build_info &args,
             continue;
         }
         for (const auto &s_mask : args.squashMap | map_values) {
+            // cppcheck-suppress useStlAlgorithm
             if (!s_mask.test(state_id)) {
                 may_turn_off |= 1U << accel_id;
                 break;
             }
         }
         for (const auto &s_mask : args.reportSquashMap | map_values) {
+            // cppcheck-suppress useStlAlgorithm
             if (!s_mask.test(state_id)) {
                 may_turn_off |= 1U << accel_id;
                 break;
index 36545e987d29bd025f00836f061e895f47ecec04..c731e3f0de17f1b25e944a2702c04615c3abb619 100644 (file)
@@ -55,6 +55,7 @@
 #include <cstring>
 #include <map>
 #include <memory>
+#include <numeric>
 #include <queue>
 #include <set>
 #include <vector>
@@ -529,10 +530,15 @@ size_t calcWideRegionSize(const dfa_info &info) {
     size_t rv = info.wide_symbol_chain.size() * sizeof(u32) + 4;
 
     // wide info body
-    for (const auto &chain : info.wide_symbol_chain) {
-        rv += ROUNDUP_N(chain.size(), 2) +
-              (info.impl_alpha_size + 1) * sizeof(u16) + 2;
-    }
+    auto chainz = [info=info](size_t z, const vector<symbol_t> &chain) {
+        return z + (size_t)(ROUNDUP_N(chain.size(), 2) +   
+               (info.impl_alpha_size + 1) * sizeof(u16) + 2);
+    };
+    rv += std::accumulate(info.wide_symbol_chain.begin(), info.wide_symbol_chain.end(), 0, chainz);
+    // for (const auto &chain : info.wide_symbol_chain) {
+    //     rv += ROUNDUP_N(chain.size(), 2) +
+    //           (info.impl_alpha_size + 1) * sizeof(u16) + 2;
+    // }
 
     return ROUNDUP_16(rv);
 }
index d0df0319ad072bce676072f8417ffb066442ad24..44831b3d524e1d4db2330dc05427df23683926bc 100644 (file)
@@ -265,6 +265,7 @@ bool can_die_early(const raw_dfa &raw, dstate_id_t s,
     }
 
     for (const auto &next : raw.states[s].next) {
+        // cppcheck-suppress useStlAlgorithm
         if (can_die_early(raw, next, visited, age_limit - 1)) {
             return true;
         }
index 5385a8ce0eb5860bf041b2f16e559ab9854b89ae..58201a87a84e4c9769153a69e730f1ab12a0ca94 100644 (file)
@@ -182,6 +182,7 @@ bool shuftiBuildDoubleMasks(const CharReach &onechar,
         }
         nibble_masks.clear();
         for (const auto &e : new_masks) {
+            // cppcheck-suppress useStlAlgorithm
             nibble_masks.emplace_back(e.second);
         }
     }
index 6f8c3dbe470bde891e860774dfebafe706c66688..d4dd4ab0346da55e6a933397c05e89527eaf2185 100644 (file)
@@ -42,6 +42,8 @@
 #include "util/container.h"
 #include "util/verify_types.h"
 
+#include <numeric>
+
 using namespace std;
 
 namespace ue2 {
@@ -127,9 +129,14 @@ buildTamarama(const TamaInfo &tamaInfo, const u32 queue,
         sizeof(u32) * subSize + 64; // offsets to subengines in bytecode and
                                     // padding for subengines
 
-    for (const auto &sub : tamaInfo.subengines) {
-        total_size += ROUNDUP_CL(sub->length);
-    }
+
+    auto subl = [](size_t z, NFA *sub) {
+        return z + (size_t)(ROUNDUP_CL(sub->length));
+    };
+    total_size += std::accumulate(tamaInfo.subengines.begin(), tamaInfo.subengines.end(), 0, subl);
+    // for (const auto &sub : tamaInfo.subengines) {
+    //     total_size += ROUNDUP_CL(sub->length);
+    // }
 
     // use subSize as a sentinel value for no active subengines,
     // so add one to subSize here
index 9a13376d19354255464ce7c4d1d0c42e20b70713..a2aaeb3619bee5e94608f94a6e885c155acbbaaa 100644 (file)
@@ -137,6 +137,7 @@ NFAVertex findReformable(const NGHolder &g, const set<NFAVertex> &starts,
 static
 bool isStartNode(NFAVertex v, NFAVertex start, const NGHolder &g,
                  bool selfLoopIsAcceptable) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (selfLoopIsAcceptable && u == v) {
             continue;
@@ -307,6 +308,7 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
             }
 
             for (auto v : otherV) {
+                // cppcheck-suppress useStlAlgorithm
                 if (!edge(dotV, v, g).second) {
                     return;
                 }
@@ -441,6 +443,7 @@ bool gatherParticipants(const NGHolder &g,
 
     /* All the non chained v connected to start must be in succ as well
      * TODO: remember why (and document). */
+    // cppcheck-suppress useStlAlgorithm
     for (auto u : adjacent_vertices_range(start, g)) {
         if (is_special(u, g)) {
             continue;
index c5e93cc0b59182b2d43d7d1229cf4cfb3158b514..995d0904b1ed3841c29527c40ebeb68263e05c64 100644 (file)
@@ -77,17 +77,20 @@ static constexpr u32 MAX_TAIL_SHELL_DEPTH = 3;
  * classes.
  */
 bool isAlternationOfClasses(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : vertices_range(g)) {
         if (is_special(v, g)) {
             continue;
         }
         // Vertex must have in edges from starts only.
+        // cppcheck-suppress useStlAlgorithm
         for (auto u : inv_adjacent_vertices_range(v, g)) {
             if (!is_any_start(u, g)) {
                 return false;
             }
         }
         // Vertex must have out edges to accepts only.
+        // cppcheck-suppress useStlAlgorithm
         for (auto w : adjacent_vertices_range(v, g)) {
             if (!is_any_accept(w, g)) {
                 return false;
index 6c90326ce477310aa685eea86956a131cc46fb3a..572ba9ac767ad8813700ce4d3f58ebd0c613aae0 100644 (file)
@@ -157,6 +157,7 @@ vector<bool> findLoopReachable(const Graph &g,
 
     for (auto v : reverse(topoOrder)) {
         for (const auto &e : in_edges_range(v, g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (deadNodes[g[source(e, g)].index]) {
                 deadNodes[g[v].index] = true;
                 break;
index d6e9895b7aa4d9f5cf0725d43f90552154290ae5..e48ebb96febe98082e267ee1f7290a6a1b6d5151 100644 (file)
@@ -63,6 +63,7 @@ bool checkVerticesFwd(const NGHolder &g, const set<NFAVertex> &sad,
     for (auto u : sad) {
         bool ok = false;
         for (auto v : adjacent_vertices_range(u, g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (contains(happy, v)) {
                 ok = true;
                 break;
@@ -85,6 +86,7 @@ bool checkVerticesRev(const NGHolder &g, const set<NFAVertex> &sad,
     for (auto v : sad) {
         bool ok = false;
         for (auto u : inv_adjacent_vertices_range(v, g)) {
+            // cppcheck-suppress useStlAlgorithm
             if (contains(happy, u)) {
                 ok = true;
                 break;
index 7bfe3c9333f49d593f6aa4dd95954300a4f6d2e9..cddc5d685e2fae9b0148fb370a53644333cbae5a 100644 (file)
@@ -197,6 +197,7 @@ bool outIsIrreducible(NFAVertex &v, const NGHolder &g) {
     unsigned nonSpecialVertices = 0;
     for (auto w : adjacent_vertices_range(v, g)) {
         if (!is_special(w, g) && w != v) {
+            // cppcheck-suppress useStlAlgorithm
             nonSpecialVertices++;
         }
     }
@@ -208,6 +209,7 @@ bool inIsIrreducible(NFAVertex &v, const NGHolder &g) {
     unsigned nonSpecialVertices = 0;
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (!is_special(u, g) && u != v) {
+            // cppcheck-suppress useStlAlgorithm
             nonSpecialVertices++;
         }
     }
index 4d4678336406cdfb9af86197ed5ad7c2e4746b6f..7283060e031f5ff5dcf58771eddb98b3445f093f 100644 (file)
@@ -131,6 +131,7 @@ void checkVertex(const ReportManager &rm, const NGHolder &g, NFAVertex v,
 
 static
 bool hasOffsetAdjust(const ReportManager &rm, const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &report_id : all_reports(g)) {
         if (rm.getReport(report_id).offsetAdjust) {
             return true;
index 65e30a14059b6e68cb0aba71ee4db8eaece74c65..66f8dd26c34cd934cd946c4618bfc37769a3a6ee 100644 (file)
@@ -75,6 +75,7 @@ bool hasSameBounds(const Container &reports, const ReportManager &rm) {
     assert(!reports.empty());
 
     const auto &first = rm.getReport(*reports.begin());
+    // cppcheck-suppress useStlAlgorithm
     for (auto id : reports) {
         const auto &report = rm.getReport(id);
         if (report.minOffset != first.minOffset ||
@@ -225,6 +226,7 @@ void updateReportBounds(ReportManager &rm, NGHolder &g,
 
 static
 bool hasVirtualStarts(const NGHolder &g) {
+    // cppcheck-suppress useStlAlgorithm
     for (auto v : adjacent_vertices_range(g.start, g)) {
         if (g[v].assert_flags & POS_FLAG_VIRTUAL_START) {
             return true;
@@ -439,6 +441,7 @@ bool hasOffsetAdjust(const ReportManager &rm, NGHolder &g,
     }
 
     int offsetAdjust = rm.getReport(*reports.begin()).offsetAdjust;
+    // cppcheck-suppress useStlAlgorithm
     for (auto report : reports) {
         const Report &ir = rm.getReport(report);
         if (ir.offsetAdjust != offsetAdjust) {
index 78fd862919a997c4a425c080534ddb1b93f60486..397e385fa1115b316d71bce2fcb5798bdf164239 100644 (file)
@@ -673,6 +673,7 @@ void validate_fuzzy_compile(const NGHolder &g, u32 edit_distance, bool hamming,
     }
     // graph isn't fuzzable if there are edge assertions anywhere in the graph
     for (auto e : edges_range(g)) {
+        // cppcheck-suppress useStlAlgorithm
         if (g[e].assert_flags) {
             throw CompileError("Zero-width assertions are disallowed for "
                                "approximate matching.");
index bf951a0b0bf4e0cbe2d603c1d10b1cb244a1afa6..ae0033ea8fb599a22aa4a4d1a6935e297dc1861b 100644 (file)
@@ -453,6 +453,7 @@ void haig_do_preds(const NGHolder &g, const stateset &nfa_states,
         DEBUG_PRINTF("d vertex %zu\n", g[v].index);
         vector<u32> &out_map = preds[slot_id];
         for (auto u : inv_adjacent_vertices_range(v, g)) {
+            // cppcheck-suppress useStlAlgorithm
             out_map.emplace_back(g[u].index);
         }
 
index ca6e30b3f38a15c4f14b82d8e3f2af68e1142dd8..16e49cd01bf8f0398532acf50e6fd125b127b3f7 100644 (file)
@@ -172,9 +172,11 @@ bool is_equal_i(const NGHolder &a, const NGHolder &b,
     vector<pair<u32, flat_set<u32>>> top_b;
 
     for (const auto &e : out_edges_range(a.start, a)) {
+        // cppcheck-suppress useStlAlgorithm
         top_a.emplace_back(a[target(e, a)].index, a[e].tops);
     }
     for (const auto &e : out_edges_range(b.start, b)) {
+        // cppcheck-suppress useStlAlgorithm
         top_b.emplace_back(b[target(e, b)].index, b[e].tops);
     }
 
index 77964b8128521216389713e087bfac194825c5cd..ee3870dd2f182caf90e2d5584acfede6cb1eb7bf 100644 (file)
@@ -46,6 +46,7 @@
 
 #include <algorithm>
 #include <fstream>
+#include <numeric>
 #include <queue>
 
 #include <boost/graph/boykov_kolmogorov_max_flow.hpp>
@@ -359,6 +360,7 @@ u64a litUniqueness(const string &s) {
 static
 u64a litCountBits(const ue2_literal &lit) {
     u64a n = 0;
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &c : lit) {
         n += c.nocase ? 7 : 8;
     }
@@ -670,10 +672,11 @@ u64a scoreSet(const set<ue2_literal> &s) {
     }
 
     u64a score = 1ULL;
-
-    for (const auto &lit : s) {
-        score += calculateScore(lit);
-    }
+    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 a4708a582ed25216bd1a62700aab67d3475c61ce..9f53a0e46510f6b0068524c5091f94911ca074c6 100644 (file)
@@ -141,12 +141,14 @@ bool isRegionExit(const Graph &g, NFAVertex v,
 template <class Graph>
 bool isSingletonRegion(const Graph &g, NFAVertex v,
                        const std::unordered_map<NFAVertex, u32> &region_map) {
+    // cppcheck-suppress useStlAlgorithm
     for (const auto &e : in_edges_range(v, g)) {
         auto u = source(e, g);
         if (u != v && inSameRegion(g, v, u, region_map)) {
             return false;
         }
 
+        // cppcheck-suppress useStlAlgorithm
         for (auto w : ue2::adjacent_vertices_range(u, g)) {
             if (w != v && inSameRegion(g, v, w, region_map)) {
                 return false;
@@ -154,11 +156,13 @@ bool isSingletonRegion(const Graph &g, NFAVertex v,
         }
     }
 
+    // cppcheck-suppress useStlAlgorithm
     for (auto w : adjacent_vertices_range(v, g)) {
         if (w != v && inSameRegion(g, v, w, region_map)) {
             return false;
         }
 
+        // cppcheck-suppress useStlAlgorithm
         for (const auto &e : in_edges_range(w, g)) {
             auto u = source(e, g);
             if (u != v && inSameRegion(g, v, u, region_map)) {
@@ -201,7 +205,7 @@ bool isOptionalRegion(const Graph &g, NFAVertex v,
         DEBUG_PRINTF("  searching from u=%zu\n", g[u].index);
 
         assert(inEarlierRegion(g, v, u, region_map));
-
+        // cppcheck-suppress useStlAlgorithm
         for (auto w : adjacent_vertices_range(u, g)) {
             DEBUG_PRINTF("    searching to w=%zu\n", g[w].index);
             if (inLaterRegion(g, v, w, region_map)) {
index 4a3fbd6ed50aeb352309daa5e3bf7584f9bb03a3..14da9967fe8bd00c2dc5e76b81c7cac6829d6c1f 100644 (file)
@@ -200,6 +200,8 @@ public:
 
     /// Are no bits set?
     bool none() const {
+        // cppcheck-suppress useStlAlgorithm
+        // XXX maybe do this one.. 
         for (const auto &e : bits) {
             if (e != 0) {
                 return false;
index aa9718d73a656902c73b23c9be5247efd017a35f..bff495669b3de54ade6cecc03afcd3a5bda026c8 100644 (file)
@@ -616,12 +616,14 @@ public:
                                                vertex_descriptor v) const {
         if (in_degree_impl(v) < out_degree_impl(u)) {
             for (const edge_descriptor &e : in_edges_range(v, *this)) {
+                // cppcheck-suppress useStlAlgorithm
                 if (source_impl(e) == u) {
                     return {e, true};
                 }
             }
         } else {
             for (const edge_descriptor &e : out_edges_range(u, *this)) {
+                // cppcheck-suppress useStlAlgorithm
                 if (target_impl(e) == v) {
                     return {e, true};
                 }