bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dfa: avoid new warnings from gcc


From: Jim Meyering
Subject: [PATCH] dfa: avoid new warnings from gcc
Date: Sat, 15 Dec 2018 10:12:51 -0800

FYI: I've just pushed this:

>From 95cd86dd7aa4425037b9c710f88fd59e38601ff1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 15 Dec 2018 10:09:35 -0800
Subject: [PATCH] dfa: avoid new warnings from gcc

These would prevent building with -Werror and a Dec snapshot of gcc.
* lib/dfa.c (dfaanalyze): Avoid shadowing warnings for "pos".
Rename each inner instance to "p".
(charclass_context): Remove unused static function.
---
 ChangeLog |  8 ++++++++
 lib/dfa.c | 37 ++++++++-----------------------------
 2 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 74688d479..5173ac51b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-12-15  Jim Meyering  <address@hidden>
+
+       dfa: avoid new warnings from gcc
+       These would prevent building with -Werror and a Dec snapshot of gcc.
+       * lib/dfa.c (dfaanalyze): Avoid shadowing warnings for "pos".
+       Rename each inner instance to "p".
+       (charclass_context): Remove unused static function.
+
 2018-12-14  Paul Eggert  <address@hidden>

        mkdir-p: improve diagnostic for FUSE mounts
diff --git a/lib/dfa.c b/lib/dfa.c
index ad2716bc7..fe128cb4e 100644
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -2300,27 +2300,6 @@ epsclosure (struct dfa const *d)
   free (tmp.elems);
 }

-/* Returns the set of contexts for which there is at least one
-   character included in C.  */
-
-static int
-charclass_context (struct dfa const *dfa, charclass const *c)
-{
-  int context = 0;
-
-  for (unsigned int j = 0; j < CHARCLASS_WORDS; ++j)
-    {
-      if (c->w[j] & dfa->syntax.newline.w[j])
-        context |= CTX_NEWLINE;
-      if (c->w[j] & dfa->syntax.letters.w[j])
-        context |= CTX_LETTER;
-      if (c->w[j] & ~(dfa->syntax.letters.w[j] | dfa->syntax.newline.w[j]))
-        context |= CTX_NONE;
-    }
-
-  return context;
-}
-
 /* Returns the contexts on which the position set S depends.  Each context
    in the set of returned contexts (let's call it SC) may have a different
    follow set than other contexts in SC, and also different from the
@@ -2663,11 +2642,11 @@ dfaanalyze (struct dfa *d, bool searchflag)
           {
             tmp.elems = firstpos - stk[-1].nfirstpos;
             tmp.nelem = stk[-1].nfirstpos;
-            position *pos = lastpos - stk[-1].nlastpos;
+            position *p = lastpos - stk[-1].nlastpos;
             for (size_t j = 0; j < stk[-1].nlastpos; j++)
               {
-                merge (&tmp, &d->follows[pos[j].index], &merged);
-                copy (&merged, &d->follows[pos[j].index]);
+                merge (&tmp, &d->follows[p[j].index], &merged);
+                copy (&merged, &d->follows[p[j].index]);
               }
           }
           FALLTHROUGH;
@@ -2683,11 +2662,11 @@ dfaanalyze (struct dfa *d, bool searchflag)
           {
             tmp.nelem = stk[-1].nfirstpos;
             tmp.elems = firstpos - stk[-1].nfirstpos;
-            position *pos = lastpos - stk[-1].nlastpos - stk[-2].nlastpos;
+            position *p = lastpos - stk[-1].nlastpos - stk[-2].nlastpos;
             for (size_t j = 0; j < stk[-2].nlastpos; j++)
               {
-                merge (&tmp, &d->follows[pos[j].index], &merged);
-                copy (&merged, &d->follows[pos[j].index]);
+                merge (&tmp, &d->follows[p[j].index], &merged);
+                copy (&merged, &d->follows[p[j].index]);
               }
           }

@@ -2704,9 +2683,9 @@ dfaanalyze (struct dfa *d, bool searchflag)
             stk[-2].nlastpos += stk[-1].nlastpos;
           else
             {
-              position *pos = lastpos - stk[-1].nlastpos - stk[-2].nlastpos;
+              position *p = lastpos - stk[-1].nlastpos - stk[-2].nlastpos;
               for (size_t j = 0; j < stk[-1].nlastpos; j++)
-                pos[j] = pos[j + stk[-2].nlastpos];
+                p[j] = p[j + stk[-2].nlastpos];
               lastpos -= stk[-2].nlastpos;
               stk[-2].nlastpos = stk[-1].nlastpos;
             }
--
2.20.1.2.gb21ebb671b



reply via email to

[Prev in Thread] Current Thread [Next in Thread]