[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05-assert.patch
From: |
Akim Demaille |
Subject: |
05-assert.patch |
Date: |
Tue, 12 Nov 2002 08:44:24 +0100 |
Index: 0.8/ChangeLog
--- 0.8/ChangeLog Sat, 09 Nov 2002 16:50:44 +0100 akim (bison/d/40_ChangeLog
1.6 644)
+++ 0.8(w)/ChangeLog Sun, 10 Nov 2002 11:06:15 +0100 akim (bison/d/40_ChangeLog
1.6 644)
@@ -1,3 +1,14 @@
+2002-11-10 Akim Demaille <address@hidden>
+
+ * 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-09 Akim Demaille <address@hidden>
* doc/bison.rnh: Remove.
Index: 0.8/src/tables.c
--- 0.8/src/tables.c Fri, 08 Nov 2002 16:19:16 +0100 akim (bison/36_tables.c
1.1 644)
+++ 0.8(w)/src/tables.c Sun, 10 Nov 2002 11:02:25 +0100 akim (bison/36_tables.c
1.1 644)
@@ -692,8 +692,7 @@
if (loc > high)
high = loc;
- if (j < BASE_MIN || BASE_MAX < j)
- fatal ("base_t too small to hold %d\n", j);
+ assert (BASE_MIN <= j && j <= BASE_MAX);
return j;
}
}
@@ -802,9 +801,9 @@
token_actions ();
goto_actions ();
- XFREE (goto_map + ntokens);
- XFREE (from_state);
- XFREE (to_state);
+ free (goto_map + ntokens);
+ free (from_state);
+ free (to_state);
order = XCALLOC (vector_number_t, nvectors);
sort_actions ();
@@ -816,8 +815,8 @@
for (i = 0; i < nvectors; i++)
{
- XFREE (froms[i]);
- XFREE (tos[i]);
+ free (froms[i]);
+ free (tos[i]);
XFREE (conflict_tos[i]);
}
Index: 0.8/src/state.c
--- 0.8/src/state.c Fri, 08 Nov 2002 16:19:16 +0100 akim (bison/44_state.c 1.1
644)
+++ 0.8(w)/src/state.c Sat, 09 Nov 2002 17:04:36 +0100 akim (bison/44_state.c
1.1 644)
@@ -141,8 +141,7 @@
{
state_t *res;
- if (nstates >= STATE_NUMBER_MAX)
- fatal (_("too many states (max %d)"), STATE_NUMBER_MAX);
+ assert (nstates < STATE_NUMBER_MAX);
res = STATE_ALLOC (core_size);
res->accessing_symbol = accessing_symbol;
Index: 0.8/src/reader.c
--- 0.8/src/reader.c Sat, 09 Nov 2002 16:45:25 +0100 akim (bison/b/0_reader.c
1.4 644)
+++ 0.8(w)/src/reader.c Sun, 10 Nov 2002 10:57:43 +0100 akim
(bison/b/0_reader.c 1.4 644)
@@ -535,10 +535,7 @@
grammar = p;
}
- if (SYMBOL_NUMBER_MAX < nsyms)
- fatal (_("too many symbols (tokens plus nonterminals); maximum %d"),
- SYMBOL_NUMBER_MAX);
-
+ assert (nsyms <= SYMBOL_NUMBER_MAX);
assert (nsyms == ntokens + nvars);
xfclose (finput);
Index: 0.8/src/location.h
--- 0.8/src/location.h Fri, 08 Nov 2002 16:19:16 +0100 akim
(bison/b/14_location.h 1.1 644)
+++ 0.8(w)/src/location.h Sat, 09 Nov 2002 17:12:47 +0100 akim
(bison/b/14_location.h 1.1 644)
@@ -53,20 +53,23 @@
Warning: it uses quotearg's slot 3. */
# define LOCATION_PRINT(Out, Loc) \
do { \
- fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \
+ fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \
(Loc).file)); \
- if ((Loc).first_line != (Loc).last_line) \
- fprintf (Out, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column - 1); \
- else if ((Loc).first_column < (Loc).last_column - 1) \
- fprintf (Out, "%d.%d-%d", (Loc).first_line,
\
- (Loc).first_column, (Loc).last_column - 1); \
- else \
- fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \
+ if ((Loc).first_line)
\
+ { \
+ if ((Loc).first_line != (Loc).last_line) \
+ fprintf (Out, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column - 1); \
+ else if ((Loc).first_column < (Loc).last_column - 1) \
+ fprintf (Out, "%d.%d-%d", (Loc).first_line, \
+ (Loc).first_column, (Loc).last_column - 1); \
+ else \
+ fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \
+ } \
} while (0)
-
extern location_t empty_location;
+
#endif /* !LOCATION_H_ */
Index: 0.8/src/lalr.c
--- 0.8/src/lalr.c Fri, 08 Nov 2002 16:19:16 +0100 akim (bison/b/16_lalr.c 1.1
644)
+++ 0.8(w)/src/lalr.c Sat, 09 Nov 2002 17:04:12 +0100 akim (bison/b/16_lalr.c
1.1 644)
@@ -87,9 +87,7 @@
int i;
for (i = sp->num - 1; i >= 0 && TRANSITION_IS_GOTO (sp, i); --i)
{
- if (ngotos == GOTO_NUMBER_MAX)
- fatal (_("too many gotos (max %d)"), GOTO_NUMBER_MAX);
-
+ assert (ngotos < GOTO_NUMBER_MAX);
ngotos++;
goto_map[TRANSITION_SYMBOL (sp, i)]++;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 05-assert.patch,
Akim Demaille <=