* data/glr.c (yy_yypstack, yypstates, yypdumpstack): Use YYFPRINTF

instead of fprintf.  Guard these functions with #if YYDEBUG instead of
#ifdef YYDEBUG for consistency with all other uses of YYDEBUG in Bison
and so that YYFPRINTF is guaranteed to be defined here.
This commit is contained in:
Joel E. Denny
2007-07-02 02:07:20 +00:00
parent 71b61d4db5
commit 8a86eef0fa
3 changed files with 33 additions and 21 deletions

View File

@@ -1,3 +1,10 @@
2007-07-01 Joel E. Denny <jdenny@ces.clemson.edu>
* data/glr.c (yy_yypstack, yypstates, yypdumpstack): Use YYFPRINTF
instead of fprintf. Guard these functions with #if YYDEBUG instead of
#ifdef YYDEBUG for consistency with all other uses of YYDEBUG in Bison
and so that YYFPRINTF is guaranteed to be defined here.
2007-05-29 Joel E. Denny <jdenny@ces.clemson.edu> 2007-05-29 Joel E. Denny <jdenny@ces.clemson.edu>
* src/muscle_tab.c (muscle_percent_define_invalid_value): Replace * src/muscle_tab.c (muscle_percent_define_invalid_value): Replace

View File

@@ -2554,7 +2554,7 @@ m4_popdef([b4_at_dollar])])dnl
} }
/* DEBUGGING ONLY */ /* DEBUGGING ONLY */
#ifdef YYDEBUG #if YYDEBUG
static void yypstack (yyGLRStack* yystackp, size_t yyk) static void yypstack (yyGLRStack* yystackp, size_t yyk)
__attribute__ ((__unused__)); __attribute__ ((__unused__));
static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__)); static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__));
@@ -2565,19 +2565,20 @@ yy_yypstack (yyGLRState* yys)
if (yys->yypred) if (yys->yypred)
{ {
yy_yypstack (yys->yypred); yy_yypstack (yys->yypred);
fprintf (stderr, " -> "); YYFPRINTF (stderr, " -> ");
} }
fprintf (stderr, "%d@@%lu", yys->yylrState, (unsigned long int) yys->yyposn); YYFPRINTF (stderr, "%d@@%lu", yys->yylrState,
(unsigned long int) yys->yyposn);
} }
static void static void
yypstates (yyGLRState* yyst) yypstates (yyGLRState* yyst)
{ {
if (yyst == NULL) if (yyst == NULL)
fprintf (stderr, "<null>"); YYFPRINTF (stderr, "<null>");
else else
yy_yypstack (yyst); yy_yypstack (yyst);
fprintf (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
static void static void
@@ -2597,31 +2598,33 @@ yypdumpstack (yyGLRStack* yystackp)
size_t yyi; size_t yyi;
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1) for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
{ {
fprintf (stderr, "%3lu. ", (unsigned long int) (yyp - yystackp->yyitems)); YYFPRINTF (stderr, "%3lu. ",
(unsigned long int) (yyp - yystackp->yyitems));
if (*(yybool *) yyp) if (*(yybool *) yyp)
{ {
fprintf (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld", YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
yyp->yystate.yyresolved, yyp->yystate.yylrState, yyp->yystate.yyresolved, yyp->yystate.yylrState,
(unsigned long int) yyp->yystate.yyposn, (unsigned long int) yyp->yystate.yyposn,
(long int) YYINDEX (yyp->yystate.yypred)); (long int) YYINDEX (yyp->yystate.yypred));
if (! yyp->yystate.yyresolved) if (! yyp->yystate.yyresolved)
fprintf (stderr, ", firstVal: %ld", YYFPRINTF (stderr, ", firstVal: %ld",
(long int) YYINDEX (yyp->yystate.yysemantics.yyfirstVal)); (long int) YYINDEX (yyp->yystate
.yysemantics.yyfirstVal));
} }
else else
{ {
fprintf (stderr, "Option. rule: %d, state: %ld, next: %ld", YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
yyp->yyoption.yyrule - 1, yyp->yyoption.yyrule - 1,
(long int) YYINDEX (yyp->yyoption.yystate), (long int) YYINDEX (yyp->yyoption.yystate),
(long int) YYINDEX (yyp->yyoption.yynext)); (long int) YYINDEX (yyp->yyoption.yynext));
} }
fprintf (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
fprintf (stderr, "Tops:"); YYFPRINTF (stderr, "Tops:");
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1) for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
fprintf (stderr, "%lu: %ld; ", (unsigned long int) yyi, YYFPRINTF (stderr, "%lu: %ld; ", (unsigned long int) yyi,
(long int) YYINDEX (yystackp->yytops.yystates[yyi])); (long int) YYINDEX (yystackp->yytops.yystates[yyi]));
fprintf (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
#endif #endif
] ]

View File

@@ -15,7 +15,9 @@ gnulib-comp.m4
gnulib-tool.m4 gnulib-tool.m4
hash.m4 hash.m4
iconv.m4 iconv.m4
include_next.m4
inline.m4 inline.m4
intlmacosx.m4
inttypes-h.m4 inttypes-h.m4
inttypes-pri.m4 inttypes-pri.m4
inttypes.m4 inttypes.m4