]> git.saurik.com Git - bison.git/blobdiff - src/reduce.c
(AUTOMAKE_OPTIONS): 1.6.
[bison.git] / src / reduce.c
index 973e5edea4ebe25c8a4159ff4bf2366fb81e5196..bef2ae90307d279f78161917446f4ebca66482b6 100644 (file)
@@ -57,15 +57,6 @@ static int nuseless_productions;
 static int nuseful_nonterminals;
 int nuseless_nonterminals;
 \f
-static int
-bits_size (bitset S)
-{
-  int i, count = 0;
-
-  BITSET_EXECUTE (S, 0, i, { ++count; });
-  return count;
-}
-\f
 /*-------------------------------------------------------------------.
 | Another way to do this would be with a set for each production and |
 | then do subset tests against N0, but even for the C grammar the    |
@@ -82,9 +73,8 @@ useful_production (int i, bitset N0)
      in the set of useful nonterminals.  */
 
   for (r = &ritem[rules[i].rhs]; *r >= 0; r++)
-    if (ISVAR (n = *r))
-      if (!bitset_test (N0, n - ntokens))
-       return FALSE;
+    if (ISVAR (n = *r) && !bitset_test (N0, n - ntokens))
+      return FALSE;
   return TRUE;
 }
 
@@ -103,7 +93,6 @@ useless_nonterminals (void)
      set of all productions which have a RHS all in N.  */
 
   Np = bitset_create (nvars, BITSET_FIXED);
-  bitset_zero (Np);
 
 
   /* The set being computed is a set of nonterminals which can derive
@@ -175,9 +164,7 @@ inaccessable_symbols (void)
      user can know.  */
 
   Vp = bitset_create (nsyms, BITSET_FIXED);
-  bitset_zero (Vp);
   Pp = bitset_create (nrules + 1, BITSET_FIXED);
-  bitset_zero (Pp);
 
   /* If the start symbol isn't useful, then nothing will be useful. */
   if (bitset_test (N, start_symbol - ntokens))
@@ -218,7 +205,7 @@ inaccessable_symbols (void)
   bitset_free (P);
   P = Pp;
 
-  nuseful_productions = bits_size (P);
+  nuseful_productions = bitset_count (P);
   nuseless_productions = nrules - nuseful_productions;
 
   nuseful_nonterminals = 0;
@@ -495,13 +482,9 @@ reduce_grammar (void)
   /* Allocate the global sets used to compute the reduced grammar */
 
   N = bitset_create (nvars, BITSET_FIXED);
-  bitset_zero (N);
   P =  bitset_create (nrules + 1, BITSET_FIXED);
-  bitset_zero (P);
   V = bitset_create (nsyms, BITSET_FIXED);
-  bitset_zero (V);
   V1 = bitset_create (nsyms, BITSET_FIXED);
-  bitset_zero (V1);
 
   useless_nonterminals ();
   inaccessable_symbols ();