mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +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:
30
ChangeLog
30
ChangeLog
@@ -1,9 +1,5 @@
|
|||||||
2006-01-20 Paul Eggert <eggert@cs.ucla.edu>
|
2006-01-20 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
* doc/bison.texinfo (Prologue, Rules, Actions, Union Decl, Action Decl):
|
|
||||||
(Destructor Decl, Parser Function, Pure Calling):
|
|
||||||
Describe rules for braces inside C code more carefully.
|
|
||||||
|
|
||||||
Be a bit more systematic about using 'abort'.
|
Be a bit more systematic about using 'abort'.
|
||||||
* lib/abitset.c (abitset_test): Remove ATTRIBUTE_UNUSED; not needed.
|
* lib/abitset.c (abitset_test): Remove ATTRIBUTE_UNUSED; not needed.
|
||||||
* lib/bitset.c (bitset_bytes, bitset_init, bitset_op4_cmp):
|
* lib/bitset.c (bitset_bytes, bitset_init, bitset_op4_cmp):
|
||||||
@@ -13,11 +9,31 @@
|
|||||||
* lib/ebitset.c (ebitset_elt_find, ebitset_op3_cmp): Likewise.
|
* lib/ebitset.c (ebitset_elt_find, ebitset_op3_cmp): Likewise.
|
||||||
* lib/lbitset.c (lbitset_elt_find, lbitset_op3_cmp): Likewise.
|
* lib/lbitset.c (lbitset_elt_find, lbitset_op3_cmp): Likewise.
|
||||||
* src/conflicts.c (resolve_sr_conflict): Likewise.
|
* src/conflicts.c (resolve_sr_conflict): Likewise.
|
||||||
* src/LR0.c (save_reductions): Use "if (!FOO) abort ();" rather than
|
* src/vcg.c (get_color_str, get_textmode_str, get_shape_str):
|
||||||
"assert (FOO);".
|
(get_decision_str, get_orientation_str, get_node_alignment_str):
|
||||||
* src/state.c (state_transitions_set, state_reductions_set): Likewise.
|
(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.
|
* src/scan-skel.l (QPUTS): Remove unnecessary parens.
|
||||||
(BASE_QPUTS, "@output ".*\n): Remove unnecessary asserts.
|
(BASE_QPUTS, "@output ".*\n): Remove unnecessary asserts.
|
||||||
|
* src/system.h: Don't include <assert.h>.
|
||||||
|
(assert): New macro.
|
||||||
|
|
||||||
|
* doc/bison.texinfo (Prologue, Rules, Actions, Union Decl, Action Decl):
|
||||||
|
(Destructor Decl, Parser Function, Pure Calling):
|
||||||
|
Describe rules for braces inside C code more carefully.
|
||||||
|
|
||||||
2006-01-19 Paul Eggert <eggert@cs.ucla.edu>
|
2006-01-19 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static bitset_bindex
|
static bitset_bindex
|
||||||
abitset_resize (bitset src ATTRIBUTE_UNUSED,
|
abitset_resize (bitset src, bitset_bindex size)
|
||||||
bitset_bindex size ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
/* These bitsets have a fixed size. */
|
/* These bitsets have a fixed size. */
|
||||||
if (BITSET_SIZE_ (src) != size)
|
if (BITSET_SIZE_ (src) != size)
|
||||||
|
|||||||
20
lib/bitset.c
20
lib/bitset.c
@@ -1,5 +1,5 @@
|
|||||||
/* General bitsets.
|
/* 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).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
bytes = abitset_bytes (n_bits);
|
bytes = abitset_bytes (n_bits);
|
||||||
break;
|
break;
|
||||||
@@ -60,9 +63,6 @@ bitset_bytes (enum bitset_type type, bitset_bindex n_bits)
|
|||||||
case BITSET_VARRAY:
|
case BITSET_VARRAY:
|
||||||
bytes = vbitset_bytes (n_bits);
|
bytes = vbitset_bytes (n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytes;
|
return bytes;
|
||||||
@@ -78,6 +78,9 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
return abitset_init (bset, n_bits);
|
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:
|
case BITSET_VARRAY:
|
||||||
return vbitset_init (bset, n_bits);
|
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)
|
switch (op)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_OP_OR_AND:
|
case BITSET_OP_OR_AND:
|
||||||
bitset_or (tmp, src1, src2);
|
bitset_or (tmp, src1, src2);
|
||||||
changed = bitset_and_cmp (dst, src3, tmp);
|
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);
|
bitset_andn (tmp, src1, src2);
|
||||||
changed = bitset_or_cmp (dst, src3, tmp);
|
changed = bitset_or_cmp (dst, src3, tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bitset_free (tmp);
|
bitset_free (tmp);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Bitset statistics.
|
/* 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).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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. */
|
we are a wrapper over. */
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_ARRAY:
|
case BITSET_ARRAY:
|
||||||
bytes = abitset_bytes (n_bits);
|
bytes = abitset_bytes (n_bits);
|
||||||
sbset = xcalloc (1, bytes);
|
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);
|
sbset = xcalloc (1, bytes);
|
||||||
vbitset_init (sbset, n_bits);
|
vbitset_init (sbset, n_bits);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bset->s.bset = sbset;
|
bset->s.bset = sbset;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Functions to support expandable bitsets.
|
/* 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).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case EBITSET_FIND:
|
case EBITSET_FIND:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -337,9 +340,6 @@ ebitset_elt_find (bitset bset, bitset_bindex bindex,
|
|||||||
|
|
||||||
case EBITSET_SUBST:
|
case EBITSET_SUBST:
|
||||||
return &ebitset_zero_elts[0];
|
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);
|
dstp = EBITSET_WORDS (delt);
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_OP_OR:
|
case BITSET_OP_OR:
|
||||||
for (i = 0; i < EBITSET_ELT_WORDS; i++, dstp++)
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ebitset_elt_zero_p (delt))
|
if (!ebitset_elt_zero_p (delt))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Functions to support link list bitsets.
|
/* 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).
|
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case LBITSET_FIND:
|
case LBITSET_FIND:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -376,9 +379,6 @@ lbitset_elt_find (bitset bset, bitset_windex windex,
|
|||||||
|
|
||||||
case LBITSET_SUBST:
|
case LBITSET_SUBST:
|
||||||
return &lbitset_zero_elts[0];
|
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;
|
dstp = dtmp->words;
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case BITSET_OP_OR:
|
case BITSET_OP_OR:
|
||||||
for (i = 0; i < LBITSET_ELT_WORDS; i++, dstp++)
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lbitset_elt_zero_p (dtmp))
|
if (!lbitset_elt_zero_p (dtmp))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Find and resolve or report look-ahead conflicts for bison,
|
/* Find and resolve or report look-ahead conflicts for bison,
|
||||||
|
|
||||||
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005
|
Copyright (C) 1984, 1989, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
@@ -216,6 +216,9 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
|||||||
|
|
||||||
switch (symbols[i]->assoc)
|
switch (symbols[i]->assoc)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
|
||||||
case right_assoc:
|
case right_assoc:
|
||||||
log_resolution (redrule, i, right_resolution);
|
log_resolution (redrule, i, right_resolution);
|
||||||
flush_reduce (look_ahead_tokens, i);
|
flush_reduce (look_ahead_tokens, i);
|
||||||
@@ -233,9 +236,6 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors)
|
|||||||
/* Record an explicit error for this token. */
|
/* Record an explicit error for this token. */
|
||||||
errors[nerrs++] = symbols[i];
|
errors[nerrs++] = symbols[i];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case undef_assoc:
|
|
||||||
abort ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ set_goto_map (void)
|
|||||||
ngotos++;
|
ngotos++;
|
||||||
|
|
||||||
/* Abort if (ngotos + 1) would overflow. */
|
/* Abort if (ngotos + 1) would overflow. */
|
||||||
if (ngotos == GOTO_NUMBER_MAXIMUM)
|
assert (ngotos != GOTO_NUMBER_MAXIMUM);
|
||||||
abort ();
|
|
||||||
|
|
||||||
goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
|
goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
|
||||||
}
|
}
|
||||||
@@ -154,8 +153,7 @@ map_goto (state_number s0, symbol_number sym)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (high < low)
|
assert (low <= high);
|
||||||
abort ();
|
|
||||||
middle = (low + high) / 2;
|
middle = (low + high) / 2;
|
||||||
s = from_state[middle];
|
s = from_state[middle];
|
||||||
if (s == s0)
|
if (s == s0)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* Calculate which nonterminals can expand into the null string for Bison.
|
/* Calculate which nonterminals can expand into the null string for Bison.
|
||||||
|
|
||||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005 Free
|
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||||
Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -104,8 +104,8 @@ nullable_compute (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This rule has an empty RHS. */
|
/* This rule has an empty RHS. */
|
||||||
if (item_number_as_rule_number (rules_ruleno->rhs[0]) != ruleno)
|
assert (item_number_as_rule_number (rules_ruleno->rhs[0])
|
||||||
abort ();
|
== ruleno);
|
||||||
if (rules_ruleno->useful
|
if (rules_ruleno->useful
|
||||||
&& ! nullable[rules_ruleno->lhs->number - ntokens])
|
&& ! nullable[rules_ruleno->lhs->number - ntokens])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -239,8 +239,7 @@ prepare_rules (void)
|
|||||||
/* Merger-function index (GLR). */
|
/* Merger-function index (GLR). */
|
||||||
merger[r] = rules[r].merger;
|
merger[r] = rules[r].merger;
|
||||||
}
|
}
|
||||||
if (i != nritems)
|
assert (i == nritems);
|
||||||
abort ();
|
|
||||||
|
|
||||||
muscle_insert_item_number_table ("rhs", rhs, ritem[0], 1, nritems);
|
muscle_insert_item_number_table ("rhs", rhs, ritem[0], 1, nritems);
|
||||||
muscle_insert_unsigned_int_table ("prhs", prhs, 0, 0, nrules);
|
muscle_insert_unsigned_int_table ("prhs", prhs, 0, 0, nrules);
|
||||||
@@ -351,8 +350,7 @@ token_definitions_output (FILE *out)
|
|||||||
/* At this stage, if there are literal aliases, they are part of
|
/* At this stage, if there are literal aliases, they are part of
|
||||||
SYMBOLS, so we should not find symbols which are the aliases
|
SYMBOLS, so we should not find symbols which are the aliases
|
||||||
here. */
|
here. */
|
||||||
if (number == USER_NUMBER_ALIAS)
|
assert (number != USER_NUMBER_ALIAS);
|
||||||
abort ();
|
|
||||||
|
|
||||||
/* Skip error token. */
|
/* Skip error token. */
|
||||||
if (sym == errtoken)
|
if (sym == errtoken)
|
||||||
|
|||||||
@@ -469,8 +469,7 @@ packgram (void)
|
|||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemno != nritems)
|
assert (itemno == nritems);
|
||||||
abort ();
|
|
||||||
|
|
||||||
if (trace_flag & trace_sets)
|
if (trace_flag & trace_sets)
|
||||||
ritem_print (stderr);
|
ritem_print (stderr);
|
||||||
@@ -554,8 +553,7 @@ reader (void)
|
|||||||
grammar = p;
|
grammar = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (nsyms <= SYMBOL_NUMBER_MAXIMUM && nsyms == ntokens + nvars))
|
assert (nsyms <= SYMBOL_NUMBER_MAXIMUM && nsyms == ntokens + nvars);
|
||||||
abort ();
|
|
||||||
|
|
||||||
xfclose (gram_in);
|
xfclose (gram_in);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* Scan Bison Skeletons. -*- C -*-
|
/* Scan Bison Skeletons. -*- C -*-
|
||||||
|
|
||||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -39,10 +40,10 @@
|
|||||||
#include "scan-skel.h"
|
#include "scan-skel.h"
|
||||||
|
|
||||||
#define QPUTS(String) \
|
#define QPUTS(String) \
|
||||||
fputs (quotearg_style (c_quoting_style, (String)), yyout)
|
fputs (quotearg_style (c_quoting_style, String), yyout)
|
||||||
|
|
||||||
#define BASE_QPUTS(File) \
|
#define BASE_QPUTS(File) \
|
||||||
assert (File), QPUTS (base_name (File))
|
QPUTS (base_name (File))
|
||||||
|
|
||||||
%}
|
%}
|
||||||
%%
|
%%
|
||||||
@@ -63,15 +64,9 @@
|
|||||||
if (*file_name == '@')
|
if (*file_name == '@')
|
||||||
{
|
{
|
||||||
if (strcmp (file_name, "@output_header_name@") == 0)
|
if (strcmp (file_name, "@output_header_name@") == 0)
|
||||||
{
|
file_name = spec_defines_file;
|
||||||
assert (spec_defines_file);
|
|
||||||
file_name = spec_defines_file;
|
|
||||||
}
|
|
||||||
else if (strcmp (file_name, "@output_parser_name@") == 0)
|
else if (strcmp (file_name, "@output_parser_name@") == 0)
|
||||||
{
|
file_name = parser_file_name;
|
||||||
assert (parser_file_name);
|
|
||||||
file_name = parser_file_name;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fatal ("invalid token in skeleton: %s", yytext);
|
fatal ("invalid token in skeleton: %s", yytext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ transitions_to (transitions *shifts, symbol_number sym)
|
|||||||
int j;
|
int j;
|
||||||
for (j = 0; ; j++)
|
for (j = 0; ; j++)
|
||||||
{
|
{
|
||||||
if (shifts->num <= j)
|
assert (j < shifts->num);
|
||||||
abort ();
|
|
||||||
if (TRANSITION_SYMBOL (shifts, j) == sym)
|
if (TRANSITION_SYMBOL (shifts, j) == sym)
|
||||||
return shifts->states[j];
|
return shifts->states[j];
|
||||||
}
|
}
|
||||||
@@ -136,8 +135,7 @@ state_new (symbol_number accessing_symbol,
|
|||||||
state *res;
|
state *res;
|
||||||
size_t items_size = nitems * sizeof *core;
|
size_t items_size = nitems * sizeof *core;
|
||||||
|
|
||||||
if (STATE_NUMBER_MAXIMUM <= nstates)
|
assert (nstates < STATE_NUMBER_MAXIMUM);
|
||||||
abort ();
|
|
||||||
|
|
||||||
res = xmalloc (offsetof (state, items) + items_size);
|
res = xmalloc (offsetof (state, items) + items_size);
|
||||||
res->number = nstates++;
|
res->number = nstates++;
|
||||||
@@ -214,8 +212,7 @@ state_reduction_find (state *s, rule *r)
|
|||||||
void
|
void
|
||||||
state_errs_set (state *s, int num, symbol **tokens)
|
state_errs_set (state *s, int num, symbol **tokens)
|
||||||
{
|
{
|
||||||
if (s->errs)
|
assert (!s->errs);
|
||||||
abort ();
|
|
||||||
s->errs = errs_new (num, tokens);
|
s->errs = errs_new (num, tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
src/symtab.c
14
src/symtab.c
@@ -223,8 +223,7 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
|||||||
void
|
void
|
||||||
symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
||||||
{
|
{
|
||||||
if (sym->class != token_sym)
|
assert (sym->class == token_sym);
|
||||||
abort ();
|
|
||||||
|
|
||||||
if (sym->user_token_number != USER_NUMBER_UNDEFINED
|
if (sym->user_token_number != USER_NUMBER_UNDEFINED
|
||||||
&& sym->user_token_number != user_token_number)
|
&& 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. */
|
/* sym and symval combined are only one symbol. */
|
||||||
nsyms--;
|
nsyms--;
|
||||||
ntokens--;
|
ntokens--;
|
||||||
if (ntokens != sym->number && ntokens != symval->number)
|
assert (ntokens == sym->number || ntokens == symval->number);
|
||||||
abort ();
|
|
||||||
sym->number = symval->number =
|
sym->number = symval->number =
|
||||||
(symval->number < sym->number) ? symval->number : sym->number;
|
(symval->number < sym->number) ? symval->number : sym->number;
|
||||||
symbol_type_set (symval, sym->type_name, loc);
|
symbol_type_set (symval, sym->type_name, loc);
|
||||||
@@ -389,8 +387,7 @@ symbol_pack (symbol *this)
|
|||||||
this->number = this->alias->number = 0;
|
this->number = this->alias->number = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->alias->number == NUMBER_UNDEFINED)
|
assert (this->alias->number != NUMBER_UNDEFINED);
|
||||||
abort ();
|
|
||||||
this->number = this->alias->number;
|
this->number = this->alias->number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,10 +396,7 @@ symbol_pack (symbol *this)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else /* this->class == token_sym */
|
else /* this->class == token_sym */
|
||||||
{
|
assert (this->number != NUMBER_UNDEFINED);
|
||||||
if (this->number == NUMBER_UNDEFINED)
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
|
|
||||||
symbols[this->number] = this;
|
symbols[this->number] = this;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -64,8 +64,6 @@
|
|||||||
typedef size_t uintptr_t;
|
typedef size_t uintptr_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <verify.h>
|
#include <verify.h>
|
||||||
#include <xalloc.h>
|
#include <xalloc.h>
|
||||||
|
|
||||||
@@ -216,6 +214,11 @@ do { \
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Assertions. <assert.h>'s assertions are too heavyweight, and can
|
||||||
|
be disabled too easily, so implement it separately here. */
|
||||||
|
#define assert(x) ((void) ((x) || (abort (), 0)))
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------.
|
/*---------------------------------------------.
|
||||||
| Debugging memory allocation (must be last). |
|
| Debugging memory allocation (must be last). |
|
||||||
`---------------------------------------------*/
|
`---------------------------------------------*/
|
||||||
|
|||||||
15
src/tables.c
15
src/tables.c
@@ -202,16 +202,14 @@ conflict_row (state *s)
|
|||||||
&& (actrow[j]
|
&& (actrow[j]
|
||||||
!= rule_number_as_item_number (reds->rules[i]->number)))
|
!= rule_number_as_item_number (reds->rules[i]->number)))
|
||||||
{
|
{
|
||||||
if (conflict_list_free <= 0)
|
assert (0 < conflict_list_free);
|
||||||
abort ();
|
|
||||||
conflict_list[conflict_list_cnt] = reds->rules[i]->number + 1;
|
conflict_list[conflict_list_cnt] = reds->rules[i]->number + 1;
|
||||||
conflict_list_cnt += 1;
|
conflict_list_cnt += 1;
|
||||||
conflict_list_free -= 1;
|
conflict_list_free -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Leave a 0 at the end. */
|
/* Leave a 0 at the end. */
|
||||||
if (conflict_list_free <= 0)
|
assert (0 < conflict_list_free);
|
||||||
abort ();
|
|
||||||
conflict_list[conflict_list_cnt] = 0;
|
conflict_list[conflict_list_cnt] = 0;
|
||||||
conflict_list_cnt += 1;
|
conflict_list_cnt += 1;
|
||||||
conflict_list_free -= 1;
|
conflict_list_free -= 1;
|
||||||
@@ -675,16 +673,14 @@ pack_vector (vector_number vector)
|
|||||||
base_number *to = tos[i];
|
base_number *to = tos[i];
|
||||||
unsigned int *conflict_to = conflict_tos[i];
|
unsigned int *conflict_to = conflict_tos[i];
|
||||||
|
|
||||||
if (!t)
|
assert (t);
|
||||||
abort ();
|
|
||||||
|
|
||||||
for (j = lowzero - from[0]; ; j++)
|
for (j = lowzero - from[0]; ; j++)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
if (table_size <= j)
|
assert (j < table_size);
|
||||||
abort ();
|
|
||||||
|
|
||||||
for (k = 0; ok && k < t; k++)
|
for (k = 0; ok && k < t; k++)
|
||||||
{
|
{
|
||||||
@@ -717,8 +713,7 @@ pack_vector (vector_number vector)
|
|||||||
if (loc > high)
|
if (loc > high)
|
||||||
high = loc;
|
high = loc;
|
||||||
|
|
||||||
if (! (BASE_MINIMUM <= j && j <= BASE_MAXIMUM))
|
assert (BASE_MINIMUM <= j && j <= BASE_MAXIMUM);
|
||||||
abort ();
|
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
src/vcg.c
25
src/vcg.c
@@ -1,6 +1,7 @@
|
|||||||
/* VCG description handler for Bison.
|
/* VCG description handler for Bison.
|
||||||
|
|
||||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||||
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -213,6 +214,7 @@ get_color_str (enum color color)
|
|||||||
{
|
{
|
||||||
switch (color)
|
switch (color)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case white: return "white";
|
case white: return "white";
|
||||||
case blue: return "blue";
|
case blue: return "blue";
|
||||||
case red: return "red";
|
case red: return "red";
|
||||||
@@ -245,7 +247,6 @@ get_color_str (enum color color)
|
|||||||
case orange: return "orange";
|
case orange: return "orange";
|
||||||
case orchid: return "orchid";
|
case orchid: return "orchid";
|
||||||
case black: return "black";
|
case black: return "black";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,10 +255,10 @@ get_textmode_str (enum textmode textmode)
|
|||||||
{
|
{
|
||||||
switch (textmode)
|
switch (textmode)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case centered: return "center";
|
case centered: return "center";
|
||||||
case left_justify: return "left_justify";
|
case left_justify: return "left_justify";
|
||||||
case right_justify: return "right_justify";
|
case right_justify: return "right_justify";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,11 +267,11 @@ get_shape_str (enum shape shape)
|
|||||||
{
|
{
|
||||||
switch (shape)
|
switch (shape)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case box: return "box";
|
case box: return "box";
|
||||||
case rhomb: return "rhomb";
|
case rhomb: return "rhomb";
|
||||||
case ellipse: return "ellipse";
|
case ellipse: return "ellipse";
|
||||||
case triangle: return "triangle";
|
case triangle: return "triangle";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,9 +280,9 @@ get_decision_str (enum decision decision)
|
|||||||
{
|
{
|
||||||
switch (decision)
|
switch (decision)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case no: return "no";
|
case no: return "no";
|
||||||
case yes: return "yes";
|
case yes: return "yes";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,11 +291,11 @@ get_orientation_str (enum orientation orientation)
|
|||||||
{
|
{
|
||||||
switch (orientation)
|
switch (orientation)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case top_to_bottom: return "top_to_bottom";
|
case top_to_bottom: return "top_to_bottom";
|
||||||
case bottom_to_top: return "bottom_to_top";
|
case bottom_to_top: return "bottom_to_top";
|
||||||
case left_to_right: return "left_to_right";
|
case left_to_right: return "left_to_right";
|
||||||
case right_to_left: return "right_to_left";
|
case right_to_left: return "right_to_left";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,10 +304,10 @@ get_node_alignment_str (enum alignment alignment)
|
|||||||
{
|
{
|
||||||
switch (alignment)
|
switch (alignment)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case center: return "center";
|
case center: return "center";
|
||||||
case top: return "top";
|
case top: return "top";
|
||||||
case bottom: return "bottom";
|
case bottom: return "bottom";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,9 +316,9 @@ get_arrow_mode_str (enum arrow_mode arrow_mode)
|
|||||||
{
|
{
|
||||||
switch (arrow_mode)
|
switch (arrow_mode)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case fixed: return "fixed";
|
case fixed: return "fixed";
|
||||||
case free_a: return "free";
|
case free_a: return "free";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,11 +327,11 @@ get_crossing_type_str (enum crossing_type crossing_type)
|
|||||||
{
|
{
|
||||||
switch (crossing_type)
|
switch (crossing_type)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case bary: return "bary";
|
case bary: return "bary";
|
||||||
case median: return "median";
|
case median: return "median";
|
||||||
case barymedian: return "barymedian";
|
case barymedian: return "barymedian";
|
||||||
case medianbary: return "medianbary";
|
case medianbary: return "medianbary";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,11 +342,11 @@ get_view_str (enum view view)
|
|||||||
so it is an error here if view == normal_view. */
|
so it is an error here if view == normal_view. */
|
||||||
switch (view)
|
switch (view)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case cfish: return "cfish";
|
case cfish: return "cfish";
|
||||||
case pfish: return "pfish";
|
case pfish: return "pfish";
|
||||||
case fcfish: return "fcfish";
|
case fcfish: return "fcfish";
|
||||||
case fpfish: return "fpfish";
|
case fpfish: return "fpfish";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,11 +355,11 @@ get_linestyle_str (enum linestyle linestyle)
|
|||||||
{
|
{
|
||||||
switch (linestyle)
|
switch (linestyle)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case continuous: return "continuous";
|
case continuous: return "continuous";
|
||||||
case dashed: return "dashed";
|
case dashed: return "dashed";
|
||||||
case dotted: return "dotted";
|
case dotted: return "dotted";
|
||||||
case invisible: return "invisible";
|
case invisible: return "invisible";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,10 +368,10 @@ get_arrowstyle_str (enum arrowstyle arrowstyle)
|
|||||||
{
|
{
|
||||||
switch (arrowstyle)
|
switch (arrowstyle)
|
||||||
{
|
{
|
||||||
|
default: abort ();
|
||||||
case solid: return "solid";
|
case solid: return "solid";
|
||||||
case line: return "line";
|
case line: return "line";
|
||||||
case none: return "none";
|
case none: return "none";
|
||||||
default: abort (); return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user