]> git.saurik.com Git - bison.git/blobdiff - data/glr.c
data/glr.c: Put casts on uses of YYREALLOC and YYMALLOC so that
[bison.git] / data / glr.c
index cce06f5b97a0220a90a760bc31274d8f8d1d4a3c..eb270a176cc89dc693f4bf07d508c0a38ba6ee80 100644 (file)
@@ -111,7 +111,7 @@ m4_define([b4_lhs_value],
 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
 # symbols on RHS.
 m4_define([b4_rhs_value],
-[yyvsp@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3])])
+[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3])])
 
 
 
@@ -131,7 +131,7 @@ m4_define([b4_lhs_location],
 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
 # on RHS.
 m4_define([b4_rhs_location],
-[yyvsp@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc])
+[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc])
 
 # We do want M4 expansion after # for CPP macros.
 m4_changecom()
@@ -740,10 +740,9 @@ b4_syncline([@oline@], [@ofile@])
 }
 \f
 
-static YYSTYPE
+static void
 yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
 {
-  YYSTYPE yyval = *yy0;
   /* `Use' the arguments.  */
   (void) yy0;
   (void) yy1;
@@ -752,7 +751,6 @@ yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
     {
       b4_mergers
     }
-  return yyval;
 }
 [
                              /* Bison grammar-table manipulation.  */
@@ -878,7 +876,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
 {
   yyset->yysize = 1;
   yyset->yycapacity = 16;
-  yyset->yystates = YYMALLOC (16 * sizeof yyset->yystates[0]);
+  yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
   yyset->yystates[0] = NULL;
 }
 
@@ -897,7 +895,7 @@ yyinitGLRStack (yyGLRStack* yystack, size_t yysize)
   yynerrs = 0;
   yystack->yyspaceLeft = yysize;
   yystack->yynextFree = yystack->yyitems =
-    YYMALLOC (yysize * sizeof yystack->yynextFree[0]);
+    (yyGLRStackItem*) YYMALLOC (yysize * sizeof yystack->yynextFree[0]);
   yystack->yysplitPoint = NULL;
   yystack->yylastDeleted = NULL;
   yyinitStateSet (&yystack->yytops);
@@ -1239,9 +1237,9 @@ yysplitStack (yyGLRStack* yystack, int yyk)
     {
       yystack->yytops.yycapacity *= 2;
       yystack->yytops.yystates =
-       YYREALLOC (yystack->yytops.yystates,
-                  (yystack->yytops.yycapacity
-                   * sizeof yystack->yytops.yystates[0]));
+       (yyGLRState**) YYREALLOC (yystack->yytops.yystates,
+                                 (yystack->yytops.yycapacity
+                                  * sizeof yystack->yytops.yystates[0]));
     }
   yystack->yytops.yystates[yystack->yytops.yysize]
     = yystack->yytops.yystates[yyk];
@@ -1475,7 +1473,7 @@ yyresolveValue (yySemanticOption* yyoptionList, yyGLRStack* yystack,
              YYSTYPE yyval1;
              YYLTYPE yydummy;
              YYCHK (yyresolveAction (yyp, yystack, &yyval1, &yydummy]b4_user_args[));
-             *yyvalp = yyuserMerge (yymerger[yyp->yyrule], yyvalp, &yyval1);
+             yyuserMerge (yymerger[yyp->yyrule], yyvalp, &yyval1);
            }
        }
       return yyok;
@@ -1651,7 +1649,7 @@ yyreportSyntaxError (yyGLRStack* yystack,
              }
          yysize += (sizeof ("syntax error, unexpected ")
                     + strlen (yytokenName (*yytokenp)));
-         yymsg = YYMALLOC (yysize);
+         yymsg = (char*) YYMALLOC (yysize);
          if (yymsg != 0)
            {
              char* yyp = yymsg;