mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 08:13:02 +00:00
* src/tables.c (tables_generate): Use free for pointers that
cannot be NULL, not XFREE. (pack_vector): Use assert, not fatal, for bound violations. * src/state.c (state_new): Likewise. * src/reader.c (reader): Likewise. * src/lalr.c (set_goto_map): Likewise. * src/location.h (LOCATION_PRINT): If first_line is 0, just issue the file name.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2002-11-12 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/tables.c (tables_generate): Use free for pointers that
|
||||||
|
cannot be NULL, not XFREE.
|
||||||
|
(pack_vector): Use assert, not fatal, for bound violations.
|
||||||
|
* src/state.c (state_new): Likewise.
|
||||||
|
* src/reader.c (reader): Likewise.
|
||||||
|
* src/lalr.c (set_goto_map): Likewise.
|
||||||
|
* src/location.h (LOCATION_PRINT): If first_line is 0, just issue
|
||||||
|
the file name.
|
||||||
|
|
||||||
2002-11-12 Akim Demaille <akim@epita.fr>
|
2002-11-12 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/scan-gram.l, src/reader.h (scanner_last_string_free):
|
* src/scan-gram.l, src/reader.h (scanner_last_string_free):
|
||||||
|
|||||||
@@ -87,9 +87,7 @@ set_goto_map (void)
|
|||||||
int i;
|
int i;
|
||||||
for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
|
for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
|
||||||
{
|
{
|
||||||
if (ngotos == GOTO_NUMBER_MAX)
|
assert (ngotos < GOTO_NUMBER_MAX);
|
||||||
fatal (_("too many gotos (max %d)"), GOTO_NUMBER_MAX);
|
|
||||||
|
|
||||||
ngotos++;
|
ngotos++;
|
||||||
goto_map[TRANSITION_SYMBOL (sp, i)]++;
|
goto_map[TRANSITION_SYMBOL (sp, i)]++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,20 +53,23 @@ do { \
|
|||||||
Warning: it uses quotearg's slot 3. */
|
Warning: it uses quotearg's slot 3. */
|
||||||
# define LOCATION_PRINT(Out, Loc) \
|
# define LOCATION_PRINT(Out, Loc) \
|
||||||
do { \
|
do { \
|
||||||
fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \
|
fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \
|
||||||
(Loc).file)); \
|
(Loc).file)); \
|
||||||
if ((Loc).first_line != (Loc).last_line) \
|
if ((Loc).first_line) \
|
||||||
fprintf (Out, "%d.%d-%d.%d", \
|
{ \
|
||||||
(Loc).first_line, (Loc).first_column, \
|
if ((Loc).first_line != (Loc).last_line) \
|
||||||
(Loc).last_line, (Loc).last_column - 1); \
|
fprintf (Out, "%d.%d-%d.%d", \
|
||||||
else if ((Loc).first_column < (Loc).last_column - 1) \
|
(Loc).first_line, (Loc).first_column, \
|
||||||
fprintf (Out, "%d.%d-%d", (Loc).first_line, \
|
(Loc).last_line, (Loc).last_column - 1); \
|
||||||
(Loc).first_column, (Loc).last_column - 1); \
|
else if ((Loc).first_column < (Loc).last_column - 1) \
|
||||||
else \
|
fprintf (Out, "%d.%d-%d", (Loc).first_line, \
|
||||||
fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \
|
(Loc).first_column, (Loc).last_column - 1); \
|
||||||
|
else \
|
||||||
|
fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern location_t empty_location;
|
extern location_t empty_location;
|
||||||
|
|
||||||
#endif /* !LOCATION_H_ */
|
#endif /* !LOCATION_H_ */
|
||||||
|
|||||||
@@ -539,10 +539,7 @@ reader (void)
|
|||||||
grammar = p;
|
grammar = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SYMBOL_NUMBER_MAX < nsyms)
|
assert (nsyms <= SYMBOL_NUMBER_MAX);
|
||||||
fatal (_("too many symbols (tokens plus nonterminals); maximum %d"),
|
|
||||||
SYMBOL_NUMBER_MAX);
|
|
||||||
|
|
||||||
assert (nsyms == ntokens + nvars);
|
assert (nsyms == ntokens + nvars);
|
||||||
|
|
||||||
xfclose (finput);
|
xfclose (finput);
|
||||||
|
|||||||
@@ -141,8 +141,7 @@ state_new (symbol_number_t accessing_symbol,
|
|||||||
{
|
{
|
||||||
state_t *res;
|
state_t *res;
|
||||||
|
|
||||||
if (nstates >= STATE_NUMBER_MAX)
|
assert (nstates < STATE_NUMBER_MAX);
|
||||||
fatal (_("too many states (max %d)"), STATE_NUMBER_MAX);
|
|
||||||
|
|
||||||
res = STATE_ALLOC (core_size);
|
res = STATE_ALLOC (core_size);
|
||||||
res->accessing_symbol = accessing_symbol;
|
res->accessing_symbol = accessing_symbol;
|
||||||
|
|||||||
13
src/tables.c
13
src/tables.c
@@ -692,8 +692,7 @@ pack_vector (vector_number_t vector)
|
|||||||
if (loc > high)
|
if (loc > high)
|
||||||
high = loc;
|
high = loc;
|
||||||
|
|
||||||
if (j < BASE_MIN || BASE_MAX < j)
|
assert (BASE_MIN <= j && j <= BASE_MAX);
|
||||||
fatal ("base_t too small to hold %d\n", j);
|
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -802,9 +801,9 @@ tables_generate (void)
|
|||||||
token_actions ();
|
token_actions ();
|
||||||
|
|
||||||
goto_actions ();
|
goto_actions ();
|
||||||
XFREE (goto_map + ntokens);
|
free (goto_map + ntokens);
|
||||||
XFREE (from_state);
|
free (from_state);
|
||||||
XFREE (to_state);
|
free (to_state);
|
||||||
|
|
||||||
order = XCALLOC (vector_number_t, nvectors);
|
order = XCALLOC (vector_number_t, nvectors);
|
||||||
sort_actions ();
|
sort_actions ();
|
||||||
@@ -816,8 +815,8 @@ tables_generate (void)
|
|||||||
|
|
||||||
for (i = 0; i < nvectors; i++)
|
for (i = 0; i < nvectors; i++)
|
||||||
{
|
{
|
||||||
XFREE (froms[i]);
|
free (froms[i]);
|
||||||
XFREE (tos[i]);
|
free (tos[i]);
|
||||||
XFREE (conflict_tos[i]);
|
XFREE (conflict_tos[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user