Port to GCC 2.95. First two problems reported by Michael Deutschmann in

<http://lists.gnu.org/archive/html/bug-bison/2006-09/msg00018.html>.

* src/parse-gram.y (symbol_declaration): Don't put statements
before declarations; it's not portable to C89.
* src/scan-code.l (handle_action_at): Likewise.

* src/scan-code.l: Always initialize braces_level; the old code
left it uninitialized and therefore had undefined behavior.

Don't attempt to redefine 'assert', since it runs afoul of
systems where standard headers (mistakenly) include <assert.h>.
Instead, define and use our own alternative, called 'aver'.
* src/reader.c: Don't include assert.h, since we no longer
use assert.
* src/scan-code.l: Likewise.
* src/system.h (assert): Remove, replacing with....
(aver): New function, taking a bool arg.  All uses changed.
* src/tables.c (pack_vector): Ensure that aver arg is bool,
not merely an integer.
This commit is contained in:
Paul Eggert
2006-09-15 16:34:48 +00:00
parent 3fa3725adb
commit 4f82b42a9d
13 changed files with 78 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
/* Output the generated parsing program for Bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
2005 Free Software Foundation, Inc.
2005, 2006 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -202,14 +202,14 @@ conflict_row (state *s)
&& (actrow[j]
!= rule_number_as_item_number (reds->rules[i]->number)))
{
assert (0 < conflict_list_free);
aver (0 < conflict_list_free);
conflict_list[conflict_list_cnt] = reds->rules[i]->number + 1;
conflict_list_cnt += 1;
conflict_list_free -= 1;
}
/* Leave a 0 at the end. */
assert (0 < conflict_list_free);
aver (0 < conflict_list_free);
conflict_list[conflict_list_cnt] = 0;
conflict_list_cnt += 1;
conflict_list_free -= 1;
@@ -673,14 +673,14 @@ pack_vector (vector_number vector)
base_number *to = tos[i];
unsigned int *conflict_to = conflict_tos[i];
assert (t);
aver (t != 0);
for (j = lowzero - from[0]; ; j++)
{
int k;
bool ok = true;
assert (j < table_size);
aver (j < table_size);
for (k = 0; ok && k < t; k++)
{
@@ -713,7 +713,7 @@ pack_vector (vector_number vector)
if (loc > high)
high = loc;
assert (BASE_MINIMUM <= j && j <= BASE_MAXIMUM);
aver (BASE_MINIMUM <= j && j <= BASE_MAXIMUM);
return j;
}
}