bison-patches
[Top][All Lists]
Advanced

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

Re: calc.at workaround for current test failures


From: Paul Eggert
Subject: Re: calc.at workaround for current test failures
Date: 19 Jun 2003 01:53:44 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Frank Heckenbach <address@hidden> writes:

> I didn't mean to hurry a release.

It's just a test release, so there's no problem really.
A test release was way overdue anyway.

>  In fact I'd prefer if my patch of May 16 would make it into the
> next release (I put the copyright assignment in the mail on Jun 6,
> don't know how long it will take until it's processed).

It's not processed yet, unfortunately.  By "patch of May 16" I assume
you mean the revised no-default-precedence patch in
<http://mail.gnu.org/archive/html/bison-patches/2003-05/msg00017.html>.

> - I think it might be useful if the arguments to the YYLLOC_DEFAULT
>   call were parenthesized.

They seem parenthesized already in glr.c -- perhaps I'm missing
something?

> - Could the union yyGLRStackItem and the macro YYRHSLOC be declared
>   before the prologue?... at least a forward declaration of the union
>   could be added (before the pre-prologue then), I think this
>   shouldn't hurt

That'd be fine with me, though there is a chicken-and-egg problem here
to some extent.  Paul and Akim are more expert here, and I'd like to
hear their opinions.


> - Would it be possible that Bison uses xmalloc etc., or some private
>   names which are defined as malloc if not set, e.g.:
> 
>   #ifndef yymalloc
>   #define yymalloc malloc
>   #endif

That makes a lot of sense to me.  yacc.c already uses YYSTACK_ALLOC
and YYSTACK_FREE for malloc and free, though those names suggest a
stack rather than a heap.

> parse.c:7848: warning: traditional C rejects automatic aggregate 
> initialization
> parse.c:8322: warning: traditional C rejects string concatenation

glr.c assumes C89 or better.  I'd rather not worry about supporting
K&R C in glr.c; K&R is obsolete and supporting it takes away time from
more important things.

> parse.c:8150: warning: int format, long int arg (arg 3)

Thanks for reporting that problem.  I fixed it with the following
patch, which I wrote without looking at your patch (I can't wait
for your copyright papers to come in....).

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

        * data/glr.c (yyremoveDeletes, yy_reduce_print, yyglrReduce,
        yyreportTree): Do not assume that size_t is the same width as int,
        when printing sizes.  Print sizes using an unsigned format.
        Problem reported by Frank Heckenbach in
        <http://mail.gnu.org/archive/html/bison-patches/2003-06/msg00035.html>.

Index: glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -p -u -r1.58 -r1.59
--- glr.c       19 Jun 2003 07:38:39 -0000      1.58
+++ glr.c       19 Jun 2003 08:45:16 -0000      1.59
@@ -1019,7 +1019,8 @@ yyremoveDeletes (yyGLRStack* yystack)
          yystack->yytops.yystates[yyj] = yystack->yytops.yystates[yyi];
          if (yyj != yyi)
            {
-             YYDPRINTF ((stderr, "Rename stack %d -> %d.\n", yyi, yyj));
+             YYDPRINTF ((stderr, "Rename stack %lu -> %lu.\n",
+                         (unsigned long int) yyi, (unsigned long int) yyj));
            }
          yyj += 1;
        }
@@ -1133,9 +1134,9 @@ static inline void
 yy_reduce_print (size_t yyk, yyRuleNum yyrule)
 {
   int yyi;
-  unsigned int yylno = yyrline[yyrule];
-  YYFPRINTF (stderr, "Reducing stack %d by rule %d (line %u), ",
-            yyk, yyrule - 1, yylno);
+  YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu), ",
+            (unsigned long int) yyk, yyrule - 1,
+            (unsigned long int) yyrline[yyrule]);
   /* Print the symbols being reduced, and their result.  */
   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
     YYFPRINTF (stderr, "%s ", yytokenName (yyrhs[yyi]));
@@ -1189,9 +1190,9 @@ yyglrReduce (yyGLRStack* yystack, size_t
       yyupdateSplit (yystack, yys);
       yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
       YYDPRINTF ((stderr,
-                 "Reduced stack %d by rule #%d; action deferred. "
+                 "Reduced stack %lu by rule #%d; action deferred. "
                  "Now in state %d.\n",
-                 yyk, yyrule-1, yynewLRState));
+                 (unsigned long int) yyk, yyrule - 1, yynewLRState));
       for (yyi = 0; yyi < yystack->yytops.yysize; yyi += 1)
        if (yyi != yyk && yystack->yytops.yystates[yyi] != NULL)
          {
@@ -1203,8 +1204,9 @@ yyglrReduce (yyGLRStack* yystack, size_t
                  {
                    yyaddDeferredAction (yystack, yyp, yys0, 
yyrule]b4_pure_args[);
                    yymarkStackDeleted (yystack, yyk);
-                   YYDPRINTF ((stderr, "Merging stack %d into stack %d.\n",
-                               yyk, yyi));
+                   YYDPRINTF ((stderr, "Merging stack %lu into stack %lu.\n",
+                               (unsigned long int) yyk,
+                               (unsigned long int) yyi));
                    return yyok;
                  }
                yyp = yyp->yypred;
@@ -1378,9 +1380,10 @@ yyreportTree (yySemanticOption* yyx, int
               yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
               yyx->yyrule);
   else
-    YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %d .. %d>\n",
+    YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %lu .. %lu>\n",
               yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
-              yyx->yyrule, yys->yyposn+1, yyx->yystate->yyposn);
+              yyx->yyrule, (unsigned long int) (yys->yyposn + 1),
+              (unsigned long int) yyx->yystate->yyposn);
   for (yyi = 1; yyi <= yynrhs; yyi += 1)
     {
       if (yystates[yyi]->yyresolved)
@@ -1389,9 +1392,10 @@ yyreportTree (yySemanticOption* yyx, int
            YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
                       yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]));
          else
-           YYFPRINTF (stderr, "%*s%s <tokens %d .. %d>\n", yyindent+2, "",
+           YYFPRINTF (stderr, "%*s%s <tokens %lu .. %lu>\n", yyindent+2, "",
                       yytokenName (yyrhs[yyprhs[yyx->yyrule]+yyi-1]),
-                      yystates[yyi-1]->yyposn+1, yystates[yyi]->yyposn);
+                      (unsigned long int) (yystates[yyi - 1]->yyposn + 1),
+                      (unsigned long int) yystates[yyi]->yyposn);
        }
       else
        yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);




reply via email to

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