From: Pierre Muller <muller@cerbere.u-strasbg.fr>
To: gdb-patches@sources.redhat.com
Subject: [RFC] Remove fprintf calls in parsers.
Date: Thu, 16 May 2002 03:16:00 -0000 [thread overview]
Message-ID: <4.2.0.58.20020516120236.02246e98@ics.u-strasbg.fr> (raw)
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
next reply other threads:[~2002-05-16 10:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-16 3:16 Pierre Muller [this message]
2002-05-16 3:32 ` Pierre Muller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4.2.0.58.20020516120236.02246e98@ics.u-strasbg.fr \
--to=muller@cerbere.u-strasbg.fr \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox