]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Don't shadow names
authorMatthew Barr <matthew.barr@intel.com>
Mon, 25 Jul 2016 05:33:40 +0000 (15:33 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 10 Aug 2016 05:06:57 +0000 (15:06 +1000)
12 files changed:
CMakeLists.txt
src/fdr/fdr_streaming_compile.cpp
src/fdr/teddy_compile.cpp
src/nfa/goughcompile.cpp
src/nfa/multiaccel_compilehelper.cpp
src/nfagraph/ng_violet.cpp
src/parser/Parser.rl
src/rose/rose_build_add.cpp
src/rose/rose_build_bytecode.cpp
src/rose/rose_build_compile.cpp
src/rose/rose_build_matchers.cpp
unit/internal/shufti.cpp

index e748e9550620ea950d32f5e7f2c148938fbe08f9..e1f275628c763f3203a6cd28a833d5d343c49d36 100644 (file)
@@ -174,7 +174,7 @@ else()
 
     # set compiler flags - more are tested and added later
     set(EXTRA_C_FLAGS "-std=c99 -Wall -Wextra -Wshadow -Wcast-qual -fno-strict-aliasing")
-    set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wno-shadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing")
+    set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wshadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing")
     if (NOT RELEASE_BUILD)
         # -Werror is most useful during development, don't potentially break
         # release builds
index f3001743e50d2fca8ad0e2bdaf9e052f50be096f..f84e3ad6fe5792bee20a0537f90b332e7206b298 100644 (file)
@@ -195,18 +195,18 @@ struct OffsetIDFromEndOrder {
 
 static
 void fillHashes(const vector<hwlmLiteral> &long_lits, size_t max_len,
-                FDRSHashEntry *tab, size_t numEntries, MODES m,
+                FDRSHashEntry *tab, size_t numEntries, MODES mode,
                 map<u32, u32> &litToOffsetVal) {
     const u32 nbits = lg2(numEntries);
     map<u32, deque<pair<u32, u32> > > bucketToLitOffPairs;
     map<u32, u64a> bucketToBitfield;
 
     for (const auto &lit : long_lits) {
-        if ((m == CASELESS) != lit.nocase) {
+        if ((mode == CASELESS) != lit.nocase) {
             continue;
         }
         for (u32 j = 1; j < lit.s.size() - max_len + 1; j++) {
-            u32 h = hashLit(lit, j, max_len, m);
+            u32 h = hashLit(lit, j, max_len, mode);
             u32 h_ent = h & ((1U << nbits) - 1);
             u32 h_low = (h >> nbits) & 63;
             bucketToLitOffPairs[h_ent].emplace_back(lit.id, j);
index 729c9c1f3e7008e86c2d80ea28822e618b30f965..15b9665bb82c8e2146e2d6b0794d1c6d095a7e81 100644 (file)
@@ -266,9 +266,9 @@ bool TeddyCompiler::pack(map<BucketIndex,
 
     u32 bucket_id = 0;
     for (const TeddySet &ts : sts) {
-        const auto &lits = ts.getLits();
+        const auto &ts_lits = ts.getLits();
         auto &bucket_lits = bucketToLits[bucket_id];
-        bucket_lits.insert(end(bucket_lits), begin(lits), end(lits));
+        bucket_lits.insert(end(bucket_lits), begin(ts_lits), end(ts_lits));
         bucket_id++;
     }
     return true;
index 647dc496e6cec62fb7e78d60b5aa01171c14c2cf..314b6fd0255959ed62c00cb012a6797a894ebada 100644 (file)
@@ -79,9 +79,9 @@ namespace {
 class gough_build_strat : public mcclellan_build_strat {
 public:
     gough_build_strat(
-        raw_som_dfa &r, const GoughGraph &g, const ReportManager &rm,
+        raw_som_dfa &r, const GoughGraph &g, const ReportManager &rm_in,
         const map<dstate_id_t, gough_accel_state_info> &accel_info)
-        : mcclellan_build_strat(r, rm), rdfa(r), gg(g),
+        : mcclellan_build_strat(r, rm_in), rdfa(r), gg(g),
           accel_gough_info(accel_info) {}
     unique_ptr<raw_report_info> gatherReports(vector<u32> &reports /* out */,
                             vector<u32> &reports_eod /* out */,
index f1cf2a4c1a109666d0550d1eb8d130af4e826bec..4c1f81018be1432d648a27a355de41a2454c86f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -347,9 +347,9 @@ void match(accel_data &d, const CharReach &ref_cr, const CharReach &cur_cr) {
     }
 }
 
-MultiaccelCompileHelper::MultiaccelCompileHelper(const CharReach &ref_cr, u32 off,
-                                                 unsigned max_len) :
-        cr(ref_cr), offset(off), max_len(max_len) {
+MultiaccelCompileHelper::MultiaccelCompileHelper(const CharReach &ref_cr,
+                                                 u32 off, unsigned max_length)
+    : cr(ref_cr), offset(off), max_len(max_length) {
     int accel_num = (int) MultibyteAccelInfo::MAT_MAX;
     accels.resize(accel_num);
 
index 27f58d0a8166f23b50671edf881382d915bdcf6e..e806d5c7c9e4102e94a392f5c1bc01c0ee294ae7 100644 (file)
@@ -1880,15 +1880,15 @@ bool improvePrefix(NGHolder &h, RoseInGraph &vg, const vector<RoseInEdge> &ee,
         trimmed.clear();
         for (auto &elem : trimmed_vec) {
             shared_ptr<NGHolder> &hp = elem.first;
-            NGHolder &h = *hp;
+            NGHolder &eh = *hp;
 
             vector<NFAVertex> base_states;
             insert(&base_states, base_states.end(),
-                   inv_adjacent_vertices(h.accept, h));
-            clear_in_edges(h.accept, h);
+                   inv_adjacent_vertices(eh.accept, eh));
+            clear_in_edges(eh.accept, eh);
 
             for (auto v : base_states) {
-                h[v].reports.clear(); /* clear report from old accepts */
+                eh[v].reports.clear(); /* clear report from old accepts */
             }
 
             for (const auto &edge_delay : elem.second) {
index 65cd7c1a3392898e80529b8150e781a3658381a5..9bd4d96d5ce20f5dfe35691b716e9dedc37fbd03 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -1447,12 +1447,12 @@ unichar readUtf8CodePoint4c(const u8 *ts) {
                       // Otherwise, we interpret the first three digits as an
                       // octal escape, and the remaining characters stand for
                       // themselves as literals.
-                      const u8 *p = ts;
+                      const u8 *s = ts;
                       unsigned int accum = 0;
                       unsigned int oct_digits = 0;
-                      assert(*p == '\\'); // token starts at backslash
-                      for (++p; p < te && oct_digits < 3; ++oct_digits, ++p) {
-                          u8 digit = *p - '0';
+                      assert(*s == '\\'); // token starts at backslash
+                      for (++s; s < te && oct_digits < 3; ++oct_digits, ++s) {
+                          u8 digit = *s - '0';
                           if (digit < 8) {
                               accum = digit + accum * 8;
                           } else {
@@ -1465,8 +1465,8 @@ unichar readUtf8CodePoint4c(const u8 *ts) {
                       }
 
                       // And then the rest of the digits, if any, are literal.
-                      for (; p < te; ++p) {
-                          addLiteral(currentSeq, *p, mode);
+                      for (; s < te; ++s) {
+                          addLiteral(currentSeq, *s, mode);
                       }
                   }
               };
index 18968e10d39b00a73546b624839a442b4108d6dc..0f0e8d18ba550b4c75e97d04ee860e85c7f87265 100644 (file)
@@ -709,7 +709,6 @@ void makeEodEventLeftfix(RoseBuildImpl &build, RoseVertex u,
         g[v].literals.insert(eod_event);
         build.literal_info[eod_event].vertices.insert(v);
 
-        map<u32, set<ReportID> > report_remap;
         g[v].left.graph = eod_leftfix;
         g[v].left.leftfix_report = report_mapping.second;
         g[v].left.lag = 0;
index 6eb42d4cfd26da06b59796af733ef8e5e3436670..085aca79cbc0804134e75aeb85fdffe0e4bd27b8 100644 (file)
@@ -4906,11 +4906,11 @@ void addEodAnchorProgram(RoseBuildImpl &build, build_context &bc,
             assert(contains(bc.roleStateIndices, u));
             u32 predStateIdx = bc.roleStateIndices.at(u);
 
-            auto program = makeEodAnchorProgram(build, bc, e, multiple_preds);
-            if (program.empty()) {
+            auto prog = makeEodAnchorProgram(build, bc, e, multiple_preds);
+            if (prog.empty()) {
                 continue;
             }
-            predProgramLists[predStateIdx].push_back(program);
+            predProgramLists[predStateIdx].push_back(prog);
         }
     }
 
index d327193f8e5d3cac9d7a577fe0054e2ede152de1..8545ca7038238077e3343489060bfa96abe9e1c5 100644 (file)
@@ -511,8 +511,8 @@ bool RoseBuildImpl::isDirectReport(u32 id) const {
         }
 
         // Use the program to handle cases that aren't external reports.
-        for (const ReportID &id : g[v].reports) {
-            if (!isExternalReport(rm.getReport(id))) {
+        for (const ReportID &rid : g[v].reports) {
+            if (!isExternalReport(rm.getReport(rid))) {
                 return false;
             }
         }
index 7b20bd1cf62872393b4970ff6471ef989040d6d6..2eb70f60e7cd73fcf9057c21973c4b5f8dc153fa 100644 (file)
@@ -416,8 +416,8 @@ bool isDirectHighlander(const RoseBuildImpl &build, const u32 id,
         return false;
     }
 
-    auto is_simple_exhaustible = [&build](ReportID id) {
-        const Report &report = build.rm.getReport(id);
+    auto is_simple_exhaustible = [&build](ReportID rid) {
+        const Report &report = build.rm.getReport(rid);
         return isSimpleExhaustible(report);
     };
 
index b8d77d374f9c513c9ded409d4e3c9893d35596f2..81495a9cd368362588d1bee93d4ed4840828d9c4 100644 (file)
@@ -283,9 +283,9 @@ TEST(DoubleShufti, BuildMask1) {
 
     lits.insert(make_pair('a', 'B'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
                                      &lo2m, &hi2m);
-    ASSERT_TRUE(rv);
+    ASSERT_TRUE(ret);
 
     u8 *lo1 = (u8 *)&lo1m;
     u8 *lo2 = (u8 *)&lo2m;
@@ -326,9 +326,9 @@ TEST(DoubleShufti, BuildMask2) {
     lits.insert(make_pair('a','z'));
     lits.insert(make_pair('B','z'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
                                      &lo2m, &hi2m);
-    ASSERT_TRUE(rv);
+    ASSERT_TRUE(ret);
 
     u8 *lo1 = (u8 *)&lo1m;
     u8 *lo2 = (u8 *)&lo2m;
@@ -354,9 +354,9 @@ TEST(DoubleShufti, BuildMask4) {
     lits.insert(make_pair('A','z'));
     lits.insert(make_pair('b','z'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
                                      &lo2m, &hi2m);
-    ASSERT_TRUE(rv);
+    ASSERT_TRUE(ret);
 
     u8 *lo1 = (u8 *)&lo1m;
     u8 *lo2 = (u8 *)&lo2m;
@@ -383,9 +383,9 @@ TEST(DoubleShufti, BuildMask5) {
     CharReach bytes;
     bytes.set('X');
 
-    bool rv = shuftiBuildDoubleMasks(bytes, lits, &lo1m, &hi1m,
+    bool ret = shuftiBuildDoubleMasks(bytes, lits, &lo1m, &hi1m,
                                      &lo2m, &hi2m);
-    ASSERT_TRUE(rv);
+    ASSERT_TRUE(ret);
 
     u8 *lo1 = (u8 *)&lo1m;
     u8 *lo2 = (u8 *)&lo2m;
@@ -421,9 +421,9 @@ TEST(DoubleShufti, BuildMask6) {
     lits.insert(make_pair('A','x'));
     lits.insert(make_pair('b','x'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1m, &hi1m,
                                      &lo2m, &hi2m);
-    ASSERT_TRUE(rv);
+    ASSERT_TRUE(ret);
 
     u8 *lo1 = (u8 *)&lo1m;
     u8 *lo2 = (u8 *)&lo2m;
@@ -485,9 +485,9 @@ TEST(DoubleShufti, ExecNoMatch1) {
 
     lits.insert(make_pair('a','b'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1,
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1,
                                      &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
 
@@ -506,8 +506,8 @@ TEST(DoubleShufti, ExecNoMatch1b) {
 
     lits.insert(make_pair('b','a'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
 
@@ -527,8 +527,8 @@ TEST(DoubleShufti, ExecNoMatch2) {
     lits.insert(make_pair('a','b'));
     lits.insert(make_pair('B','b'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
 
@@ -548,8 +548,8 @@ TEST(DoubleShufti, ExecNoMatch2b) {
     lits.insert(make_pair('b','a'));
     lits.insert(make_pair('b','B'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
 
@@ -568,8 +568,8 @@ TEST(DoubleShufti, ExecNoMatch3) {
 
     lits.insert(make_pair('V','e'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
 
@@ -588,8 +588,8 @@ TEST(DoubleShufti, ExecNoMatch3b) {
 
     lits.insert(make_pair('e','V'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
 
@@ -608,8 +608,8 @@ TEST(DoubleShufti, ExecMatch1) {
 
     lits.insert(make_pair('a','b'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     /*          0123456789012345678901234567890 */
     char t1[] = "bbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbb";
@@ -629,8 +629,8 @@ TEST(DoubleShufti, ExecMatch2) {
 
     lits.insert(make_pair('a','a'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     /*          0123456789012345678901234567890 */
     char t1[] = "bbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
@@ -651,8 +651,8 @@ TEST(DoubleShufti, ExecMatch3) {
     lits.insert(make_pair('B','a'));
     lits.insert(make_pair('a','a'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     /*          0123456789012345678901234567890 */
     char t1[] = "bbbbbbbbbbbbbbbbbBaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
@@ -675,8 +675,8 @@ TEST(DoubleShufti, ExecMatch4) {
     lits.insert(make_pair('C','a'));
     lits.insert(make_pair('c','a'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     /*          0123456789012345678901234567890 */
     char t1[] = "bbbbbbbbbbbbbbbbbAaaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
@@ -717,8 +717,8 @@ TEST(DoubleShufti, ExecMatch4b) {
     lits.insert(make_pair('a','C'));
     lits.insert(make_pair('a','c'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     /*          0123456789012345678901234567890 */
     char t1[] = "bbbbbbbbbbbbbbbbbaAaaaaaaaaaaaaaabbbbbbbbbbbbbbbabbbbbbbbbbbb";
@@ -756,8 +756,8 @@ TEST(DoubleShufti, ExecMatch5) {
 
     lits.insert(make_pair('a','A'));
 
-    bool rv = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(CharReach(), lits, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
 
@@ -780,8 +780,8 @@ TEST(DoubleShufti, ExecMatchMixed1) {
     // just one one-byte literal
     onebyte.set('a');
 
-    bool rv = shuftiBuildDoubleMasks(onebyte, twobyte, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
 
@@ -804,8 +804,8 @@ TEST(DoubleShufti, ExecMatchMixed2) {
     onebyte.set('a');
     twobyte.insert(make_pair('x', 'y'));
 
-    bool rv = shuftiBuildDoubleMasks(onebyte, twobyte, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     char t1[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
     char t2[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
@@ -838,8 +838,8 @@ TEST(DoubleShufti, ExecMatchMixed3) {
     onebyte.set('a');
     twobyte.insert(make_pair('x', 'y'));
 
-    bool rv = shuftiBuildDoubleMasks(onebyte, twobyte, &lo1, &hi1, &lo2, &hi2);
-    ASSERT_TRUE(rv);
+    bool ret = shuftiBuildDoubleMasks(onebyte, twobyte, &lo1, &hi1, &lo2, &hi2);
+    ASSERT_TRUE(ret);
 
     const int len = 420;
     char t1[len + 1];