bug-bison
[Top][All Lists]
Advanced

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

Re: yy_reduce_print: debug ouput cannot be redirected to a file.


From: Joel E. Denny
Subject: Re: yy_reduce_print: debug ouput cannot be redirected to a file.
Date: Sat, 24 Feb 2007 00:43:44 -0500 (EST)

On Fri, 16 Feb 2007, [iso-8859-1] S?bastien Fricker wrote:

> The solution would be to produce the following code (which is nothing
> else than replacinf fprintf through YYFPRINTF):

Thanks.  I committed the following.

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1686
diff -p -u -r1.1686 ChangeLog
--- ChangeLog   19 Feb 2007 06:06:54 -0000      1.1686
+++ ChangeLog   24 Feb 2007 05:25:11 -0000
@@ -1,3 +1,13 @@
+2007-02-24  Joel E. Denny  <address@hidden>
+
+       Use YYFPRINTF instead of fprintf where appropriate.  Reported by
+       S?bastien Fricker at
+       <http://lists.gnu.org/archive/html/bug-bison/2007-02/msg00035.html>.
+       * THANKS: Add S?bastien Fricker.
+       * data/glr.c, data/push.c, data/yacc.c (yy_reduce_print): Implement.
+       * doc/bison.texinfo (Tracing): Make it clearer that YYFPRINTF must
+       accept a variable number of arguments.
+
 2007-02-19  Joel E. Denny  <address@hidden>
 
        * bootstrap: Remove occurrences of .#bootmp from lib/Makefile.
Index: THANKS
===================================================================
RCS file: /sources/bison/bison/THANKS,v
retrieving revision 1.70
diff -p -u -r1.70 THANKS
--- THANKS      12 Oct 2006 23:35:24 -0000      1.70
+++ THANKS      24 Feb 2007 05:25:11 -0000
@@ -70,6 +70,7 @@ Raja R Harinath           address@hidden
 Richard Stallman          address@hidden
 Robert Anisko             address@hidden
 Satya Kiran Popuri        address@hidden
+S?bastien Fricker         address@hidden
 Shura                     address@hidden
 Steve Murphy              address@hidden
 Tim Josling               address@hidden
Index: data/glr.c
===================================================================
RCS file: /sources/bison/bison/data/glr.c,v
retrieving revision 1.203
diff -p -u -r1.203 glr.c
--- data/glr.c  18 Jan 2007 08:32:33 -0000      1.203
+++ data/glr.c  24 Feb 2007 05:25:12 -0000
@@ -1442,12 +1442,12 @@ yy_reduce_print (yyGLRStack* yystackp, s
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 
1))[]dnl
                       b4_user_args[);
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 #endif
Index: data/push.c
===================================================================
RCS file: /sources/bison/bison/data/push.c,v
retrieving revision 1.37
diff -p -u -r1.37 push.c
--- data/push.c 11 Feb 2007 07:34:26 -0000      1.37
+++ data/push.c 24 Feb 2007 05:25:13 -0000
@@ -750,12 +750,12 @@ do {                                                      
        \
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 
1))[]dnl
                       b4_user_args[);
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
Index: data/yacc.c
===================================================================
RCS file: /sources/bison/bison/data/yacc.c,v
retrieving revision 1.163
diff -p -u -r1.163 yacc.c
--- data/yacc.c 16 Jan 2007 06:16:03 -0000      1.163
+++ data/yacc.c 24 Feb 2007 05:25:13 -0000
@@ -714,12 +714,12 @@ do {                                                      
        \
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 
1))[]dnl
                       b4_user_args[);
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
Index: doc/bison.texinfo
===================================================================
RCS file: /sources/bison/bison/doc/bison.texinfo,v
retrieving revision 1.227
diff -p -u -r1.227 bison.texinfo
--- doc/bison.texinfo   1 Feb 2007 06:39:43 -0000       1.227
+++ doc/bison.texinfo   24 Feb 2007 05:25:16 -0000
@@ -7236,7 +7236,7 @@ always possible.
 
 The trace facility outputs messages with macro calls of the form
 @code{YYFPRINTF (stderr, @var{format}, @var{args})} where
address@hidden and @var{args} are the usual @code{printf} format and
address@hidden and @var{args} are the usual @code{printf} format and variadic
 arguments.  If you define @code{YYDEBUG} to a nonzero value but do not
 define @code{YYFPRINTF}, @code{<stdio.h>} is automatically included
 and @code{YYFPRINTF} is defined to @code{fprintf}.

reply via email to

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