diff --git a/data/c.m4 b/data/c.m4 index 195c441d..fee006a3 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -456,6 +456,8 @@ m4_define_default([b4_yy_symbol_print_generate], b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl m4_ifset([b4_parse_param], [, b4_parse_param]))[ { + FILE *yyo = yyoutput; + YYUSE (yyo); if (!yyvaluep) return; ]b4_locations_if([ YYUSE (yylocationp); diff --git a/data/glr.cc b/data/glr.cc index 0f9141c4..b7a8b40d 100644 --- a/data/glr.cc +++ b/data/glr.cc @@ -151,9 +151,11 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, const semantic_type* yyvaluep, const location_type* yylocationp) { - /* Pacify ``unused variable'' warnings. */ - YYUSE (yyvaluep); YYUSE (yylocationp); + YYUSE (yyvaluep); + std::ostream& yyoutput = debug_stream (); + std::ostream& yyo = yyoutput; + YYUSE (yyo); switch (yytype) { ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl diff --git a/data/lalr1.cc b/data/lalr1.cc index d7201dd4..76a83504 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -446,6 +446,9 @@ do { \ { YYUSE (yylocationp); YYUSE (yyvaluep); + std::ostream& yyo = debug_stream (); + std::ostream& yyoutput = yyo; + YYUSE (yyoutput); switch (yytype) { ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl diff --git a/doc/bison.texinfo b/doc/bison.texinfo index 1a5b20c4..0e9329fb 100644 --- a/doc/bison.texinfo +++ b/doc/bison.texinfo @@ -3079,14 +3079,14 @@ type: %code requires @{ #include "type1.h" @} %union @{ type1 field1; @} %destructor @{ type1_free ($$); @} -%printer @{ type1_print ($$); @} +%printer @{ type1_print (yyoutput, $$); @} @end group @group %code requires @{ #include "type2.h" @} %union @{ type2 field2; @} %destructor @{ type2_free ($$); @} -%printer @{ type2_print ($$); @} +%printer @{ type2_print (yyoutput, $$); @} @end group @end example @@ -9665,10 +9665,10 @@ To enable memory deallocation during error recovery, use @c FIXME: Document %printer, and mention that it takes a braced-code operand. @comment file: calc++-parser.yy @example -%printer @{ debug_stream () << *$$; @} "identifier" +%printer @{ yyoutput << *$$; @} "identifier" %destructor @{ delete $$; @} "identifier" -%printer @{ debug_stream () << $$; @} +%printer @{ yyoutput << $$; @} @end example @noindent