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:
Paul Eggert
2006-01-21 04:35:09 +00:00
parent 287c78f6ab
commit 68cae94e0b
17 changed files with 102 additions and 108 deletions

View File

@@ -223,8 +223,7 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
void
symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
{
if (sym->class != token_sym)
abort ();
assert (sym->class == token_sym);
if (sym->user_token_number != USER_NUMBER_UNDEFINED
&& sym->user_token_number != user_token_number)
@@ -295,8 +294,7 @@ symbol_make_alias (symbol *sym, symbol *symval, location loc)
/* sym and symval combined are only one symbol. */
nsyms--;
ntokens--;
if (ntokens != sym->number && ntokens != symval->number)
abort ();
assert (ntokens == sym->number || ntokens == symval->number);
sym->number = symval->number =
(symval->number < sym->number) ? symval->number : sym->number;
symbol_type_set (symval, sym->type_name, loc);
@@ -389,8 +387,7 @@ symbol_pack (symbol *this)
this->number = this->alias->number = 0;
else
{
if (this->alias->number == NUMBER_UNDEFINED)
abort ();
assert (this->alias->number != NUMBER_UNDEFINED);
this->number = this->alias->number;
}
}
@@ -399,10 +396,7 @@ symbol_pack (symbol *this)
return true;
}
else /* this->class == token_sym */
{
if (this->number == NUMBER_UNDEFINED)
abort ();
}
assert (this->number != NUMBER_UNDEFINED);
symbols[this->number] = this;
return true;