]> git.saurik.com Git - bison.git/commitdiff
Kill GCC warnings.
authorAkim Demaille <akim@epita.fr>
Tue, 7 May 2002 08:07:32 +0000 (08:07 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 7 May 2002 08:07:32 +0000 (08:07 +0000)
* src/reduce.c (nonterminals_reduce): Don't loop over RITEM: loop
over the RHS of each rule.
* src/gram.h, src/gram.c (nritems): Is `unsigned int', not int.
* src/state.h (state_t): Member `nitems' is unsigned short.
* src/LR0.c (get_state): Adjust.
* src/reader.c (packgram): Likewise.
* src/output.c (GENERATE_MUSCLE_INSERT_TABLE): `max' is of type
`Type'.
(muscle_insert_int_table): Remove, unused.
(prepare_rules): Remove `max'.

ChangeLog
src/LR0.c
src/gram.c
src/gram.h
src/output.c
src/reader.c
src/reduce.c
src/state.h

index 8e8530c85fa4004fa27f4a2ac4172216388b99c7..8115de8ba9b4313e457abe3fa6fe450c8a6d5825 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2002-05-07  Akim Demaille  <akim@epita.fr>
+
+       Kill GCC warnings.
+
+       * src/reduce.c (nonterminals_reduce): Don't loop over RITEM: loop
+       over the RHS of each rule.
+       * src/gram.h, src/gram.c (nritems): Is `unsigned int', not int.
+       * src/state.h (state_t): Member `nitems' is unsigned short.
+       * src/LR0.c (get_state): Adjust.
+       * src/reader.c (packgram): Likewise.
+       * src/output.c (GENERATE_MUSCLE_INSERT_TABLE): `max' is of type
+       `Type'.
+       (muscle_insert_int_table): Remove, unused.
+       (prepare_rules): Remove `max'.
+
 2002-05-06  Akim Demaille  <akim@epita.fr>
 
        * src/closure.c (print_firsts): Display of the symbol tags.
 2002-05-06  Akim Demaille  <akim@epita.fr>
 
        * src/closure.c (print_firsts): Display of the symbol tags.
index 72448d735de8915721a9e1241fc992d6af878f3c..fce8b3dbca7cb400f069f335420c8ef52ee8cd91 100644 (file)
--- a/src/LR0.c
+++ b/src/LR0.c
@@ -231,7 +231,7 @@ static int
 get_state (token_number_t symbol, size_t core_size, item_number_t *core)
 {
   int key;
 get_state (token_number_t symbol, size_t core_size, item_number_t *core)
 {
   int key;
-  int i;
+  size_t i;
   state_t *sp;
 
   if (trace_flag)
   state_t *sp;
 
   if (trace_flag)
index 3fc03d0e09600cd9f24a367a2c3fdea24c79e5b5..de5a217c7ebd5aa86fa64607a5258b9270f94b1d 100644 (file)
@@ -29,7 +29,7 @@
 /* comments for these variables are in gram.h  */
 
 item_number_t *ritem = NULL;
 /* comments for these variables are in gram.h  */
 
 item_number_t *ritem = NULL;
-int nritems = 0;
+unsigned int nritems = 0;
 
 rule_t *rules = NULL;
 int nrules = 0;
 
 rule_t *rules = NULL;
 int nrules = 0;
@@ -70,7 +70,7 @@ rule_rhs_length (rule_t *rule)
 void
 ritem_print (FILE *out)
 {
 void
 ritem_print (FILE *out)
 {
-  int i;
+  unsigned int i;
   fputs ("RITEM\n", out);
   for (i = 0; i < nritems; ++i)
     if (ritem[i] >= 0)
   fputs ("RITEM\n", out);
   for (i = 0; i < nritems; ++i)
     if (ritem[i] >= 0)
index 88946cffbed60774f3eeda3cfc354dee6c4e5084..0a92993c265a3cdc3c4a1cb9b7093ceda1b2af07 100644 (file)
@@ -110,7 +110,7 @@ extern int nvars;
 #define ITEM_NUMBER_MAX INT_MAX
 typedef int item_number_t;
 extern item_number_t *ritem;
 #define ITEM_NUMBER_MAX INT_MAX
 typedef int item_number_t;
 extern item_number_t *ritem;
-extern int nritems;
+extern unsigned int nritems;
 
 /* There is weird relationship between item_number_t and
    token_number_t: we store token_number_t in item_number_t, but in
 
 /* There is weird relationship between item_number_t and
    token_number_t: we store token_number_t in item_number_t, but in
index e424143d3103c22a44e29caa8d1798cad57bdb4c..cff89a7864f0216190060499c860d1c0d79390bf 100644 (file)
@@ -184,7 +184,7 @@ Name (const char *name,                                                     \
       int begin,                                                       \
       int end)                                                         \
 {                                                                      \
       int begin,                                                       \
       int end)                                                         \
 {                                                                      \
-  long int max = first;                                                        \
+  Type max = first;                                                    \
   int i;                                                               \
   int j = 1;                                                           \
                                                                        \
   int i;                                                               \
   int j = 1;                                                           \
                                                                        \
@@ -209,10 +209,10 @@ Name (const char *name,                                                   \
   /* Build `NAME_max' in the obstack. */                               \
   obstack_fgrow1 (&format_obstack, "%s_max", name);                    \
   obstack_1grow (&format_obstack, 0);                                  \
   /* Build `NAME_max' in the obstack. */                               \
   obstack_fgrow1 (&format_obstack, "%s_max", name);                    \
   obstack_1grow (&format_obstack, 0);                                  \
-  MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), max);      \
+  MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack),            \
+                         (long int) max);                              \
 }
 
 }
 
-GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_int_table, int)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_short_table, short)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_token_number_table, token_number_t)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_unsigned_int_table, unsigned int)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_short_table, short)
 GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_token_number_table, token_number_t)
@@ -285,7 +285,6 @@ prepare_tokens (void)
 static void
 prepare_rules (void)
 {
 static void
 prepare_rules (void)
 {
-  long int max;
   int r;
   unsigned int i = 0;
   item_number_t *rhs = XMALLOC (item_number_t, nritems);
   int r;
   unsigned int i = 0;
   item_number_t *rhs = XMALLOC (item_number_t, nritems);
index f075346012197a711ae9ff244e294de55c48a9a1..1aa767fa022414a099b4cd50f2994e051e76d208 100644 (file)
@@ -1736,7 +1736,7 @@ packsymbols (void)
 static void
 packgram (void)
 {
 static void
 packgram (void)
 {
-  int itemno;
+  unsigned int itemno;
   int ruleno;
   symbol_list *p;
 
   int ruleno;
   symbol_list *p;
 
index 2d51a24c9f55742c4578eea4169c1df7dfc6e9a6..fd6f9e15c1921b6fa2ffabf6da7d1f9bdbafbbf0 100644 (file)
@@ -306,11 +306,17 @@ nonterminals_reduce (void)
     free (symbols_sorted + ntokens);
   }
 
     free (symbols_sorted + ntokens);
   }
 
-  for (i = 0; i < nritems; ++i)
-    if (ISVAR (ritem[i]))
-      ritem[i] = token_number_as_item_number (nontermmap[ritem[i]]);
-
-  start_symbol = nontermmap[start_symbol];
+  {
+    int r;
+    for (r = 1; r < nrules + 1; ++r)
+      {
+       item_number_t *rhsp;
+       for (rhsp = rules[r].rhs; *rhsp >= 0; ++rhsp)
+         if (ISVAR (*rhsp))
+           *rhsp =  token_number_as_item_number (nontermmap[*rhsp]);
+      }
+    start_symbol = nontermmap[start_symbol];
+  }
 
   nsyms -= nuseless_nonterminals;
   nvars -= nuseless_nonterminals;
 
   nsyms -= nuseless_nonterminals;
   nvars -= nuseless_nonterminals;
index dc093fea1a760f9543490d24abbea7dd7c5c2bbb..92378c701a6dad66237df6dd10b7bd386df4002b 100644 (file)
@@ -185,7 +185,7 @@ typedef struct state_s
   int nlookaheads;
 
   /* Its items. */
   int nlookaheads;
 
   /* Its items. */
-  short nitems;
+  unsigned short nitems;
   item_number_t items[1];
 } state_t;
 
   item_number_t items[1];
 } state_t;