bison-patches
[Top][All Lists]
Advanced

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

Bison MIN and MAX patches


From: Paul Eggert
Subject: Bison MIN and MAX patches
Date: Fri, 4 Oct 2002 22:51:08 -0700 (PDT)

I installed these minor fixes for the new MIN and MAX macros in Bison.
(The limit-checking will need some more work at some point, I think.)

2002-10-04  Paul Eggert  <address@hidden>

        Fix some MAX and MIN problems.
        * src/gram.h (ITEM_NUMBER_MIN): MIN_MAX -> INT_MIN.
        * src/lalr.h (GOTO_NUMBER_MAX): INT_MAX -> SHRT_MAX.
        * src/symtab.h (SYMBOL_NUMBER_MAX): New macro.
        * src/reader.c (reader): Use it.

Index: src/gram.h
===================================================================
RCS file: /cvsroot/bison/bison/src/gram.h,v
retrieving revision 1.47
diff -p -u -r1.47 gram.h
--- src/gram.h  2 Aug 2002 08:05:01 -0000       1.47
+++ src/gram.h  5 Oct 2002 05:43:07 -0000
@@ -115,7 +115,7 @@ extern int nvars;
 
 typedef int item_number_t;
 # define ITEM_NUMBER_MAX ((item_number_t) INT_MAX)
-# define ITEM_NUMBER_MIN ((item_number_t) MIN_MAX)
+# define ITEM_NUMBER_MIN ((item_number_t) INT_MIN)
 extern item_number_t *ritem;
 extern unsigned int nritems;
 
Index: src/lalr.h
===================================================================
RCS file: /cvsroot/bison/bison/src/lalr.h,v
retrieving revision 1.23
diff -p -u -r1.23 lalr.h
--- src/lalr.h  1 Aug 2002 18:12:11 -0000       1.23
+++ src/lalr.h  5 Oct 2002 05:43:07 -0000
@@ -55,7 +55,7 @@ void lalr_free PARAMS ((void));
    TO_STATE of the first of them.  */
 
 typedef short goto_number_t;
-# define GOTO_NUMBER_MAX ((goto_number_t) INT_MAX)
+# define GOTO_NUMBER_MAX ((goto_number_t) SHRT_MAX)
 
 extern goto_number_t *goto_map;
 extern state_number_t *from_state;
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.209
diff -p -u -r1.209 reader.c
--- src/reader.c        13 Sep 2002 16:12:21 -0000      1.209
+++ src/reader.c        5 Oct 2002 05:43:07 -0000
@@ -541,9 +541,9 @@ reader (void)
     grammar = p;
   }
 
-  if (nsyms > SHRT_MAX)
+  if (SYMBOL_NUMBER_MAX < nsyms)
     fatal (_("too many symbols (tokens plus nonterminals); maximum %d"),
-          SHRT_MAX);
+          SYMBOL_NUMBER_MAX);
 
   assert (nsyms == ntokens + nvars);
 
Index: src/symtab.h
===================================================================
RCS file: /cvsroot/bison/bison/src/symtab.h,v
retrieving revision 1.44
diff -p -u -r1.44 symtab.h
--- src/symtab.h        29 Jul 2002 17:30:33 -0000      1.44
+++ src/symtab.h        5 Oct 2002 05:43:07 -0000
@@ -40,6 +40,7 @@ typedef enum
 
 /* Internal token numbers. */
 typedef short symbol_number_t;
+#define SYMBOL_NUMBER_MAX ((symbol_number_t) SHRT_MAX)
 
 
 typedef struct symbol_s symbol_t;




reply via email to

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