bug-bison
[Top][All Lists]
Advanced

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

bison 1.50 uses "signed char"; not portable to K&R C


From: Paul Eggert
Subject: bison 1.50 uses "signed char"; not portable to K&R C
Date: Mon, 14 Oct 2002 01:10:19 -0700 (PDT)

Ancient K&R C compilers don't have "signed char".  Also, Bison thinks
that 128 fits in a signed char, but it doesn't on most hosts.  I
installed the following patch.

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

        * data/c.m4 (b4_int_type): Use yysigned_char instead of signed char,
        for portability to K&R hosts.  Fix typo: signed char is guaranteed
        only to 127, not to 128.
        * data/glr.c (yysigned_char): New type.
        * data/yacc.c (yysigned_char): Likewise.
        * tests/regression.at (Web2c Actions): signed char -> yysigned_char.

Index: data/c.m4
===================================================================
RCS file: /cvsroot/bison/bison/data/c.m4,v
retrieving revision 1.7
diff -p -u -r1.7 c.m4
--- data/c.m4   13 Oct 2002 20:35:06 -0000      1.7
+++ data/c.m4   14 Oct 2002 08:01:52 -0000
@@ -65,7 +65,7 @@ m4_define([b4_ints_in],
 # MIN to MAX (included).
 m4_define([b4_int_type],
 [m4_if(b4_ints_in($@,      [0],   [255]), [1], [unsigned char],
-       b4_ints_in($@,   [-128],   [128]), [1], [signed char],
+       b4_ints_in($@,   [-128],   [127]), [1], [yysigned_char],
 
        b4_ints_in($@,      [0], [65535]), [1], [unsigned short],
        b4_ints_in($@, [-32768], [32767]), [1], [short],
Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.14
diff -p -u -r1.14 glr.c
--- data/glr.c  13 Oct 2002 19:40:30 -0000      1.14
+++ data/glr.c  14 Oct 2002 08:01:52 -0000
@@ -198,6 +198,12 @@ static YYLTYPE yyloc_default;
 #  define yyfalse 0
 #endif
 
+#if defined (__STDC__) || defined (__cplusplus)
+   typedef signed char yysigned_char;
+#else
+   typedef short yysigned_char;
+#endif
+
 /*-----------------.
 | GCC extensions.  |
 `-----------------*/
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.18
diff -p -u -r1.18 yacc.c
--- data/yacc.c 14 Oct 2002 06:54:41 -0000      1.18
+++ data/yacc.c 14 Oct 2002 08:01:52 -0000
@@ -307,6 +307,12 @@ b4_location_if(
 
 #endif
 
+#if defined (__STDC__) || defined (__cplusplus)
+   typedef signed char yysigned_char;
+#else
+   typedef short yysigned_char;
+#endif
+
 /* YYFINAL -- State number of the termination state. */
 #define YYFINAL  b4_final_state_number
 #define YYLAST   b4_last
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.69
diff -p -u -r1.69 regression.at
--- tests/regression.at 11 Oct 2002 11:23:19 -0000      1.69
+++ tests/regression.at 14 Oct 2002 08:01:53 -0000
@@ -599,7 +599,7 @@ static const unsigned char yyprhs[] =
 {
        0,     0,     3,     5,     6,     9,    14
 };
-static const signed char yyrhs[] =
+static const yysigned_char yyrhs[] =
 {
        8,     0,    -1,     9,    -1,    -1,    10,    11,    -1,     3,
        4,     5,     8,    -1,     6,     8,    -1
@@ -630,16 +630,16 @@ static const unsigned char yydefact[] =
        3,     0,     0,     2,     0,     0,     1,     3,     4,     3,
        6,     5
 };
-static const signed char yydefgoto[] =
+static const yysigned_char yydefgoto[] =
 {
       -1,     2,     3,     4,     8
 };
-static const signed char yypact[] =
+static const yysigned_char yypact[] =
 {
       -2,    -1,     4,    -8,     0,     2,    -8,    -2,    -8,    -2,
       -8,    -8
 };
-static const signed char yypgoto[] =
+static const yysigned_char yypgoto[] =
 {
       -8,    -7,    -8,    -8,    -8
 };
@@ -647,7 +647,7 @@ static const unsigned char yytable[] =
 {
       10,     1,    11,     5,     6,     0,     7,     9
 };
-static const signed char yycheck[] =
+static const yysigned_char yycheck[] =
 {
        7,     3,     9,     4,     0,    -1,     6,     5
 };




reply via email to

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