+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.
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)
/* 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;
void
ritem_print (FILE *out)
{
- int i;
+ unsigned int i;
fputs ("RITEM\n", out);
for (i = 0; i < nritems; ++i)
if (ritem[i] >= 0)
#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
int begin, \
int end) \
{ \
- long int max = first; \
+ Type max = first; \
int i; \
int j = 1; \
\
/* 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)
static void
prepare_rules (void)
{
- long int max;
int r;
unsigned int i = 0;
item_number_t *rhs = XMALLOC (item_number_t, nritems);
static void
packgram (void)
{
- int itemno;
+ unsigned int itemno;
int ruleno;
symbol_list *p;
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;
int nlookaheads;
/* Its items. */
- short nitems;
+ unsigned short nitems;
item_number_t items[1];
} state_t;