mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12: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:
@@ -34,8 +34,7 @@
|
||||
|
||||
|
||||
static bitset_bindex
|
||||
abitset_resize (bitset src ATTRIBUTE_UNUSED,
|
||||
bitset_bindex size ATTRIBUTE_UNUSED)
|
||||
abitset_resize (bitset src, bitset_bindex size)
|
||||
{
|
||||
/* These bitsets have a fixed size. */
|
||||
if (BITSET_SIZE_ (src) != size)
|
||||
|
||||
20
lib/bitset.c
20
lib/bitset.c
@@ -1,5 +1,5 @@
|
||||
/* General bitsets.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -45,6 +45,9 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_ARRAY:
|
||||
bytes = abitset_bytes (n_bits);
|
||||
break;
|
||||
@@ -60,9 +63,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
||||
case BITSET_VARRAY:
|
||||
bytes = vbitset_bytes (n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
@@ -78,6 +78,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_ARRAY:
|
||||
return abitset_init (bset, n_bits);
|
||||
|
||||
@@ -89,9 +92,6 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
|
||||
case BITSET_VARRAY:
|
||||
return vbitset_init (bset, n_bits);
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,6 +421,9 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
||||
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR_AND:
|
||||
bitset_or (tmp, src1, src2);
|
||||
changed = bitset_and_cmp (dst, src3, tmp);
|
||||
@@ -435,9 +438,6 @@ bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
|
||||
bitset_andn (tmp, src1, src2);
|
||||
changed = bitset_or_cmp (dst, src3, tmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bitset_free (tmp);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Bitset statistics.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -696,6 +696,9 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
we are a wrapper over. */
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_ARRAY:
|
||||
bytes = abitset_bytes (n_bits);
|
||||
sbset = xcalloc (1, bytes);
|
||||
@@ -719,9 +722,6 @@ bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
||||
sbset = xcalloc (1, bytes);
|
||||
vbitset_init (sbset, n_bits);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
bset->s.bset = sbset;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Functions to support expandable bitsets.
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -322,6 +322,9 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case EBITSET_FIND:
|
||||
return 0;
|
||||
|
||||
@@ -337,9 +340,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
||||
|
||||
case EBITSET_SUBST:
|
||||
return &ebitset_zero_elts[0];
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1090,6 +1090,9 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
dstp = EBITSET_WORDS (delt);
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
@@ -1141,9 +1144,6 @@ ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (!ebitset_elt_zero_p (delt))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Functions to support link list bitsets.
|
||||
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -363,6 +363,9 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case LBITSET_FIND:
|
||||
return 0;
|
||||
|
||||
@@ -376,9 +379,6 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
|
||||
|
||||
case LBITSET_SUBST:
|
||||
return &lbitset_zero_elts[0];
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,6 +1117,9 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
dstp = dtmp->words;
|
||||
switch (op)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case BITSET_OP_OR:
|
||||
for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++)
|
||||
{
|
||||
@@ -1168,9 +1171,6 @@ lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (!lbitset_elt_zero_p (dtmp))
|
||||
|
||||
Reference in New Issue
Block a user