bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison c++ compile


From: Paul Eggert
Subject: Re: bison c++ compile
Date: Fri, 20 Jan 2006 20:47:42 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Akim Demaille <address@hidden> writes:

> Do as you feel, but note that some of the recent asserts were
> abort before I converted them to assert :)

Okey, how about the following?  Ouside library code it uses 'assert
(FOO);' instead of 'if (!FOO) abort ();', but it uses our own assert
macro.  I think this should address both your concern and mine.  It
also addresses some of the other minor compiler-warning glitches
people have noted in the past few months, I hope.  I installed it.

2006-01-20  Paul Eggert  <address@hidden>

        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.

Index: lib/abitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/abitset.c,v
retrieving revision 1.10
diff -p -u -r1.10 abitset.c
--- lib/abitset.c       20 Jan 2006 01:59:30 -0000      1.10
+++ lib/abitset.c       21 Jan 2006 04:22:11 -0000
@@ -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)
Index: lib/bitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset.c,v
retrieving revision 1.16
diff -p -u -r1.16 bitset.c
--- lib/bitset.c        5 Oct 2005 06:39:07 -0000       1.16
+++ lib/bitset.c        21 Jan 2006 04:22:11 -0000
@@ -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 (address@hidden).
 
    This program is free software; you can redistribute it and/or modify
@@ -45,6 +45,9 @@ bitset_bytes (enum bitset_type type, bit
 
   switch (type)
     {
+    default:
+      abort ();
+
     case BITSET_ARRAY:
       bytes = abitset_bytes (n_bits);
       break;
@@ -60,9 +63,6 @@ bitset_bytes (enum bitset_type type, bit
     case BITSET_VARRAY:
       bytes = vbitset_bytes (n_bits);
       break;
-
-    default:
-      abort ();
     }
 
   return bytes;
@@ -78,6 +78,9 @@ bitset_init (bitset bset, bitset_bindex 
 
   switch (type)
     {
+    default:
+      abort ();
+
     case BITSET_ARRAY:
       return abitset_init (bset, n_bits);
 
@@ -89,9 +92,6 @@ bitset_init (bitset bset, bitset_bindex 
 
     case BITSET_VARRAY:
       return vbitset_init (bset, n_bits);
-
-    default:
-      abort ();
     }
 }
 
@@ -421,6 +421,9 @@ bitset_op4_cmp (bitset dst, bitset src1,
 
   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_andn (tmp, src1, src2);
       changed = bitset_or_cmp (dst, src3, tmp);
       break;
-
-    default:
-      abort ();
     }
 
   bitset_free (tmp);
Index: lib/bitset_stats.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset_stats.c,v
retrieving revision 1.17
diff -p -u -r1.17 bitset_stats.c
--- lib/bitset_stats.c  9 Sep 2005 22:42:15 -0000       1.17
+++ lib/bitset_stats.c  21 Jan 2006 04:22:11 -0000
@@ -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 (address@hidden).
 
    This program is free software; you can redistribute it and/or modify
@@ -696,6 +696,9 @@ bitset_stats_init (bitset bset, bitset_b
      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_b
       sbset = xcalloc (1, bytes);
       vbitset_init (sbset, n_bits);
       break;
-
-    default:
-      abort ();
     }
 
   bset->s.bset = sbset;
Index: lib/ebitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/ebitset.c,v
retrieving revision 1.16
diff -p -u -r1.16 ebitset.c
--- lib/ebitset.c       25 May 2005 19:47:59 -0000      1.16
+++ lib/ebitset.c       21 Jan 2006 04:22:11 -0000
@@ -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 (address@hidden).
 
    This program is free software; you can redistribute it and/or modify
@@ -322,6 +322,9 @@ ebitset_elt_find (bitset bset, bitset_bi
 
   switch (mode)
     {
+    default:
+      abort ();
+
     case EBITSET_FIND:
       return 0;
 
@@ -337,9 +340,6 @@ ebitset_elt_find (bitset bset, bitset_bi
 
     case EBITSET_SUBST:
       return &ebitset_zero_elts[0];
-
-    default:
-      abort ();
     }
 }
 
@@ -1090,6 +1090,9 @@ ebitset_op3_cmp (bitset dst, bitset src1
       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
                }
            }
          break;
-
-       default:
-         abort ();
        }
 
       if (!ebitset_elt_zero_p (delt))
Index: lib/lbitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/lbitset.c,v
retrieving revision 1.18
diff -p -u -r1.18 lbitset.c
--- lib/lbitset.c       5 Oct 2005 06:39:07 -0000       1.18
+++ lib/lbitset.c       21 Jan 2006 04:22:11 -0000
@@ -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 (address@hidden).
 
    This program is free software; you can redistribute it and/or modify
@@ -363,6 +363,9 @@ lbitset_elt_find (bitset bset, bitset_wi
 
   switch (mode)
     {
+    default:
+      abort ();
+
     case LBITSET_FIND:
       return 0;
 
@@ -376,9 +379,6 @@ lbitset_elt_find (bitset bset, bitset_wi
 
     case LBITSET_SUBST:
       return &lbitset_zero_elts[0];
-
-    default:
-      abort ();
     }
 }
 
@@ -1117,6 +1117,9 @@ lbitset_op3_cmp (bitset dst, bitset src1
       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
                }
            }
          break;
-
-       default:
-         abort ();
        }
 
       if (!lbitset_elt_zero_p (dtmp))
Index: src/conflicts.c
===================================================================
RCS file: /cvsroot/bison/bison/src/conflicts.c,v
retrieving revision 1.113
diff -p -u -r1.113 conflicts.c
--- src/conflicts.c     9 Dec 2005 23:51:25 -0000       1.113
+++ src/conflicts.c     21 Jan 2006 04:22:11 -0000
@@ -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 rulen
 
          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 rulen
              /* Record an explicit error for this token.  */
              errors[nerrs++] = symbols[i];
              break;
-
-           case undef_assoc:
-             abort ();
            }
       }
 
Index: src/lalr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lalr.c,v
retrieving revision 1.107
diff -p -u -r1.107 lalr.c
--- src/lalr.c  18 Jan 2006 23:48:29 -0000      1.107
+++ src/lalr.c  21 Jan 2006 04:22:11 -0000
@@ -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
 
   for (;;)
     {
-      if (high < low)
-       abort ();
+      assert (low <= high);
       middle = (low + high) / 2;
       s = from_state[middle];
       if (s == s0)
Index: src/nullable.c
===================================================================
RCS file: /cvsroot/bison/bison/src/nullable.c,v
retrieving revision 1.47
diff -p -u -r1.47 nullable.c
--- src/nullable.c      9 Dec 2005 23:51:26 -0000       1.47
+++ src/nullable.c      21 Jan 2006 04:22:11 -0000
@@ -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])
              {
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.244
diff -p -u -r1.244 output.c
--- src/output.c        3 Jan 2006 19:12:55 -0000       1.244
+++ src/output.c        21 Jan 2006 04:22:11 -0000
@@ -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)
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.249
diff -p -u -r1.249 reader.c
--- src/reader.c        20 Jan 2006 00:08:30 -0000      1.249
+++ src/reader.c        21 Jan 2006 04:22:11 -0000
@@ -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);
 
Index: src/scan-skel.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-skel.l,v
retrieving revision 1.37
diff -p -u -r1.37 scan-skel.l
--- src/scan-skel.l     9 Nov 2005 16:11:25 -0000       1.37
+++ src/scan-skel.l     21 Jan 2006 04:22:11 -0000
@@ -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);
     }
Index: src/state.c
===================================================================
RCS file: /cvsroot/bison/bison/src/state.c,v
retrieving revision 1.39
diff -p -u -r1.39 state.c
--- src/state.c 20 Jan 2006 01:59:30 -0000      1.39
+++ src/state.c 21 Jan 2006 04:22:11 -0000
@@ -61,8 +61,7 @@ transitions_to (transitions *shifts, 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_symbo
   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);
 }
 
Index: src/symtab.c
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.c,v
retrieving revision 1.69
diff -p -u -r1.69 symtab.c
--- src/symtab.c        3 Jan 2006 21:31:57 -0000       1.69
+++ src/symtab.c        21 Jan 2006 04:22:11 -0000
@@ -223,8 +223,7 @@ symbol_class_set (symbol *sym, symbol_cl
 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 *
       /* 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;
Index: src/system.h
===================================================================
RCS file: /cvsroot/bison/bison/src/system.h,v
retrieving revision 1.74
diff -p -u -r1.74 system.h
--- src/system.h        20 Jan 2006 01:59:30 -0000      1.74
+++ src/system.h        21 Jan 2006 04:22:11 -0000
@@ -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).  |
 `---------------------------------------------*/
Index: src/tables.c
===================================================================
RCS file: /cvsroot/bison/bison/src/tables.c,v
retrieving revision 1.30
diff -p -u -r1.30 tables.c
--- src/tables.c        9 Dec 2005 23:51:26 -0000       1.30
+++ src/tables.c        21 Jan 2006 04:22:11 -0000
@@ -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;
        }
     }
Index: src/vcg.c
===================================================================
RCS file: /cvsroot/bison/bison/src/vcg.c,v
retrieving revision 1.22
diff -p -u -r1.22 vcg.c
--- src/vcg.c   9 Dec 2005 23:51:26 -0000       1.22
+++ src/vcg.c   21 Jan 2006 04:22:11 -0000
@@ -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 or
 {
   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 a
 {
   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 arro
 {
   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_typ
 {
   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 linest
 {
   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 arro
 {
   switch (arrowstyle)
     {
+    default:   abort ();
     case solid:        return "solid";
     case line: return "line";
     case none: return "none";
-    default:   abort (); return NULL;
     }
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]