From 68cae94e0b4e83246787fc5a413f085513ae9160 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 21 Jan 2006 04:35:09 +0000
Subject: [PATCH] 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.

---
 ChangeLog          | 30 +++++++++++++++++++++++-------
 lib/abitset.c      |  3 +--
 lib/bitset.c       | 20 ++++++++++----------
 lib/bitset_stats.c |  8 ++++----
 lib/ebitset.c      | 14 +++++++-------
 lib/lbitset.c      | 14 +++++++-------
 src/conflicts.c    |  8 ++++----
 src/lalr.c         |  6 ++----
 src/nullable.c     |  8 ++++----
 src/output.c       |  6 ++----
 src/reader.c       |  6 ++----
 src/scan-skel.l    | 17 ++++++-----------
 src/state.c        |  9 +++------
 src/symtab.c       | 14 ++++----------
 src/system.h       |  7 +++++--
 src/tables.c       | 15 +++++----------
 src/vcg.c          | 25 +++++++++++++------------
 17 files changed, 102 insertions(+), 108 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d13a6be7..10d105af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,5 @@
 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'.
 	* lib/abitset.c (abitset_test): Remove ATTRIBUTE_UNUSED; not needed.
 	* 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/lbitset.c (lbitset_elt_find, lbitset_op3_cmp): Likewise.
 	* src/conflicts.c (resolve_sr_conflict): Likewise.
-	* src/LR0.c (save_reductions): Use "if (!FOO) abort ();" rather than
-	"assert (FOO);".
-	* src/state.c (state_transitions_set, state_reductions_set): 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.
+
+	* 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>
 
diff --git a/lib/abitset.c b/lib/abitset.c
index c573f34a..7eb85e0b 100644
--- a/lib/abitset.c
+++ b/lib/abitset.c
@@ -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)
diff --git a/lib/bitset.c b/lib/bitset.c
index ddbef843..5470c5a9 100644
--- a/lib/bitset.c
+++ b/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);
diff --git a/lib/bitset_stats.c b/lib/bitset_stats.c
index 0b59865d..eb879979 100644
--- a/lib/bitset_stats.c
+++ b/lib/bitset_stats.c
@@ -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;
diff --git a/lib/ebitset.c b/lib/ebitset.c
index 9ac85a2c..34d1b6ca 100644
--- a/lib/ebitset.c
+++ b/lib/ebitset.c
@@ -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))
diff --git a/lib/lbitset.c b/lib/lbitset.c
index 9d3d9573..55b9d7e4 100644
--- a/lib/lbitset.c
+++ b/lib/lbitset.c
@@ -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))
diff --git a/src/conflicts.c b/src/conflicts.c
index a0296d67..e2e9855f 100644
--- a/src/conflicts.c
+++ b/src/conflicts.c
@@ -1,6 +1,6 @@
 /* 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.
 
    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)
 	    {
+	    default:
+	      abort ();
+
 	    case right_assoc:
 	      log_resolution (redrule, i, right_resolution);
 	      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.  */
 	      errors[nerrs++] = symbols[i];
 	      break;
-
-	    case undef_assoc:
-	      abort ();
 	    }
       }
 
diff --git a/src/lalr.c b/src/lalr.c
index 5c162b50..65c55ab7 100644
--- a/src/lalr.c
+++ b/src/lalr.c
@@ -94,8 +94,7 @@ set_goto_map (void)
 	  ngotos++;
 
 	  /* Abort if (ngotos + 1) would overflow.  */
-	  if (ngotos == GOTO_NUMBER_MAXIMUM)
-	    abort ();
+	  assert (ngotos != GOTO_NUMBER_MAXIMUM);
 
 	  goto_map[TRANSITION_SYMBOL (sp, i) - ntokens]++;
 	}
@@ -154,8 +153,7 @@ map_goto (state_number s0, symbol_number sym)
 
   for (;;)
     {
-      if (high < low)
-	abort ();
+      assert (low <= high);
       middle = (low + high) / 2;
       s = from_state[middle];
       if (s == s0)
diff --git a/src/nullable.c b/src/nullable.c
index ef65ef46..83a90e95 100644
--- a/src/nullable.c
+++ b/src/nullable.c
@@ -1,7 +1,7 @@
 /* Calculate which nonterminals can expand into the null string for Bison.
 
-   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005 Free
-   Software Foundation, Inc.
+   Copyright (C) 1984, 1989, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -104,8 +104,8 @@ nullable_compute (void)
 	else
 	  {
 	    /* This rule has an empty RHS. */
-	    if (item_number_as_rule_number (rules_ruleno->rhs[0]) != ruleno)
-	      abort ();
+	    assert (item_number_as_rule_number (rules_ruleno->rhs[0])
+		    == ruleno);
 	    if (rules_ruleno->useful
 		&& ! nullable[rules_ruleno->lhs->number - ntokens])
 	      {
diff --git a/src/output.c b/src/output.c
index d9112423..07978ed9 100644
--- a/src/output.c
+++ b/src/output.c
@@ -239,8 +239,7 @@ prepare_rules (void)
       /* Merger-function index (GLR).  */
       merger[r] = rules[r].merger;
     }
-  if (i != nritems)
-    abort ();
+  assert (i == nritems);
 
   muscle_insert_item_number_table ("rhs", rhs, ritem[0], 1, nritems);
   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
 	 SYMBOLS, so we should not find symbols which are the aliases
 	 here.  */
-      if (number == USER_NUMBER_ALIAS)
-	abort ();
+      assert (number != USER_NUMBER_ALIAS);
 
       /* Skip error token.  */
       if (sym == errtoken)
diff --git a/src/reader.c b/src/reader.c
index 0744b3f2..56f11fd0 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -469,8 +469,7 @@ packgram (void)
 	p = p->next;
     }
 
-  if (itemno != nritems)
-    abort ();
+  assert (itemno == nritems);
 
   if (trace_flag & trace_sets)
     ritem_print (stderr);
@@ -554,8 +553,7 @@ reader (void)
     grammar = p;
   }
 
-  if (! (nsyms <= SYMBOL_NUMBER_MAXIMUM && nsyms == ntokens + nvars))
-    abort ();
+  assert (nsyms <= SYMBOL_NUMBER_MAXIMUM && nsyms == ntokens + nvars);
 
   xfclose (gram_in);
 
diff --git a/src/scan-skel.l b/src/scan-skel.l
index b14fb40c..8a57af51 100644
--- a/src/scan-skel.l
+++ b/src/scan-skel.l
@@ -1,6 +1,7 @@
 /* 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.
 
@@ -39,10 +40,10 @@
 #include "scan-skel.h"
 
 #define QPUTS(String) \
-   fputs (quotearg_style (c_quoting_style, (String)), yyout)
+   fputs (quotearg_style (c_quoting_style, String), yyout)
 
 #define BASE_QPUTS(File) \
-   assert (File), QPUTS (base_name (File))
+   QPUTS (base_name (File))
 
 %}
 %%
@@ -63,15 +64,9 @@
   if (*file_name == '@')
     {
       if (strcmp (file_name, "@output_header_name@") == 0)
-	{
-	  assert (spec_defines_file);
-	  file_name = spec_defines_file;
-	}
+	file_name = spec_defines_file;
       else if (strcmp (file_name, "@output_parser_name@") == 0)
-	{
-	  assert (parser_file_name);
-	  file_name = parser_file_name;
-	}
+	file_name = parser_file_name;
       else
 	fatal ("invalid token in skeleton: %s", yytext);
     }
diff --git a/src/state.c b/src/state.c
index 83e0108f..4eb39f9f 100644
--- a/src/state.c
+++ b/src/state.c
@@ -61,8 +61,7 @@ transitions_to (transitions *shifts, symbol_number sym)
   int j;
   for (j = 0; ; j++)
     {
-      if (shifts->num <= j)
-	abort ();
+      assert (j < shifts->num);
       if (TRANSITION_SYMBOL (shifts, j) == sym)
 	return shifts->states[j];
     }
@@ -136,8 +135,7 @@ state_new (symbol_number accessing_symbol,
   state *res;
   size_t items_size = nitems * sizeof *core;
 
-  if (STATE_NUMBER_MAXIMUM <= nstates)
-    abort ();
+  assert (nstates < STATE_NUMBER_MAXIMUM);
 
   res = xmalloc (offsetof (state, items) + items_size);
   res->number = nstates++;
@@ -214,8 +212,7 @@ state_reduction_find (state *s, rule *r)
 void
 state_errs_set (state *s, int num, symbol **tokens)
 {
-  if (s->errs)
-    abort ();
+  assert (!s->errs);
   s->errs = errs_new (num, tokens);
 }
 
diff --git a/src/symtab.c b/src/symtab.c
index 1f2c17ee..ef59c6ee 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -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;
diff --git a/src/system.h b/src/system.h
index c1c45b49..d6b45eeb 100644
--- a/src/system.h
+++ b/src/system.h
@@ -64,8 +64,6 @@
 typedef size_t uintptr_t;
 #endif
 
-#include <assert.h>
-
 #include <verify.h>
 #include <xalloc.h>
 
@@ -216,6 +214,11 @@ do {						\
 } 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).  |
 `---------------------------------------------*/
diff --git a/src/tables.c b/src/tables.c
index f88180e2..c938139b 100644
--- a/src/tables.c
+++ b/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;
 	}
     }
diff --git a/src/vcg.c b/src/vcg.c
index 643a1198..25fbb64e 100644
--- a/src/vcg.c
+++ b/src/vcg.c
@@ -1,6 +1,7 @@
 /* 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.
 
@@ -213,6 +214,7 @@ get_color_str (enum color color)
 {
   switch (color)
     {
+    default:		abort ();
     case white:		return "white";
     case blue:		return "blue";
     case red:		return "red";
@@ -245,7 +247,6 @@ get_color_str (enum color color)
     case orange:	return "orange";
     case orchid:	return "orchid";
     case black:		return "black";
-    default:		abort (); return NULL;
     }
 }
 
@@ -254,10 +255,10 @@ get_textmode_str (enum textmode textmode)
 {
   switch (textmode)
     {
+    default:		abort ();
     case centered:	return "center";
     case left_justify:	return "left_justify";
     case right_justify:	return "right_justify";
-    default:		abort (); return NULL;
     }
 }
 
@@ -266,11 +267,11 @@ get_shape_str (enum shape shape)
 {
   switch (shape)
     {
+    default:		abort ();
     case box:		return "box";
     case rhomb:		return "rhomb";
     case ellipse:	return "ellipse";
     case triangle:	return "triangle";
-    default:		abort (); return NULL;
     }
 }
 
@@ -279,9 +280,9 @@ get_decision_str (enum decision decision)
 {
   switch (decision)
     {
+    default:	abort ();
     case no:	return "no";
     case yes:	return "yes";
-    default:	abort (); return NULL;
     }
 }
 
@@ -290,11 +291,11 @@ get_orientation_str (enum orientation orientation)
 {
   switch (orientation)
     {
+    default:		abort ();
     case top_to_bottom:	return "top_to_bottom";
     case bottom_to_top: return "bottom_to_top";
     case left_to_right: return "left_to_right";
     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)
     {
+    default:		abort ();
     case center:	return "center";
     case top:		return "top";
     case bottom:	return "bottom";
-    default:		abort (); return NULL;
     }
 }
 
@@ -315,9 +316,9 @@ get_arrow_mode_str (enum arrow_mode arrow_mode)
 {
   switch (arrow_mode)
     {
+    default:		abort ();
     case fixed:		return "fixed";
     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)
     {
+    default:		abort ();
     case bary:		return "bary";
     case median:	return "median";
     case barymedian:	return "barymedian";
     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.  */
   switch (view)
     {
+    default:		abort ();
     case cfish:		return "cfish";
     case pfish:		return "pfish";
     case fcfish:	return "fcfish";
     case fpfish:	return "fpfish";
-    default:		abort (); return NULL;
     }
 }
 
@@ -354,11 +355,11 @@ get_linestyle_str (enum linestyle linestyle)
 {
   switch (linestyle)
     {
+    default:		abort ();
     case continuous:	return "continuous";
     case dashed:	return "dashed";
     case dotted:	return "dotted";
     case invisible:	return "invisible";
-    default:		abort (); return NULL;
     }
 }
 
@@ -367,10 +368,10 @@ get_arrowstyle_str (enum arrowstyle arrowstyle)
 {
   switch (arrowstyle)
     {
+    default:	abort ();
     case solid:	return "solid";
     case line:	return "line";
     case none:	return "none";
-    default:	abort (); return NULL;
     }
 }
 
-- 
2.47.2