mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
* data/glr.c (yyresolveLocations): Rename local variables to avoid
shadowing warnings. Use usual patter for iterating through RHS. * tests/glr-regression.at (Uninitialized location when reporting ambiguity): Modify yylex so that it uses its argument, rather than trying to rely on ARGSUSED (which doesn't work for gcc with warnings). const char -> char const.
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
2006-03-06 Paul Eggert <eggert@cs.ucla.edu>
|
2006-03-06 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
* data/glr.c (yyresolveLocations): Rename local variables to avoid
|
||||||
|
shadowing warnings. Use usual patter for iterating through RHS.
|
||||||
|
* tests/glr-regression.at
|
||||||
|
(Uninitialized location when reporting ambiguity):
|
||||||
|
Modify yylex so that it uses its argument, rather than trying
|
||||||
|
to rely on ARGSUSED (which doesn't work for gcc with warnings).
|
||||||
|
const char -> char const.
|
||||||
|
|
||||||
* tests/Makefile.am ($(srcdir)/package.m4, maintainer-check-valgrind):
|
* tests/Makefile.am ($(srcdir)/package.m4, maintainer-check-valgrind):
|
||||||
Don't use tabs inside commands; it messes up 'ps'.
|
Don't use tabs inside commands; it messes up 'ps'.
|
||||||
Problem reported by twlevo.
|
Problem reported by twlevo.
|
||||||
|
|||||||
30
data/glr.c
30
data/glr.c
@@ -1803,43 +1803,43 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
|||||||
return yyabort;
|
return yyabort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starting at and including state S, resolve the location for each of the
|
/** Starting at and including state S1, resolve the location for each of the
|
||||||
* previous N states that is unresolved. The first semantic option of a state
|
* previous N1 states that is unresolved. The first semantic option of a state
|
||||||
* is always chosen. */
|
* is always chosen. */
|
||||||
static void
|
static void
|
||||||
yyresolveLocations (yyGLRState* yys, int yyn,
|
yyresolveLocations (yyGLRState* yys1, int yyn1,
|
||||||
yyGLRStack *yystackp]b4_user_formals[)
|
yyGLRStack *yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (0 < yyn)
|
if (0 < yyn1)
|
||||||
{
|
{
|
||||||
yyresolveLocations (yys->yypred, yyn-1, yystackp]b4_user_args[);
|
yyresolveLocations (yys1->yypred, yyn1 - 1, yystackp]b4_user_args[);
|
||||||
if (!yys->yyresolved)
|
if (!yys1->yyresolved)
|
||||||
{
|
{
|
||||||
yySemanticOption *yyoption;
|
yySemanticOption *yyoption;
|
||||||
yyGLRStackItem yyrhs[1 + YYMAXRHS];
|
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||||
int yynrhs;
|
int yynrhs;
|
||||||
int yychar_current;
|
int yychar_current;
|
||||||
YYSTYPE yylval_current;
|
YYSTYPE yylval_current;
|
||||||
YYLTYPE yylloc_current;
|
YYLTYPE yylloc_current;
|
||||||
yyoption = yys->yysemantics.yyfirstVal;
|
yyoption = yys1->yysemantics.yyfirstVal;
|
||||||
YYASSERT (yyoption != NULL);
|
YYASSERT (yyoption != NULL);
|
||||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||||
if (yynrhs > 0)
|
if (yynrhs > 0)
|
||||||
{
|
{
|
||||||
yyGLRState *yys;
|
yyGLRState *yys;
|
||||||
int yyi;
|
int yyn;
|
||||||
yyresolveLocations (yyoption->yystate, yynrhs,
|
yyresolveLocations (yyoption->yystate, yynrhs,
|
||||||
yystackp]b4_user_args[);
|
yystackp]b4_user_args[);
|
||||||
for (yys = yyoption->yystate, yyi = yynrhs;
|
for (yys = yyoption->yystate, yyn = yynrhs;
|
||||||
yyi >= 1;
|
yyn > 0;
|
||||||
yys = yys->yypred, yyi -= 1)
|
yys = yys->yypred, yyn -= 1)
|
||||||
yyrhs[yyi].yystate.yyloc = yys->yyloc;
|
yyrhsloc[yyn].yystate.yyloc = yys->yyloc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyGLRState *yyprevious = yyoption->yystate;
|
yyGLRState *yyprevious = yyoption->yystate;
|
||||||
YYASSERT (yyprevious->yyresolved);
|
YYASSERT (yyprevious->yyresolved);
|
||||||
yyrhs[0].yystate.yyloc = yyprevious->yyloc;
|
yyrhsloc[0].yystate.yyloc = yyprevious->yyloc;
|
||||||
}
|
}
|
||||||
yychar_current = yychar;
|
yychar_current = yychar;
|
||||||
yylval_current = yylval;
|
yylval_current = yylval;
|
||||||
@@ -1847,7 +1847,7 @@ yyresolveLocations (yyGLRState* yys, int yyn,
|
|||||||
yychar = yyoption->yyrawchar;
|
yychar = yyoption->yyrawchar;
|
||||||
yylval = yyoption->yyval;
|
yylval = yyoption->yyval;
|
||||||
yylloc = yyoption->yyloc;
|
yylloc = yyoption->yyloc;
|
||||||
YYLLOC_DEFAULT ((yys->yyloc), yyrhs, yynrhs);
|
YYLLOC_DEFAULT ((yys1->yyloc), yyrhsloc, yynrhs);
|
||||||
yychar = yychar_current;
|
yychar = yychar_current;
|
||||||
yylval = yylval_current;
|
yylval = yylval_current;
|
||||||
yylloc = yylloc_current;
|
yylloc = yylloc_current;
|
||||||
|
|||||||
@@ -1547,7 +1547,7 @@ yyerror (char const *msg)
|
|||||||
static int
|
static int
|
||||||
yylex (void)
|
yylex (void)
|
||||||
{
|
{
|
||||||
static const char *input = "ab";
|
static char const *input = "ab";
|
||||||
if (*input == 'b')
|
if (*input == 'b')
|
||||||
lookahead_value = 1;
|
lookahead_value = 1;
|
||||||
return *input++;
|
return *input++;
|
||||||
@@ -1627,11 +1627,12 @@ yyerror (YYLTYPE *locp, char const *msg)
|
|||||||
locp->first_column, locp->last_line, locp->last_column, msg);
|
locp->first_column, locp->last_line, locp->last_column, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/ static int
|
static int
|
||||||
yylex (YYSTYPE *lvalp, YYLTYPE *llocp)
|
yylex (YYSTYPE *lvalp, YYLTYPE *llocp)
|
||||||
{
|
{
|
||||||
static const char input[] = "ab";
|
static char const input[] = "ab";
|
||||||
static const char *inputp = input;
|
static char const *inputp = input;
|
||||||
|
lvalp->dummy = 0;
|
||||||
llocp->first_line = llocp->last_line = 2;
|
llocp->first_line = llocp->last_line = 2;
|
||||||
llocp->first_column = inputp - input + 1;
|
llocp->first_column = inputp - input + 1;
|
||||||
llocp->last_column = llocp->first_column + 1;
|
llocp->last_column = llocp->first_column + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user