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'.
This commit is contained in:
Akim Demaille
2002-05-07 08:07:32 +00:00
parent e41fdc9310
commit 0c2d3f4cba
8 changed files with 35 additions and 15 deletions

View File

@@ -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.

View File

@@ -231,7 +231,7 @@ static int
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)

View File

@@ -29,7 +29,7 @@
/* 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;
@@ -70,7 +70,7 @@ rule_rhs_length (rule_t *rule)
void
ritem_print (FILE *out)
{
int i;
unsigned int i;
fputs ("RITEM\n", out);
for (i = 0; i < nritems; ++i)
if (ritem[i] >= 0)

View File

@@ -110,7 +110,7 @@ extern int nvars;
#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

View File

@@ -184,7 +184,7 @@ Name (const char *name, \
int begin, \
int end) \
{ \
long int max = first; \
Type max = first; \
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); \
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)
@@ -285,7 +285,6 @@ prepare_tokens (void)
static void
prepare_rules (void)
{
long int max;
int r;
unsigned int i = 0;
item_number_t *rhs = XMALLOC (item_number_t, nritems);

View File

@@ -1736,7 +1736,7 @@ packsymbols (void)
static void
packgram (void)
{
int itemno;
unsigned int itemno;
int ruleno;
symbol_list *p;

View File

@@ -306,11 +306,17 @@ nonterminals_reduce (void)
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;

View File

@@ -185,7 +185,7 @@ typedef struct state_s
int nlookaheads;
/* Its items. */
short nitems;
unsigned short nitems;
item_number_t items[1];
} state_t;