[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fixes to allow glr.c to be used for C++ as well.
From: |
Paul Hilfinger |
Subject: |
[PATCH] Fixes to allow glr.c to be used for C++ as well. |
Date: |
Tue, 13 Jan 2004 17:44:37 -0800 |
I've checked in a few small modifications to remove compilation errors from C++
parsers produced from glr.c.
P. Hilfinger
2004-01-13 Paul Hilfinger <address@hidden>
* data/glr.c: Put casts on uses of YYREALLOC and YYMALLOC so that
resulting parsers are compilable with C++.
Index: bison-1_5.76/data/glr.c
--- bison-1_5.76/data/glr.c Sun, 11 Jan 2004 17:33:13 -0800 hilfingr
(glrbison/e/14_glr-parser 1.27.1.33.1.3 644)
+++ bison-1_5.78(w)/data/glr.c Tue, 13 Jan 2004 16:46:47 -0800 hilfingr
(glrbison/e/14_glr-parser 1.27.1.33.1.5 644)
@@ -876,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;
}
@@ -895,7 +895,7 @@ yyinitGLRStack (yyGLRStack* yystack, siz
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);
@@ -1237,9 +1237,9 @@ yysplitStack (yyGLRStack* yystack, int y
{
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];
@@ -1649,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;
- [PATCH] Fixes to allow glr.c to be used for C++ as well.,
Paul Hilfinger <=