mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +00:00
Be a bit more systematic about using 'abort'.
* lib/abitset.c (abitset_test): Remove ATTRIBUTE_UNUSED; not needed. * lib/bitset.c (bitset_bytes, bitset_init, bitset_op4_cmp): Put 'default: abort ();' before some other case, to satisfy older pedantic compilers. * lib/bitset_stats.c (bitset_stats_init): Likewise. * lib/ebitset.c (ebitset_elt_find, ebitset_op3_cmp): Likewise. * lib/lbitset.c (lbitset_elt_find, lbitset_op3_cmp): Likewise. * src/conflicts.c (resolve_sr_conflict): Likewise. * src/vcg.c (get_color_str, get_textmode_str, get_shape_str): (get_decision_str, get_orientation_str, get_node_alignment_str): (get_arrow_mode_str, get_crossing_type_str, get_view_str): (get_linestyle_str, get_arrowstyle_str): Likewise. * src/conflicts.c (resolve_sr_conflict): Use a default case rather than one for the one remaining enum value, to catch invalid enum values as well. * src/lalr.c (set_goto_map, map_goto): Prefer "assert (FOO);" to "if (!FOO) abort ();". * src/nullable.c (nullable_compute, token_definitions_output): Likewise. * src/reader.c (packgram, reader): Likewise. * src/state.c (transitions_to, state_new, state_reduction_find): Likewise. * src/symtab.c (symbol_user_token_number_set, symbol_make_alias): (symbol_pack): Likewise. * src/tables.c (conflict_row, pack_vector): Likewise. * src/scan-skel.l (QPUTS): Remove unnecessary parens. (BASE_QPUTS, "@output ".*\n): Remove unnecessary asserts. * src/system.h: Don't include <assert.h>. (assert): New macro.
This commit is contained in:
15
src/tables.c
15
src/tables.c
@@ -202,16 +202,14 @@ conflict_row (state *s)
|
||||
&& (actrow[j]
|
||||
!= rule_number_as_item_number (reds->rules[i]->number)))
|
||||
{
|
||||
if (conflict_list_free <= 0)
|
||||
abort ();
|
||||
assert (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. */
|
||||
if (conflict_list_free <= 0)
|
||||
abort ();
|
||||
assert (0 < conflict_list_free);
|
||||
conflict_list[conflict_list_cnt] = 0;
|
||||
conflict_list_cnt += 1;
|
||||
conflict_list_free -= 1;
|
||||
@@ -675,16 +673,14 @@ pack_vector (vector_number vector)
|
||||
base_number *to = tos[i];
|
||||
unsigned int *conflict_to = conflict_tos[i];
|
||||
|
||||
if (!t)
|
||||
abort ();
|
||||
assert (t);
|
||||
|
||||
for (j = lowzero - from[0]; ; j++)
|
||||
{
|
||||
int k;
|
||||
bool ok = true;
|
||||
|
||||
if (table_size <= j)
|
||||
abort ();
|
||||
assert (j < table_size);
|
||||
|
||||
for (k = 0; ok && k < t; k++)
|
||||
{
|
||||
@@ -717,8 +713,7 @@ pack_vector (vector_number vector)
|
||||
if (loc > high)
|
||||
high = loc;
|
||||
|
||||
if (! (BASE_MINIMUM <= j && j <= BASE_MAXIMUM))
|
||||
abort ();
|
||||
assert (BASE_MINIMUM <= j && j <= BASE_MAXIMUM);
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user