Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Remove fprintf calls in parsers.
@ 2002-05-16  3:16 Pierre Muller
  2002-05-16  3:32 ` Pierre Muller
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Muller @ 2002-05-16  3:16 UTC (permalink / raw)
  To: gdb-patches


The following patch removes the calls to fprintf
inside the p-exp.tab.c file generated
by the bison parser.

This is done by simply defining YYFPRINTF macro.
All use of YYFPRINTF macro generated by bison
seem to use stderr as file parameter,
but this might change in the future...
that is why I added a check for it.

I didn't commit this, because I think that this
should be done for all parsers at the same time.
But this then raises the question of the location of
the pascal_yyfprintf (that would then be renamed to
something like parser_yyfprintf).

Two possibilities: 
-- parse.c seems rather logical,
with a declaration in parser-defs.h

but on the other hand
-- utils.c could also be considered.

I am willing to send a RFA for a common suppression of all
fprintf generated in all parser once the location of
this function is defined.



$ cvs diff -u -p p-exp.y
Index: p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.11
diff -u -p -r1.11 p-exp.y
--- p-exp.y     16 May 2002 09:34:54 -0000      1.11
+++ p-exp.y     16 May 2002 10:07:40 -0000
@@ -107,6 +107,26 @@ Foundation, Inc., 59 Temple Place - Suit
  #define        YYDEBUG 0               /* Default to no yydebug support */
  #endif

+#define YYFPRINTF pascal_yyfprintf
+
+static void pascal_yyfprintf (FILE *, const char *, ...);
+
+static void
+pascal_yyfprintf (FILE *x, const char *y, ...)
+{
+  va_list args;
+  va_start (args, y);
+  if (x == stderr)
+    vfprintf_unfiltered (gdb_stderr, y, args);
+  else
+    {
+      fprintf_unfiltered (gdb_stderr, " Unknown FILE used.\n");
+      vfprintf_unfiltered (gdb_stderr, y, args);
+    }
+  va_end (args);
+}
+
+
  int yyparse (void);

  static int yylex (void);



Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-16 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-16  3:16 [RFC] Remove fprintf calls in parsers Pierre Muller
2002-05-16  3:32 ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox