bison-patches
[Top][All Lists]
Advanced

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

Bison 'bool' proposed cleanup


From: Paul Eggert
Subject: Bison 'bool' proposed cleanup
Date: Fri, 23 May 2003 17:58:54 -0700

Patches to Bison in the last few months have switched some instances
of 'int' to the C99 'bool' where that makes sense, falling back on a
standard 'bool' emulation for older C compilers that do not support
'bool'.  Here is a proposed patch to convert all such instances that I
could find in the Bison source proper.  I figure it's better to do it
all at once than to do it in dribs and drabs and have
partially-converted source.

2003-05-23  Paul Eggert  <address@hidden>

        Switch from 'int' to 'bool' where that makes sense.

        * lib/abitset.c (abitset_test, abitset_empty_p, abitset_equal_p,
        abitset_subset_p, abitset_disjoint_p, abitset_and_cmp,
        abitset_andn_cmp, abitset_or_cmp, abitset_xor_cmp, abitset_and_or,
        abitset_and_or_cmp, abitset_andn_or_cmp, abitset_or_and_cmp):
        Return or accept bool, not int.  All callers changed.
        * lib/bbitset.h: (bitset_toggle_, bitset_copy_, bitset_and_or_cmp_,
        bitset_andn_or_cmp_, bitset_or_and_cmp_): Likewise.
        * lib/bitset.c (bitset_only_set_p, bitset_print, bitset_toggle_,
        bitset_copy_, bitset_op4_cmp, bitset_and_or_cmp_, bitset_andn_or_cmp_,
        bitset_or_and_cmp_): Likewise.
        * lib/bitset.h (bitset_test, bitset_only_set_p): Likewise.
        * lib/bitset_stats.c (bitset_stats_print, bitset_stats_toggle,
        bitset_stats_test, bitset_stats_empty_p, bitset_stats_disjoint_p,
        bitset_stats_equal_p, bitset_stats_subset_p, bitset_stats_and_cmp,
        bitset_stats_andn_cmp, bitset_stats_or_cmp, bitset_stats_xor_cmp,
        bitset_stats_and_or_cmp, bitset_stats_andn_or_cmp,
        bitset_stats_or_and_cmp): Likewise.
        * lib/ebitset.c (ebitset_elt_zero_p, ebitset_equal_p, ebitset_copy_cmp,
        ebitset_test, ebitset_empty_p, ebitset_subset_p, ebitset_disjoint_p,
        ebitset_op3_cmp, ebitset_and_cmp, ebitset_andn_cmp, ebitset_or_cmp,
        ebitset_xor_cmp): Likewise.
        * lib/lbitset.c (lbitset_elt_zero_p, lbitset_equal_p, lbitset_copy_cmp,
        lbitset_test, lbitset_empty_p, lbitset_subset_p, lbitset_disjoint_p,
        lbitset_op3_cmp, lbitset_and_cmp, lbitset_andn_cmp, lbitset_or_cmp,
        lbitset_xor_cmp): Likewise.
        * lib/bbitset.h: Include <stdbool.h>.
        (struct bitset_vtable): The following members now return bool, not
        int: toggle, test, empty_p, disjoint_p, equal_p, subset_p,
        and_cmp, andn_cmp, or_cmp, xor_cmp, and_or_cmp, andn_or_cmp,
        or_and_cmp).
        * src/conflicts.c (count_rr_conflicts): Likewise.
        * lib/bitset_stats.h (bitset_stats_enabled): Now bool, not int.
        All uses changed.
        * lib/ebitset.c (ebitset_obstack_init): Likewise.
        * lib/lbitset.c (lbitset_obstack_init): Likewise.
        * src/getargs.c (debug_flag, defines_flag, locations_flag,
        no_lines_flag, no_parser_flag, token_table_flag, yacc_flag,
        graph_flag): Likewise.
        * src/getargs.h (debug_flag, defines_flag, locations_flag,
        no_lines_flag, no_parser_flag, token_table_flag, yacc_flag,
        graph_flag): Likewise.
        * src/output.c (error_verbose): Likewise.
        * src/output.h (error_verbose): Likewise.
        * src/reader.c (start_flag, typed): Likewise.
        * src/reader.h (typed): Likewise.
        * src/getargs.c (LOCATIONS_OPTION): New constant.
        (long_options, getargs): Use it.
        * src/lalr.c (build_relations): Use bool, not int.
        * src/nullable.c (nullable_compute): Likewise.
        * src/print.c (print_reductions): Likewise.
        * src/tables.c (action_row, pack_vector): Likewise.
        * src/muscle_tab.h (MUSCLE_INSERT_BOOL): New macro.
        * src/output.c (prepare): Use it.
        * src/output.c (token_definitions_output,
        symbol_destructors_output, symbol_destructors_output): Use string,
        not boolean integer, to keep track of whether to output separator.
        * src/print_graph.c (print_core): Likewise.
        * src/state.c (state_rule_lookaheads_print): Likewise.

Index: lib/abitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/abitset.c,v
retrieving revision 1.6
diff -p -u -r1.6 abitset.c
--- lib/abitset.c       16 Oct 2002 06:15:02 -0000      1.6
+++ lib/abitset.c       24 May 2003 00:28:28 -0000
@@ -123,14 +123,14 @@ abitset_reset (bitset dst ATTRIBUTE_UNUS
 
 
 /* Test bit BITNO in bitset SRC.  */
-static int
+static bool
 abitset_test (bitset src ATTRIBUTE_UNUSED,
              bitset_bindex bitno ATTRIBUTE_UNUSED)
 {
   /* This should never occur for abitsets since we should always
      hit the cache.  */
   abort ();
-  return 0;
+  return false;
 }
 
 
@@ -336,7 +336,7 @@ abitset_zero (bitset dst)
 }
 
 
-static int
+static bool
 abitset_empty_p (bitset dst)
 {
   bitset_windex i;
@@ -344,9 +344,9 @@ abitset_empty_p (bitset dst)
 
   for (i = 0; i < dst->b.csize; i++)
     if (dstp[i])
-      return 0;
+      return false;
 
-  return 1;
+  return true;
 }
 
 
@@ -377,7 +377,7 @@ abitset_not (bitset dst, bitset src)
 }
 
 
-static int
+static bool
 abitset_equal_p (bitset dst, bitset src)
 {
   bitset_windex i;
@@ -387,12 +387,12 @@ abitset_equal_p (bitset dst, bitset src)
 
   for (i = 0; i < size; i++)
       if (*srcp++ != *dstp++)
-         return 0;
-  return 1;
+         return false;
+  return true;
 }
 
 
-static int
+static bool
 abitset_subset_p (bitset dst, bitset src)
 {
   bitset_windex i;
@@ -402,12 +402,12 @@ abitset_subset_p (bitset dst, bitset src
 
   for (i = 0; i < size; i++, dstp++, srcp++)
       if (*dstp != (*srcp | *dstp))
-         return 0;
-  return 1;
+         return false;
+  return true;
 }
 
 
-static int
+static bool
 abitset_disjoint_p (bitset dst, bitset src)
 {
   bitset_windex i;
@@ -417,9 +417,9 @@ abitset_disjoint_p (bitset dst, bitset s
 
   for (i = 0; i < size; i++)
       if (*srcp++ & *dstp++)
-         return 0;
+         return false;
 
-  return 1;
+  return true;
 }
 
 
@@ -437,11 +437,11 @@ abitset_and (bitset dst, bitset src1, bi
 }
 
 
-static int
+static bool
 abitset_and_cmp (bitset dst, bitset src1, bitset src2)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *dstp = ABITSET_WORDS (dst);
@@ -453,7 +453,7 @@ abitset_and_cmp (bitset dst, bitset src1
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
@@ -475,11 +475,11 @@ abitset_andn (bitset dst, bitset src1, b
 }
 
 
-static int
+static bool
 abitset_andn_cmp (bitset dst, bitset src1, bitset src2)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *dstp = ABITSET_WORDS (dst);
@@ -491,7 +491,7 @@ abitset_andn_cmp (bitset dst, bitset src
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
@@ -513,11 +513,11 @@ abitset_or (bitset dst, bitset src1, bit
 }
 
 
-static int
+static bool
 abitset_or_cmp (bitset dst, bitset src1, bitset src2)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *dstp = ABITSET_WORDS (dst);
@@ -529,7 +529,7 @@ abitset_or_cmp (bitset dst, bitset src1,
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
@@ -551,11 +551,11 @@ abitset_xor (bitset dst, bitset src1, bi
 }
 
 
-static int
+static bool
 abitset_xor_cmp (bitset dst, bitset src1, bitset src2)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *dstp = ABITSET_WORDS (dst);
@@ -567,7 +567,7 @@ abitset_xor_cmp (bitset dst, bitset src1
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
@@ -590,11 +590,11 @@ abitset_and_or (bitset dst, bitset src1,
 }
 
 
-static int
+static bool
 abitset_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *src3p = ABITSET_WORDS (src3);
@@ -607,7 +607,7 @@ abitset_and_or_cmp (bitset dst, bitset s
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
@@ -630,11 +630,11 @@ abitset_andn_or (bitset dst, bitset src1
 }
 
 
-static int
+static bool
 abitset_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *src3p = ABITSET_WORDS (src3);
@@ -647,7 +647,7 @@ abitset_andn_or_cmp (bitset dst, bitset 
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
@@ -670,11 +670,11 @@ abitset_or_and (bitset dst, bitset src1,
 }
 
 
-static int
+static bool
 abitset_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   bitset_windex i;
-  int changed = 0;
+  bool changed = false;
   bitset_word *src1p = ABITSET_WORDS (src1);
   bitset_word *src2p = ABITSET_WORDS (src2);
   bitset_word *src3p = ABITSET_WORDS (src3);
@@ -687,7 +687,7 @@ abitset_or_and_cmp (bitset dst, bitset s
 
       if (*dstp != tmp)
        {
-         changed = 1;
+         changed = true;
          *dstp = tmp;
        }
     }
Index: lib/bbitset.h
===================================================================
RCS file: /cvsroot/bison/bison/lib/bbitset.h,v
retrieving revision 1.11
diff -p -u -r1.11 bbitset.h
--- lib/bbitset.h       12 Mar 2003 23:01:22 -0000      1.11
+++ lib/bbitset.h       24 May 2003 00:28:28 -0000
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suit
 
 #include "libiberty.h"
 
+#include <stdbool.h>
 #include <limits.h>
 
 /* Currently we support three flavours of bitsets:
@@ -97,36 +98,36 @@ struct bitset_vtable
 {
   void (*set) PARAMS ((bitset, bitset_bindex));
   void (*reset) PARAMS ((bitset, bitset_bindex));
-  int (*toggle) PARAMS ((bitset, bitset_bindex));
-  int (*test) PARAMS ((bitset, bitset_bindex));
+  bool (*toggle) PARAMS ((bitset, bitset_bindex));
+  bool (*test) PARAMS ((bitset, bitset_bindex));
   bitset_bindex (*size) PARAMS ((bitset));
   bitset_bindex (*count) PARAMS ((bitset));
 
-  int (*empty_p) PARAMS ((bitset));
+  bool (*empty_p) PARAMS ((bitset));
   void (*ones) PARAMS ((bitset));
   void (*zero) PARAMS ((bitset));
 
   void (*copy) PARAMS ((bitset, bitset));
-  int (*disjoint_p) PARAMS ((bitset, bitset));
-  int (*equal_p) PARAMS ((bitset, bitset));
+  bool (*disjoint_p) PARAMS ((bitset, bitset));
+  bool (*equal_p) PARAMS ((bitset, bitset));
   void (*not) PARAMS ((bitset, bitset));
-  int (*subset_p) PARAMS ((bitset, bitset));
+  bool (*subset_p) PARAMS ((bitset, bitset));
 
   void (*and) PARAMS ((bitset, bitset, bitset));
-  int (*and_cmp) PARAMS ((bitset, bitset, bitset));
+  bool (*and_cmp) PARAMS ((bitset, bitset, bitset));
   void (*andn) PARAMS ((bitset, bitset, bitset));
-  int (*andn_cmp) PARAMS ((bitset, bitset, bitset));
+  bool (*andn_cmp) PARAMS ((bitset, bitset, bitset));
   void (*or) PARAMS ((bitset, bitset, bitset));
-  int (*or_cmp) PARAMS ((bitset, bitset, bitset));
+  bool (*or_cmp) PARAMS ((bitset, bitset, bitset));
   void (*xor) PARAMS ((bitset, bitset, bitset));
-  int (*xor_cmp) PARAMS ((bitset, bitset, bitset));
+  bool (*xor_cmp) PARAMS ((bitset, bitset, bitset));
 
   void (*and_or) PARAMS ((bitset, bitset, bitset, bitset));
-  int (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
+  bool (*and_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
   void (*andn_or) PARAMS ((bitset, bitset, bitset, bitset));
-  int (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
+  bool (*andn_or_cmp) PARAMS ((bitset, bitset, bitset, bitset));
   void (*or_and) PARAMS ((bitset, bitset, bitset, bitset));
-  int (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
+  bool (*or_and_cmp) PARAMS ((bitset, bitset, bitset, bitset));
 
   bitset_bindex (*list) PARAMS ((bitset, bitset_bindex *,
                                 bitset_bindex, bitset_bindex *));
@@ -259,22 +260,22 @@ if (!BITSET_COMPATIBLE_ (DST, SRC1) || !
 
 /* Private functions for bitset implementations.  */
 
-extern int bitset_toggle_ PARAMS ((bitset, bitset_bindex));
+extern bool bitset_toggle_ PARAMS ((bitset, bitset_bindex));
 
 extern bitset_bindex bitset_count_ PARAMS ((bitset));
 
-extern int bitset_copy_ PARAMS ((bitset, bitset));
+extern bool bitset_copy_ PARAMS ((bitset, bitset));
 
 extern void bitset_and_or_ PARAMS ((bitset, bitset, bitset, bitset));
 
-extern int bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
+extern bool bitset_and_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
 
 extern void bitset_andn_or_ PARAMS ((bitset, bitset, bitset, bitset));
 
-extern int bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
+extern bool bitset_andn_or_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
 
 extern void bitset_or_and_ PARAMS ((bitset, bitset, bitset, bitset));
 
-extern int bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
+extern bool bitset_or_and_cmp_ PARAMS ((bitset, bitset, bitset, bitset));
 
 #endif /* _BBITSET_H  */
Index: lib/bitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset.c,v
retrieving revision 1.8
diff -p -u -r1.8 bitset.c
--- lib/bitset.c        16 Oct 2002 06:18:00 -0000      1.8
+++ lib/bitset.c        24 May 2003 00:28:28 -0000
@@ -253,22 +253,22 @@ bitset_last (bitset src)
 }
 
 
-/* Return non-zero if BITNO in SRC is the only set bit.  */
-int
+/* Is BITNO in SRC the only set bit?  */
+bool
 bitset_only_set_p (bitset src, bitset_bindex bitno)
 {
   bitset_bindex val[2];
   bitset_bindex next = 0;
 
   if (bitset_list (src, val, 2, &next) != 1)
-    return 0;
+    return false;
   return val[0] == bitno;
 }
 
 
 /* Print contents of bitset BSET to FILE.   */
 static void
-bitset_print (FILE *file, bitset bset, int verbose)
+bitset_print (FILE *file, bitset bset, bool verbose)
 {
   unsigned int pos;
   bitset_bindex i;
@@ -300,7 +300,7 @@ bitset_print (FILE *file, bitset bset, i
 void
 bitset_dump (FILE *file, bitset bset)
 {
-  bitset_print (file, bset, 0);
+  bitset_print (file, bset, false);
 }
 
 
@@ -315,8 +315,8 @@ bitset_release_memory (void)
 
 
 
-/* Toggle bit BITNO in bitset BSET and return non-zero if not set.  */
-int
+/* Toggle bit BITNO in bitset BSET and the new value of the bit.  */
+bool
 bitset_toggle_ (bitset bset, bitset_bindex bitno)
 {
   /* This routine is for completeness.  It could be optimized if
@@ -324,12 +324,12 @@ bitset_toggle_ (bitset bset, bitset_bind
   if (bitset_test (bset, bitno))
     {
       bitset_reset (bset, bitno);
-      return 0;
+      return false;
     }
   else
     {
       bitset_set (bset, bitno);
-      return 1;
+      return true;
     }
 }
 
@@ -356,10 +356,10 @@ bitset_count_ (bitset src)
 }
 
 
-/* DST = SRC.  Return non-zero if DST != SRC.
+/* DST = SRC.  Return true if DST != SRC.
    This is a fallback for the case where SRC and DST are different
    bitset types.  */
-int
+bool
 bitset_copy_ (bitset dst, bitset src)
 {
   bitset_bindex i;
@@ -373,23 +373,23 @@ bitset_copy_ (bitset dst, bitset src)
      bitset_set (dst, i);
   };
 
-  return 1;
+  return true;
 }
 
 
 /* This is a fallback for implementations that do not support
    four operand operations.  */
-static inline int
+static inline bool
 bitset_op4_cmp (bitset dst, bitset src1, bitset src2, bitset src3,
                enum bitset_ops op)
 {
-  int changed = 0;
-  int stats_enabled_save;
+  bool changed = false;
+  bool stats_enabled_save;
   bitset tmp;
 
   /* Create temporary bitset.  */
   stats_enabled_save = bitset_stats_enabled;
-  bitset_stats_enabled = 0;
+  bitset_stats_enabled = false;
   tmp = bitset_alloc (0, bitset_type_get (dst));
   bitset_stats_enabled = stats_enabled_save;
 
@@ -429,7 +429,7 @@ bitset_and_or_ (bitset dst, bitset src1,
 
 /* DST = (SRC1 & SRC2) | SRC3.  Return non-zero if
    DST != (SRC1 & SRC2) | SRC3.  */
-int
+bool
 bitset_and_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_AND_OR);
@@ -446,7 +446,7 @@ bitset_andn_or_ (bitset dst, bitset src1
 
 /* DST = (SRC1 & ~SRC2) | SRC3.  Return non-zero if
    DST != (SRC1 & ~SRC2) | SRC3.  */
-int
+bool
 bitset_andn_or_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_ANDN_OR);
@@ -463,7 +463,7 @@ bitset_or_and_ (bitset dst, bitset src1,
 
 /* DST = (SRC1 | SRC2) & SRC3.  Return non-zero if
    DST != (SRC1 | SRC2) & SRC3.  */
-int
+bool
 bitset_or_and_cmp_ (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   return bitset_op4_cmp (dst, src1, src2, src3, BITSET_OP_OR_AND);
@@ -475,5 +475,5 @@ void
 debug_bitset (bitset bset)
 {
   if (bset)
-    bitset_print (stderr, bset, 1);
+    bitset_print (stderr, bset, true);
 }
Index: lib/bitset.h
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset.h,v
retrieving revision 1.13
diff -p -u -r1.13 bitset.h
--- lib/bitset.h        5 May 2003 20:39:04 -0000       1.13
+++ lib/bitset.h        24 May 2003 00:28:28 -0000
@@ -160,7 +160,7 @@ bitset_reset (bitset bset, bitset_bindex
 
 
 /* Test bit BITNO in bitset BSET.  */
-static inline int
+static inline bool
 bitset_test (bitset bset, bitset_bindex bitno)
 {
   bitset_windex windex = bitno / BITSET_WORD_BITS;
@@ -290,7 +290,7 @@ extern bitset_bindex bitset_first PARAMS
 extern bitset_bindex bitset_last PARAMS ((bitset));
 
 /* Return nonzero if this is the only set bit.  */
-extern int bitset_only_set_p PARAMS ((bitset, bitset_bindex));
+extern bool bitset_only_set_p PARAMS ((bitset, bitset_bindex));
 
 /* Dump bitset.  */
 extern void bitset_dump PARAMS ((FILE *, bitset));
Index: lib/bitset_stats.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset_stats.c,v
retrieving revision 1.9
diff -p -u -r1.9 bitset_stats.c
--- lib/bitset_stats.c  5 Jan 2003 01:11:03 -0000       1.9
+++ lib/bitset_stats.c  24 May 2003 00:28:29 -0000
@@ -100,7 +100,7 @@ struct bitset_stats_info_struct
 
 struct bitset_stats_info_struct bitset_stats_info_data;
 struct bitset_stats_info_struct *bitset_stats_info;
-int bitset_stats_enabled = 0;
+bool bitset_stats_enabled = false;
 
 
 /* Print a percentage histogram with message MSG to FILE.  */
@@ -203,7 +203,7 @@ bitset_stats_print_1 (FILE *file, const 
 
 /* Print all bitset statistics to FILE.  */
 static void
-bitset_stats_print (FILE *file, int verbose ATTRIBUTE_UNUSED)
+bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
 {
   int i;
 
@@ -227,14 +227,14 @@ bitset_stats_enable (void)
 {
   if (!bitset_stats_info)
     bitset_stats_info = &bitset_stats_info_data;
-  bitset_stats_enabled = 1;
+  bitset_stats_enabled = true;
 }
 
 
 void
 bitset_stats_disable (void)
 {
-  bitset_stats_enabled = 0;
+  bitset_stats_enabled = false;
 }
 
 
@@ -298,7 +298,7 @@ bitset_stats_write (const char *filename
 void
 bitset_stats_dump (FILE *file)
 {
-  bitset_stats_print (file, 0);
+  bitset_stats_print (file, false);
 }
 
 
@@ -306,7 +306,7 @@ bitset_stats_dump (FILE *file)
 void
 debug_bitset_stats (void)
 {
-  bitset_stats_print (stderr, 1);
+  bitset_stats_print (stderr, true);
 }
 
 
@@ -349,14 +349,14 @@ bitset_stats_reset (bitset dst, bitset_b
 }
 
 
-static int
+static bool
 bitset_stats_toggle (bitset src, bitset_bindex bitno)
 {
     return BITSET_TOGGLE_ (src->s.bset, bitno);
 }
 
 
-static int
+static bool
 bitset_stats_test (bitset src, bitset_bindex bitno)
 {
   bitset bset = src->s.bset;
@@ -389,7 +389,7 @@ bitset_stats_count (bitset src)
 }
 
 
-static int
+static bool
 bitset_stats_empty_p (bitset dst)
 {
   return BITSET_EMPTY_P_ (dst->s.bset);
@@ -418,7 +418,7 @@ bitset_stats_copy (bitset dst, bitset sr
 }
 
 
-static int
+static bool
 bitset_stats_disjoint_p (bitset dst, bitset src)
 {
   BITSET_CHECK2_ (dst, src);
@@ -426,7 +426,7 @@ bitset_stats_disjoint_p (bitset dst, bit
 }
 
 
-static int
+static bool
 bitset_stats_equal_p (bitset dst, bitset src)
 {
   BITSET_CHECK2_ (dst, src);
@@ -442,7 +442,7 @@ bitset_stats_not (bitset dst, bitset src
 }
 
 
-static int
+static bool
 bitset_stats_subset_p (bitset dst, bitset src)
 {
   BITSET_CHECK2_ (dst, src);
@@ -458,7 +458,7 @@ bitset_stats_and (bitset dst, bitset src
 }
 
 
-static int
+static bool
 bitset_stats_and_cmp (bitset dst, bitset src1, bitset src2)
 {
   BITSET_CHECK3_ (dst, src1, src2);
@@ -474,7 +474,7 @@ bitset_stats_andn (bitset dst, bitset sr
 }
 
 
-static int
+static bool
 bitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2)
 {
   BITSET_CHECK3_ (dst, src1, src2);
@@ -490,7 +490,7 @@ bitset_stats_or (bitset dst, bitset src1
 }
 
 
-static int
+static bool
 bitset_stats_or_cmp (bitset dst, bitset src1, bitset src2)
 {
   BITSET_CHECK3_ (dst, src1, src2);
@@ -506,7 +506,7 @@ bitset_stats_xor (bitset dst, bitset src
 }
 
 
-static int
+static bool
 bitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2)
 {
   BITSET_CHECK3_ (dst, src1, src2);
@@ -523,7 +523,7 @@ bitset_stats_and_or (bitset dst, bitset 
 }
 
 
-static int
+static bool
 bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   BITSET_CHECK4_ (dst, src1, src2, src3);
@@ -541,7 +541,7 @@ bitset_stats_andn_or (bitset dst, bitset
 }
 
 
-static int
+static bool
 bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   BITSET_CHECK4_ (dst, src1, src2, src3);
@@ -559,7 +559,7 @@ bitset_stats_or_and (bitset dst, bitset 
 }
 
 
-static int
+static bool
 bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3)
 {
   BITSET_CHECK4_ (dst, src1, src2, src3);
Index: lib/bitset_stats.h
===================================================================
RCS file: /cvsroot/bison/bison/lib/bitset_stats.h,v
retrieving revision 1.4
diff -p -u -r1.4 bitset_stats.h
--- lib/bitset_stats.h  16 Oct 2002 06:22:04 -0000      1.4
+++ lib/bitset_stats.h  24 May 2003 00:28:29 -0000
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suit
 
 #include "bbitset.h"
 
-extern int bitset_stats_enabled;
+extern bool bitset_stats_enabled;
 
 extern enum bitset_type bitset_stats_type_get PARAMS ((bitset));
 
Index: lib/ebitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/ebitset.c,v
retrieving revision 1.10
diff -p -u -r1.10 ebitset.c
--- lib/ebitset.c       16 Oct 2002 06:26:31 -0000      1.10
+++ lib/ebitset.c       24 May 2003 00:28:29 -0000
@@ -88,7 +88,7 @@ static ebitset_elt ebitset_zero_elts[1];
 
 /* Obstack to allocate bitset elements from.  */
 static struct obstack ebitset_obstack;
-static int ebitset_obstack_init = 0;
+static bool ebitset_obstack_init = false;
 static ebitset_elt *ebitset_free_list; /* Free list of bitset elements.  */
 
 #define EBITSET_ELTS(BSET) ((BSET)->e.elts)
@@ -154,7 +154,7 @@ ebitset_elt_alloc (void)
     {
       if (!ebitset_obstack_init)
        {
-         ebitset_obstack_init = 1;
+         ebitset_obstack_init = true;
 
          /* Let particular systems override the size of a chunk.  */
 
@@ -242,17 +242,17 @@ ebitset_elt_add (bitset bset, ebitset_el
 }
 
 
-/* Return nonzero if all bits in an element are zero.  */
-static inline int
+/* Are all bits in an element zero?  */
+static inline bool
 ebitset_elt_zero_p (ebitset_elt *elt)
 {
   int i;
 
   for (i = 0; i < EBITSET_ELT_WORDS; i++)
     if (EBITSET_WORDS (elt)[i])
-      return 0;
+      return false;
 
-  return 1;
+  return true;
 }
 
 
@@ -402,7 +402,7 @@ ebitset_zero (bitset bset)
 }
 
 
-static inline int
+static inline bool
 ebitset_equal_p (bitset dst, bitset src)
 {
   ebitset_elts *selts;
@@ -410,13 +410,13 @@ ebitset_equal_p (bitset dst, bitset src)
   bitset_windex j;
 
   if (src == dst)
-    return 1;
+    return true;
 
   ebitset_weed (dst);
   ebitset_weed (src);
 
   if (EBITSET_SIZE (src) != EBITSET_SIZE (dst))
-    return 0;
+    return false;
 
   selts = EBITSET_ELTS (src);
   delts = EBITSET_ELTS (dst);
@@ -430,13 +430,13 @@ ebitset_equal_p (bitset dst, bitset src)
       if (!selt && !delt)
        continue;
       if ((selt && !delt) || (!selt && delt))
-       return 0;
+       return false;
 
       for (i = 0; i < EBITSET_ELT_WORDS; i++)
        if (EBITSET_WORDS (selt)[i] != EBITSET_WORDS (delt)[i])
-         return 0;
+         return false;
     }
-  return 1;
+  return true;
 }
 
 
@@ -476,13 +476,13 @@ ebitset_copy_ (bitset dst, bitset src)
 }
 
 
-/* Copy bits from bitset SRC to bitset DST.  Return non-zero if
+/* Copy bits from bitset SRC to bitset DST.  Return true if
    bitsets different.  */
-static inline int
+static inline bool
 ebitset_copy_cmp (bitset dst, bitset src)
 {
   if (src == dst)
-    return 0;
+    return false;
 
   if (EBITSET_ZERO_P (dst))
     {
@@ -491,10 +491,10 @@ ebitset_copy_cmp (bitset dst, bitset src
     }
 
   if (ebitset_equal_p (dst, src))
-    return 0;
+    return false;
 
   ebitset_copy_ (dst, src);
-  return 1;
+  return true;
 }
 
 
@@ -539,16 +539,15 @@ ebitset_reset (bitset dst, bitset_bindex
 
 
 /* Test bit BITNO in bitset SRC.  */
-static int
+static bool
 ebitset_test (bitset src, bitset_bindex bitno)
 {
   bitset_windex windex = bitno / BITSET_WORD_BITS;
 
-  if (!ebitset_elt_find (src, windex, EBITSET_FIND))
-    return 0;
-
-  return (src->b.
-         cdata[windex - src->b.cindex] >> (bitno % BITSET_WORD_BITS)) & 1;
+  return (ebitset_elt_find (src, windex, EBITSET_FIND)
+         && ((src->b.cdata[windex - src->b.cindex]
+              >> (bitno % BITSET_WORD_BITS))
+             & 1));
 }
 
 
@@ -808,7 +807,7 @@ ebitset_ones (bitset dst)
 }
 
 
-static int
+static bool
 ebitset_empty_p (bitset dst)
 {
   return !ebitset_weed (dst);
@@ -839,8 +838,8 @@ ebitset_not (bitset dst, bitset src)
 }
 
 
-/* Return 1 if DST == DST | SRC.  */
-static int
+/* Is DST == DST | SRC?  */
+static bool
 ebitset_subset_p (bitset dst, bitset src)
 {
   bitset_windex j;
@@ -875,14 +874,14 @@ ebitset_subset_p (bitset dst, bitset src
       for (i = 0; i < EBITSET_ELT_WORDS; i++)
        if (EBITSET_WORDS (delt)[i]
            != (EBITSET_WORDS (selt)[i] | EBITSET_WORDS (delt)[i]))
-         return 0;
+         return false;
     }
-  return 1;
+  return true;
 }
 
 
-/* Return 1 if DST & SRC == 0.  */
-static int
+/* Is DST & SRC == 0?  */
+static bool
 ebitset_disjoint_p (bitset dst, bitset src)
 {
   bitset_windex j;
@@ -911,14 +910,14 @@ ebitset_disjoint_p (bitset dst, bitset s
 
       for (i = 0; i < EBITSET_ELT_WORDS; i++)
        if ((EBITSET_WORDS (selt)[i] & EBITSET_WORDS (delt)[i]))
-         return 0;
+         return false;
     }
-  return 1;
+  return true;
 }
 
 
 
-static int
+static bool
 ebitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
 {
   bitset_windex ssize1;
@@ -931,7 +930,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
   bitset_word *srcp1;
   bitset_word *srcp2;
   bitset_word *dstp;
-  int changed = 0;
+  bool changed = false;
   unsigned int i;
   bitset_windex j;
 
@@ -963,7 +962,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
        {
          if (delt)
            {
-             changed = 1;
+             changed = true;
              ebitset_elt_remove (dst, j);
            }
          continue;
@@ -990,7 +989,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1003,7 +1002,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1016,7 +1015,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1029,7 +1028,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1054,7 +1053,7 @@ ebitset_op3_cmp (bitset dst, bitset src1
     {
       ebitset_elt *delt;
 
-      changed = 1;
+      changed = true;
 
       delt = delts[j];
 
@@ -1067,10 +1066,10 @@ ebitset_op3_cmp (bitset dst, bitset src1
 }
 
 
-static int
+static bool
 ebitset_and_cmp (bitset dst, bitset src1, bitset src2)
 {
-  int changed;
+  bool changed;
 
   if (EBITSET_ZERO_P (src2))
     {
@@ -1097,10 +1096,10 @@ ebitset_and (bitset dst, bitset src1, bi
 }
 
 
-static int
+static bool
 ebitset_andn_cmp (bitset dst, bitset src1, bitset src2)
 {
-  int changed;
+  bool changed;
 
   if (EBITSET_ZERO_P (src2))
     {
@@ -1124,7 +1123,7 @@ ebitset_andn (bitset dst, bitset src1, b
 }
 
 
-static int
+static bool
 ebitset_or_cmp (bitset dst, bitset src1, bitset src2)
 {
   if (EBITSET_ZERO_P (src2))
@@ -1146,7 +1145,7 @@ ebitset_or (bitset dst, bitset src1, bit
 }
 
 
-static int
+static bool
 ebitset_xor_cmp (bitset dst, bitset src1, bitset src2)
 {
   if (EBITSET_ZERO_P (src2))
@@ -1253,7 +1252,7 @@ ebitset_release_memory (void)
   ebitset_free_list = 0;
   if (ebitset_obstack_init)
     {
-      ebitset_obstack_init = 0;
+      ebitset_obstack_init = false;
       obstack_free (&ebitset_obstack, NULL);
     }
 }
Index: lib/lbitset.c
===================================================================
RCS file: /cvsroot/bison/bison/lib/lbitset.c,v
retrieving revision 1.10
diff -p -u -r1.10 lbitset.c
--- lib/lbitset.c       16 Oct 2002 06:27:59 -0000      1.10
+++ lib/lbitset.c       24 May 2003 00:28:29 -0000
@@ -71,7 +71,7 @@ static lbitset_elt lbitset_zero_elts[3];
 
 /* Obstack to allocate bitset elements from.  */
 static struct obstack lbitset_obstack;
-static int lbitset_obstack_init = 0;
+static bool lbitset_obstack_init = false;
 static lbitset_elt *lbitset_free_list; /* Free list of bitset elements.  */
 
 extern void debug_lbitset PARAMS ((bitset));
@@ -99,7 +99,7 @@ lbitset_elt_alloc (void)
     {
       if (!lbitset_obstack_init)
        {
-         lbitset_obstack_init = 1;
+         lbitset_obstack_init = true;
 
          /* Let particular systems override the size of a chunk.  */
 
@@ -236,17 +236,17 @@ lbitset_prune (bitset bset, lbitset_elt 
 }
 
 
-/* Return nonzero if all bits in an element are zero.  */
-static inline int
+/* Are all bits in an element zero?  */
+static inline bool
 lbitset_elt_zero_p (lbitset_elt *elt)
 {
   int i;
 
   for (i = 0; i < LBITSET_ELT_WORDS; i++)
     if (elt->words[i])
-      return 0;
+      return false;
 
-  return 1;
+  return true;
 }
 
 
@@ -412,8 +412,8 @@ lbitset_zero (bitset bset)
 }
 
 
-/* Return 1 if DST == SRC.  */
-static inline int
+/* Is DST == SRC?  */
+static inline bool
 lbitset_equal_p (bitset dst, bitset src)
 {
   lbitset_elt *selt;
@@ -421,7 +421,7 @@ lbitset_equal_p (bitset dst, bitset src)
   int j;
 
   if (src == dst)
-    return 1;
+    return true;
 
   lbitset_weed (src);
   lbitset_weed (dst);
@@ -429,11 +429,11 @@ lbitset_equal_p (bitset dst, bitset src)
        selt && delt; selt = selt->next, delt = delt->next)
     {
       if (selt->index != delt->index)
-       return 0;
+       return false;
 
       for (j = 0; j < LBITSET_ELT_WORDS; j++)
        if (delt->words[j] != selt->words[j])
-         return 0;
+         return false;
     }
   return !selt && !delt;
 }
@@ -480,13 +480,13 @@ lbitset_copy (bitset dst, bitset src)
 }
 
 
-/* Copy bits from bitset SRC to bitset DST.  Return non-zero if
+/* Copy bits from bitset SRC to bitset DST.  Return true if
    bitsets different.  */
-static inline int
+static inline bool
 lbitset_copy_cmp (bitset dst, bitset src)
 {
   if (src == dst)
-    return 0;
+    return false;
 
   if (!LBITSET_HEAD (dst))
     {
@@ -495,10 +495,10 @@ lbitset_copy_cmp (bitset dst, bitset src
     }
 
   if (lbitset_equal_p (dst, src))
-    return 0;
+    return false;
 
   lbitset_copy (dst, src);
-  return 1;
+  return true;
 }
 
 
@@ -547,16 +547,15 @@ lbitset_reset (bitset dst, bitset_bindex
 
 
 /* Test bit BITNO in bitset SRC.  */
-static int
+static bool
 lbitset_test (bitset src, bitset_bindex bitno)
 {
   bitset_windex windex = bitno / BITSET_WORD_BITS;
 
-  if (!lbitset_elt_find (src, windex, LBITSET_FIND))
-    return 0;
-
-  return (src->b.cdata[windex - src->b.cindex]
-         >> (bitno % BITSET_WORD_BITS)) & 1;
+  return (lbitset_elt_find (src, windex, LBITSET_FIND)
+         && ((src->b.cdata[windex - src->b.cindex]
+              >> (bitno % BITSET_WORD_BITS))
+             & 1));
 }
 
 
@@ -865,13 +864,11 @@ lbitset_list (bitset bset, bitset_bindex
 }
 
 
-static int
+static bool
 lbitset_empty_p (bitset dst)
 {
   lbitset_weed (dst);
-  if (LBITSET_HEAD (dst))
-      return 0;
-  return 1;
+  return !LBITSET_HEAD (dst);
 }
 
 
@@ -934,8 +931,8 @@ lbitset_not (bitset dst, bitset src)
 }
 
 
-/* Return 1 if DST == DST | SRC.  */
-static int
+/* Is DST == DST | SRC?  */
+static bool
 lbitset_subset_p (bitset dst, bitset src)
 {
   lbitset_elt *selt;
@@ -965,14 +962,14 @@ lbitset_subset_p (bitset dst, bitset src
 
       for (j = 0; j < LBITSET_ELT_WORDS; j++)
        if (delt->words[j] != (selt->words[j] | delt->words[j]))
-         return 0;
+         return false;
     }
-  return 1;
+  return true;
 }
 
 
-/* Return 1 if DST & SRC == 0.  */
-static int
+/* Is DST & SRC == 0?  */
+static bool
 lbitset_disjoint_p (bitset dst, bitset src)
 {
   lbitset_elt *selt;
@@ -1001,13 +998,13 @@ lbitset_disjoint_p (bitset dst, bitset s
 
       for (j = 0; j < LBITSET_ELT_WORDS; j++)
        if (selt->words[j] & delt->words[j])
-         return 0;
+         return false;
     }
-  return 1;
+  return true;
 }
 
 
-static int
+static bool
 lbitset_op3_cmp (bitset dst, bitset src1, bitset src2, enum bitset_ops op)
 {
   lbitset_elt *selt1 = LBITSET_HEAD (src1);
@@ -1022,7 +1019,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
   bitset_word *srcp1;
   bitset_word *srcp2;
   bitset_word *dstp;
-  int changed = 0;
+  bool changed = false;
   unsigned int i;
 
   LBITSET_HEAD (dst) = 0;
@@ -1066,7 +1063,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
         elements that we've skipped.  */
       while (delt && delt->index < windex)
        {
-         changed = 1;
+         changed = true;
          dtmp = delt;
          delt = delt->next;
          lbitset_elt_free (dtmp);
@@ -1093,7 +1090,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1106,7 +1103,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1119,7 +1116,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1132,7 +1129,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
 
              if (*dstp != tmp)
                {
-                 changed = 1;
+                 changed = true;
                  *dstp = tmp;
                }
            }
@@ -1157,7 +1154,7 @@ lbitset_op3_cmp (bitset dst, bitset src1
   /* If we have elements of DST left over, free them all.  */
   if (delt)
     {
-      changed = 1;
+      changed = true;
       lbitset_prune (dst, delt);
     }
 
@@ -1165,12 +1162,12 @@ lbitset_op3_cmp (bitset dst, bitset src1
 }
 
 
-static int
+static bool
 lbitset_and_cmp (bitset dst, bitset src1, bitset src2)
 {
   lbitset_elt *selt1 = LBITSET_HEAD (src1);
   lbitset_elt *selt2 = LBITSET_HEAD (src2);
-  int changed;
+  bool changed;
 
   if (!selt2)
     {
@@ -1197,12 +1194,12 @@ lbitset_and (bitset dst, bitset src1, bi
 }
 
 
-static int
+static bool
 lbitset_andn_cmp (bitset dst, bitset src1, bitset src2)
 {
   lbitset_elt *selt1 = LBITSET_HEAD (src1);
   lbitset_elt *selt2 = LBITSET_HEAD (src2);
-  int changed;
+  bool changed;
 
   if (!selt2)
     {
@@ -1226,7 +1223,7 @@ lbitset_andn (bitset dst, bitset src1, b
 }
 
 
-static int
+static bool
 lbitset_or_cmp (bitset dst, bitset src1, bitset src2)
 {
   lbitset_elt *selt1 = LBITSET_HEAD (src1);
@@ -1251,7 +1248,7 @@ lbitset_or (bitset dst, bitset src1, bit
 }
 
 
-static int
+static bool
 lbitset_xor_cmp (bitset dst, bitset src1, bitset src2)
 {
   lbitset_elt *selt1 = LBITSET_HEAD (src1);
@@ -1337,7 +1334,7 @@ lbitset_release_memory (void)
   lbitset_free_list = 0;
   if (lbitset_obstack_init)
     {
-      lbitset_obstack_init = 0;
+      lbitset_obstack_init = false;
       obstack_free (&lbitset_obstack, NULL);
     }
 }
Index: src/conflicts.c
===================================================================
RCS file: /cvsroot/bison/bison/src/conflicts.c,v
retrieving revision 1.104
diff -p -u -r1.104 conflicts.c
--- src/conflicts.c     18 Apr 2003 05:07:08 -0000      1.104
+++ src/conflicts.c     24 May 2003 00:28:29 -0000
@@ -365,7 +365,7 @@ count_sr_conflicts (state *s)
 +`----------------------------------------------------------------*/
 
 static int
-count_rr_conflicts (state *s, int one_per_token)
+count_rr_conflicts (state *s, bool one_per_token)
 {
   int i;
   reductions *reds = s->reductions;
@@ -463,7 +463,7 @@ conflicts_print (void)
   /* Is the number of SR conflicts OK?  Either EXPECTED_CONFLICTS is
      not set, and then we want 0 SR, or else it is specified, in which
      case we want equality.  */
-  int src_ok = 0;
+  bool src_ok = false;
 
   int src_total = 0;
   int rrc_total = 0;
Index: src/getargs.c
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.c,v
retrieving revision 1.56
diff -p -u -r1.56 getargs.c
--- src/getargs.c       29 Apr 2003 12:57:35 -0000      1.56
+++ src/getargs.c       24 May 2003 00:28:29 -0000
@@ -43,15 +43,15 @@
 #include "getargs.h"
 #include "uniqstr.h"
 
-int debug_flag = 0;
-int defines_flag = 0;
-int locations_flag = 0;
-int no_lines_flag = 0;
-int no_parser_flag = 0;
+bool debug_flag;
+bool defines_flag;
+bool locations_flag;
+bool no_lines_flag;
+bool no_parser_flag;
 int report_flag = report_none;
-int token_table_flag = 0;
-int yacc_flag = 0;     /* for -y */
-int graph_flag = 0;
+bool token_table_flag;
+bool yacc_flag;        /* for -y */
+bool graph_flag;
 int trace_flag = trace_none;
 
 bool nondeterministic_parser = false;
@@ -284,6 +284,12 @@ warranty; not even for MERCHANTABILITY o
 /* Shorts options.  */
 const char *short_options = "yvegdhr:ltknVo:b:p:S:T::";
 
+/* Values for long options that do not have single-letter equivalents.  */
+enum
+{
+  LOCATIONS_OPTION = CHAR_MAX + 1
+};
+
 static struct option const long_options[] =
 {
   /* Operation modes. */
@@ -314,7 +320,7 @@ static struct option const long_options[
 
   /* Parser.  */
   { "debug",         no_argument,               0,   't' },
-  { "locations",      no_argument, &locations_flag,     1 },
+  { "locations",      no_argument,              0, LOCATIONS_OPTION },
   { "no-lines",       no_argument,               0,   'l' },
   { "no-parser",      no_argument,               0,   'n' },
   { "raw",            no_argument,               0,     0 },
@@ -346,7 +352,7 @@ getargs (int argc, char *argv[])
        break;
 
       case 'y':
-       yacc_flag = 1;
+       yacc_flag = true;
        break;
 
       case 'h':
@@ -358,7 +364,7 @@ getargs (int argc, char *argv[])
 
       case 'g':
        /* Here, the -g and --graph=FILE options are differentiated.  */
-       graph_flag = 1;
+       graph_flag = true;
        if (optarg)
          spec_graph_file = AS_FILE_NAME (optarg);
        break;
@@ -377,25 +383,29 @@ getargs (int argc, char *argv[])
 
       case 'd':
        /* Here, the -d and --defines options are differentiated.  */
-       defines_flag = 1;
+       defines_flag = true;
        if (optarg)
          spec_defines_file = AS_FILE_NAME (optarg);
        break;
 
       case 'l':
-       no_lines_flag = 1;
+       no_lines_flag = true;
+       break;
+
+      case LOCATIONS_OPTION:
+       locations_flag = true;
        break;
 
       case 'k':
-       token_table_flag = 1;
+       token_table_flag = true;
        break;
 
       case 'n':
-       no_parser_flag = 1;
+       no_parser_flag = true;
        break;
 
       case 't':
-       debug_flag = 1;
+       debug_flag = true;
        break;
 
       case 'o':
Index: src/getargs.h
===================================================================
RCS file: /cvsroot/bison/bison/src/getargs.h,v
retrieving revision 1.24
diff -p -u -r1.24 getargs.h
--- src/getargs.h       29 Apr 2003 12:57:35 -0000      1.24
+++ src/getargs.h       24 May 2003 00:28:29 -0000
@@ -26,14 +26,14 @@
 extern const char *skeleton;           /* for -S */
 extern const char *include;            /* for -I */
 
-extern int debug_flag;                 /* for -t */
-extern int defines_flag;       /* for -d */
-extern int locations_flag;
-extern int no_lines_flag;      /* for -l */
-extern int no_parser_flag;     /* for -n */
-extern int token_table_flag;           /* for -k */
-extern int graph_flag;         /* for -g */
-extern int yacc_flag;                  /* for -y */
+extern bool debug_flag;                        /* for -t */
+extern bool defines_flag;              /* for -d */
+extern bool locations_flag;
+extern bool no_lines_flag;             /* for -l */
+extern bool no_parser_flag;            /* for -n */
+extern bool token_table_flag;          /* for -k */
+extern bool graph_flag;                        /* for -g */
+extern bool yacc_flag;                 /* for -y */
 
 /* GLR_PARSER is true if the input file says to use the GLR
    (Generalized LR) parser, and to output some additional information
Index: src/lalr.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lalr.c,v
retrieving revision 1.96
diff -p -u -r1.96 lalr.c
--- src/lalr.c  13 Dec 2002 08:26:46 -0000      1.96
+++ src/lalr.c  24 May 2003 00:28:30 -0000
@@ -239,7 +239,7 @@ build_relations (void)
 
       for (rulep = derives[symbol1 - ntokens]; *rulep; rulep++)
        {
-         int done;
+         bool done;
          int length = 1;
          item_number *rp;
          state *s = states[from_state[i]];
@@ -256,10 +256,10 @@ build_relations (void)
            add_lookback_edge (s, *rulep, i);
 
          length--;
-         done = 0;
+         done = false;
          while (!done)
            {
-             done = 1;
+             done = true;
              rp--;
              /* JF added rp>=ritem &&   I hope to god its right! */
              if (rp >= ritem && ISVAR (*rp))
@@ -268,7 +268,7 @@ build_relations (void)
                  edge[nedges++] = map_goto (states1[--length],
                                             item_number_as_symbol_number 
(*rp));
                  if (nullable[*rp - ntokens])
-                   done = 0;
+                   done = false;
                }
            }
        }
Index: src/muscle_tab.h
===================================================================
RCS file: /cvsroot/bison/bison/src/muscle_tab.h,v
retrieving revision 1.11
diff -p -u -r1.11 muscle_tab.h
--- src/muscle_tab.h    3 Feb 2003 15:35:56 -0000       1.11
+++ src/muscle_tab.h    24 May 2003 00:28:30 -0000
@@ -30,6 +30,12 @@ void muscle_free (void);
 /* An obstack dedicated to receive muscle keys and values.  */
 extern struct obstack muscle_obstack;
 
+#define MUSCLE_INSERT_BOOL(Key, Value)                         \
+{                                                              \
+  int v = Value;                                               \
+  MUSCLE_INSERT_INT (Key, v);                                  \
+}
+
 #define MUSCLE_INSERT_INT(Key, Value)                          \
 {                                                              \
   obstack_fgrow1 (&muscle_obstack, "%d", Value);               \
Index: src/nullable.c
===================================================================
RCS file: /cvsroot/bison/bison/src/nullable.c,v
retrieving revision 1.40
diff -p -u -r1.40 nullable.c
--- src/nullable.c      3 Feb 2003 15:35:56 -0000       1.40
+++ src/nullable.c      24 May 2003 00:28:30 -0000
@@ -83,10 +83,10 @@ nullable_compute (void)
          {
            /* This rule has a non empty RHS. */
            item_number *rp = NULL;
-           int any_tokens = 0;
+           bool any_tokens = false;
            for (rp = rules_ruleno->rhs; *rp >= 0; ++rp)
              if (ISTOKEN (*rp))
-               any_tokens = 1;
+               any_tokens = true;
 
            /* This rule has only nonterminals: schedule it for the second
               pass.  */
@@ -108,7 +108,7 @@ nullable_compute (void)
            if (rules_ruleno->useful
                && ! nullable[rules_ruleno->lhs->number - ntokens])
              {
-               nullable[rules_ruleno->lhs->number - ntokens] = 1;
+               nullable[rules_ruleno->lhs->number - ntokens] = true;
                *s2++ = rules_ruleno->lhs->number;
              }
          }
@@ -121,7 +121,7 @@ nullable_compute (void)
        if (--rcount[r->number] == 0)
          if (r->useful && ! nullable[r->lhs->number - ntokens])
            {
-             nullable[r->lhs->number - ntokens] = 1;
+             nullable[r->lhs->number - ntokens] = true;
              *s2++ = r->lhs->number;
            }
       }
Index: src/output.c
===================================================================
RCS file: /cvsroot/bison/bison/src/output.c,v
retrieving revision 1.220
diff -p -u -r1.220 output.c
--- src/output.c        29 Apr 2003 12:57:35 -0000      1.220
+++ src/output.c        24 May 2003 00:28:30 -0000
@@ -45,7 +45,7 @@ void scan_skel (FILE *);
 
 static struct obstack format_obstack;
 
-int error_verbose = 0;
+bool error_verbose = false;
 
 
 
@@ -341,7 +341,7 @@ static void
 token_definitions_output (FILE *out)
 {
   int i;
-  int first = 1;
+  char const *sep = "";
 
   fputs ("m4_define([b4_tokens], \n[", out);
   for (i = 0; i < ntokens; ++i)
@@ -376,9 +376,8 @@ token_definitions_output (FILE *out)
        continue;
 
       fprintf (out, "%s[[[%s]], [%d]]",
-              first ? "" : ",\n", sym->tag, number);
-
-      first = 0;
+              sep, sym->tag, number);
+      sep = ",\n";
     }
   fputs ("])\n\n", out);
 }
@@ -392,7 +391,7 @@ static void
 symbol_destructors_output (FILE *out)
 {
   int i;
-  int first = 1;
+  char const *sep = "";
 
   fputs ("m4_define([b4_symbol_destructors], \n[", out);
   for (i = 0; i < nsyms; ++i)
@@ -403,8 +402,8 @@ symbol_destructors_output (FILE *out)
        /* Filename, lineno,
           Symbol-name, Symbol-number,
           destructor, typename. */
-       fprintf (out, "%s[",
-                first ? "" : ",\n");
+       fprintf (out, "%s[", sep);
+       sep = ",\n";
        escaped_file_name_output (out, sym->destructor_location.start.file);
        fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
                 sym->destructor_location.start.line,
@@ -412,8 +411,6 @@ symbol_destructors_output (FILE *out)
                 sym->number,
                 sym->destructor,
                 sym->type_name);
-
-       first = 0;
       }
   fputs ("])\n\n", out);
 }
@@ -427,7 +424,7 @@ static void
 symbol_printers_output (FILE *out)
 {
   int i;
-  int first = 1;
+  char const *sep = "";
 
   fputs ("m4_define([b4_symbol_printers], \n[", out);
   for (i = 0; i < nsyms; ++i)
@@ -438,8 +435,8 @@ symbol_printers_output (FILE *out)
        /* Filename, lineno,
           Symbol-name, Symbol-number,
           printer, typename. */
-       fprintf (out, "%s[",
-                first ? "" : ",\n");
+       fprintf (out, "%s[", sep);
+       sep = ",\n";
        escaped_file_name_output (out, sym->printer_location.start.file);
        fprintf (out, ", [[%d]], [[%s]], [[%d]], [[%s]], [[%s]]]",
                 sym->printer_location.start.line,
@@ -447,8 +444,6 @@ symbol_printers_output (FILE *out)
                 sym->number,
                 sym->printer,
                 sym->type_name);
-
-       first = 0;
       }
   fputs ("])\n\n", out);
 }
@@ -595,12 +590,12 @@ static void
 prepare (void)
 {
   /* Flags. */
-  MUSCLE_INSERT_INT ("debug", debug_flag);
-  MUSCLE_INSERT_INT ("defines_flag", defines_flag);
-  MUSCLE_INSERT_INT ("error_verbose", error_verbose);
-  MUSCLE_INSERT_INT ("locations_flag", locations_flag);
-  MUSCLE_INSERT_INT ("pure", pure_parser);
-  MUSCLE_INSERT_INT ("synclines_flag", !no_lines_flag);
+  MUSCLE_INSERT_BOOL ("debug", debug_flag);
+  MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
+  MUSCLE_INSERT_BOOL ("error_verbose", error_verbose);
+  MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
+  MUSCLE_INSERT_BOOL ("pure", pure_parser);
+  MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
 
   /* File names.  */
   MUSCLE_INSERT_STRING ("prefix", spec_name_prefix ? spec_name_prefix : "yy");
Index: src/output.h
===================================================================
RCS file: /cvsroot/bison/bison/src/output.h,v
retrieving revision 1.12
diff -p -u -r1.12 output.h
--- src/output.h        21 Oct 2002 05:30:50 -0000      1.12
+++ src/output.h        24 May 2003 00:28:30 -0000
@@ -21,7 +21,7 @@
 #ifndef OUTPUT_H_
 # define OUTPUT_H_
 
-extern int error_verbose;
+extern bool error_verbose;
 
 /* Output the parsing tables and the parser code to FTABLE.  */
 void output (void);
Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.41
diff -p -u -r1.41 parse-gram.y
--- src/parse-gram.y    14 May 2003 19:26:16 -0000      1.41
+++ src/parse-gram.y    24 May 2003 00:28:31 -0000
@@ -175,26 +175,26 @@ declarations:
 declaration:
   grammar_declaration
 | PROLOGUE                                 { prologue_augment ($1, @1); }
-| "%debug"                                 { debug_flag = 1; }
+| "%debug"                                 { debug_flag = true; }
 | "%define" string_content string_content  { muscle_insert ($2, $3); }
-| "%defines"                               { defines_flag = 1; }
-| "%error-verbose"                         { error_verbose = 1; }
+| "%defines"                               { defines_flag = true; }
+| "%error-verbose"                         { error_verbose = true; }
 | "%expect" INT                            { expected_conflicts = $2; }
 | "%file-prefix" "=" string_content        { spec_file_prefix = $3; }
 | "%glr-parser"                           { nondeterministic_parser = true;
                                              glr_parser = true; }
 | "%lex-param {...}"                      { add_param ("lex_param", $1, @1); }
-| "%locations"                             { locations_flag = 1; }
+| "%locations"                             { locations_flag = true; }
 | "%name-prefix" "=" string_content        { spec_name_prefix = $3; }
-| "%no-lines"                              { no_lines_flag = 1; }
+| "%no-lines"                              { no_lines_flag = true; }
 | "%nondeterministic-parser"              { nondeterministic_parser = true; }
 | "%output" "=" string_content             { spec_outfile = $3; }
 | "%parse-param {...}"                  { add_param ("parse_param", $1, @1); }
 | "%pure-parser"                           { pure_parser = true; }
 | "%skeleton" string_content               { skeleton = $2; }
-| "%token-table"                           { token_table_flag = 1; }
+| "%token-table"                           { token_table_flag = true; }
 | "%verbose"                               { report_flag = report_states; }
-| "%yacc"                                  { yacc_flag = 1; }
+| "%yacc"                                  { yacc_flag = true; }
 | ";"
 ;
 
@@ -207,7 +207,7 @@ grammar_declaration:
     }
 | "%union {...}"
     {
-      typed = 1;
+      typed = true;
       MUSCLE_INSERT_INT ("stype_line", @1.start.line);
       muscle_insert ("stype", $1);
     }
Index: src/print.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print.c,v
retrieving revision 1.93
diff -p -u -r1.93 print.c
--- src/print.c 3 Feb 2003 15:35:56 -0000       1.93
+++ src/print.c 24 May 2003 00:28:31 -0000
@@ -327,16 +327,16 @@ print_reductions (FILE *out, state *s)
   if (reds->lookaheads)
     for (i = 0; i < ntokens; i++)
       {
-       int count = bitset_test (shiftset, i);
+       bool count = bitset_test (shiftset, i);
 
        for (j = 0; j < reds->num; ++j)
          if (bitset_test (reds->lookaheads[j], i))
            {
-             if (count == 0)
+             if (! count)
                {
                  if (reds->rules[j] != default_rule)
                    max_length (&width, symbols[i]->tag);
-                 count++;
+                 count = true;
                }
              else
                {
@@ -356,21 +356,21 @@ print_reductions (FILE *out, state *s)
   if (reds->lookaheads)
     for (i = 0; i < ntokens; i++)
       {
-       int defaulted = 0;
-       int count = bitset_test (shiftset, i);
+       bool defaulted = false;
+       bool count = bitset_test (shiftset, i);
 
        for (j = 0; j < reds->num; ++j)
          if (bitset_test (reds->lookaheads[j], i))
            {
-             if (count == 0)
+             if (! count)
                {
                  if (reds->rules[j] != default_rule)
                    print_reduction (out, width,
                                     symbols[i]->tag,
                                     reds->rules[j], true);
                  else
-                   defaulted = 1;
-                 count++;
+                   defaulted = true;
+                 count = true;
                }
              else
                {
@@ -378,7 +378,7 @@ print_reductions (FILE *out, state *s)
                    print_reduction (out, width,
                                     symbols[i]->tag,
                                     default_rule, true);
-                 defaulted = 0;
+                 defaulted = false;
                  print_reduction (out, width,
                                   symbols[i]->tag,
                                   reds->rules[j], false);
Index: src/print_graph.c
===================================================================
RCS file: /cvsroot/bison/bison/src/print_graph.c,v
retrieving revision 1.52
diff -p -u -r1.52 print_graph.c
--- src/print_graph.c   11 Dec 2002 06:43:08 -0000      1.52
+++ src/print_graph.c   24 May 2003 00:28:31 -0000
@@ -100,12 +100,13 @@ print_core (struct obstack *oout, state 
            {
              bitset_iterator biter;
              int k;
-             int not_first = 0;
+             char const *sep = "";
              obstack_sgrow (oout, "[");
              BITSET_FOR_EACH (biter, reds->lookaheads[redno], k, 0)
-               obstack_fgrow2 (oout, "%s%s",
-                               not_first++ ? ", " : "",
-                               symbols[k]->tag);
+               {
+                 obstack_fgrow2 (oout, "%s%s", sep, symbols[k]->tag);
+                 sep = ", ";
+               }
              obstack_sgrow (oout, "]");
            }
        }
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.231
diff -p -u -r1.231 reader.c
--- src/reader.c        3 Feb 2003 15:35:56 -0000       1.231
+++ src/reader.c        24 May 2003 00:28:31 -0000
@@ -36,11 +36,11 @@
 #include "symtab.h"
 
 static symbol_list *grammar = NULL;
-static int start_flag = 0;
+static bool start_flag = false;
 merger_list *merge_functions;
 
-/* Nonzero if %union has been seen.  */
-int typed = 0;
+/* Has %union been seen?  */
+bool typed = false;
 
 /*-----------------------.
 | Set the start symbol.  |
@@ -53,7 +53,7 @@ grammar_start_symbol_set (symbol *sym, l
     complain_at (loc, _("multiple %s declarations"), "%start");
   else
     {
-      start_flag = 1;
+      start_flag = true;
       startsymbol = sym;
       startsymbol_location = loc;
     }
@@ -213,7 +213,7 @@ grammar_rule_begin (symbol *lhs, locatio
     {
       startsymbol = lhs;
       startsymbol_location = loc;
-      start_flag = 1;
+      start_flag = true;
     }
 
   /* Start a new rule and record its lhs.  */
Index: src/reader.h
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.h,v
retrieving revision 1.38
diff -p -u -r1.38 reader.h
--- src/reader.h        3 Feb 2003 15:35:57 -0000       1.38
+++ src/reader.h        24 May 2003 00:28:31 -0000
@@ -72,6 +72,6 @@ void free_merger_functions (void);
 
 extern merger_list *merge_functions;
 
-extern int typed;
+extern bool typed;
 
 #endif /* !READER_H_ */
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.60
diff -p -u -r1.60 scan-gram.l
--- src/scan-gram.l     29 Apr 2003 12:57:36 -0000      1.60
+++ src/scan-gram.l     24 May 2003 00:28:32 -0000
@@ -841,7 +841,7 @@ static inline bool
 handle_action_at (char *text, location loc)
 {
   char *cp = text + 1;
-  locations_flag = 1;
+  locations_flag = true;
 
   if (! current_rule)
     return false;
Index: src/state.c
===================================================================
RCS file: /cvsroot/bison/bison/src/state.c,v
retrieving revision 1.29
diff -p -u -r1.29 state.c
--- src/state.c 3 Feb 2003 15:35:57 -0000       1.29
+++ src/state.c 24 May 2003 00:28:32 -0000
@@ -236,12 +236,13 @@ state_rule_lookaheads_print (state *s, r
     {
       bitset_iterator biter;
       int k;
-      int not_first = 0;
+      char const *sep = "";
       fprintf (out, "  [");
       BITSET_FOR_EACH (biter, reds->lookaheads[red], k, 0)
-       fprintf (out, "%s%s",
-                not_first++ ? ", " : "",
-                symbols[k]->tag);
+       {
+         fprintf (out, "%s%s", sep, symbols[k]->tag);
+         sep = ", ";
+       }
       fprintf (out, "]");
     }
 }
Index: src/tables.c
===================================================================
RCS file: /cvsroot/bison/bison/src/tables.c,v
retrieving revision 1.18
diff -p -u -r1.18 tables.c
--- src/tables.c        29 Apr 2003 12:57:36 -0000      1.18
+++ src/tables.c        24 May 2003 00:28:32 -0000
@@ -243,8 +243,8 @@ action_row (state *s)
   transitions *trans = s->transitions;
   errs *errp = s->errs;
   /* Set to nonzero to inhibit having any default reduction.  */
-  int nodefault = 0;
-  int conflicted = 0;
+  bool nodefault = false;
+  bool conflicted = false;
 
   for (i = 0; i < ntokens; i++)
     actrow[i] = conflrow[i] = 0;
@@ -264,7 +264,10 @@ action_row (state *s)
          /* and record this rule as the rule to use if that
             token follows.  */
          if (actrow[j] != 0)
-           conflicted = conflrow[j] = 1;
+           {
+             conflicted = true;
+             conflrow[j] = 1;
+           }
          actrow[j] = rule_number_as_item_number (reds->rules[i]->number);
        }
     }
@@ -278,13 +281,16 @@ action_row (state *s)
       state *shift_state = trans->states[i];
 
       if (actrow[sym] != 0)
-       conflicted = conflrow[sym] = 1;
+       {
+         conflicted = true;
+         conflrow[sym] = 1;
+       }
       actrow[sym] = state_number_as_int (shift_state->number);
 
       /* Do not use any default reduction if there is a shift for
         error */
       if (sym == errtoken->number)
-       nodefault = 1;
+       nodefault = true;
     }
 
   /* See which tokens are an explicit error in this state (due to
@@ -669,7 +675,7 @@ pack_vector (vector_number vector)
   for (j = lowzero - from[0]; ; j++)
     {
       int k;
-      int ok = 1;
+      bool ok = true;
 
       if (table_size <= j)
        abort ();
@@ -681,12 +687,12 @@ pack_vector (vector_number vector)
            table_grow (loc);
 
          if (table[loc] != 0)
-           ok = 0;
+           ok = false;
        }
 
       for (k = 0; ok && k < vector; k++)
        if (pos[k] == j)
-         ok = 0;
+         ok = false;
 
       if (ok)
        {




reply via email to

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