bison-patches
[Top][All Lists]
Advanced

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

glr.c port to Forte Developer 7


From: Paul Eggert
Subject: glr.c port to Forte Developer 7
Date: 19 Jun 2003 01:07:15 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

I installed the following minor patch to glr.c.  The avoidance of "do
{ ... return; } while (0)" is a bit awkward but I couldn't see a
better way to do it offhand.

2003-06-19  Paul Eggert  <address@hidden>

        Port to Forte Developer 7 C compiler.
        * data/glr.c (struct YYLTYPE): If locations are not being used,
        declare a single dummy member, as empty structs do not conform
        to the C standard.
        (YYERROR, YYBACKUP): Do not use "do { ...; return foo; } while (0)";
        the Forte Developer 7 C compiler complains that end-of-loop
        code is not reached.

Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -p -u -b -w -r1.57 -r1.58
--- data/glr.c  10 Jun 2003 02:44:58 -0000      1.57
+++ data/glr.c  19 Jun 2003 07:38:39 -0000      1.58
@@ -197,6 +197,8 @@ typedef struct YYLTYPE
   int first_column;
   int last_line;
   int last_column;
+],[
+  char yydummy;
 ])[
 } YYLTYPE;
 # define YYLTYPE_IS_DECLARED 1
@@ -682,7 +684,7 @@ yyuserAction (yyRuleNum yyn, int yyrhsle
 # undef YYABORT
 # define YYABORT return yyabort
 # undef YYERROR
-# define YYERROR do { yystack->yyerrState = 0; return yyerr; } while (0)
+# define YYERROR return yyerrok, yyerr
 # undef YYRECOVERING
 # define YYRECOVERING (yystack->yyerrState != 0)
 # undef yyclearin
@@ -691,10 +693,8 @@ yyuserAction (yyRuleNum yyn, int yyrhsle
 # define YYFILL(N) yyfill (yyvsp, &yylow, N, yynormal)
 # undef YYBACKUP
 # define YYBACKUP(Token, Value)                                                
     \
-  do {                                                                      \
-    yyerror (]b4_yyerror_args["syntax error: cannot back up");              \
-    YYERROR;                                                                \
-  } while (0)
+  return yyerror (]b4_yyerror_args["syntax error: cannot back up"),         \
+        yyerrok, yyerr
 
   yylow = 1;
   if (yyrhslen == 0)
@@ -2016,6 +2016,8 @@ b4_location_if([
   int first_column;
   int last_line;
   int last_column;
+],[
+  char yydummy;
 ])
 } YYLTYPE;
 # define YYLTYPE_IS_DECLARED 1




reply via email to

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