From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19263 invoked by alias); 16 May 2002 10:16:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19256 invoked from network); 16 May 2002 10:16:37 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.7) by sources.redhat.com with SMTP; 16 May 2002 10:16:37 -0000 Received: from laocoon (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (8.9.3/8.8.7) with ESMTP id MAA21144 for ; Thu, 16 May 2002 12:16:34 +0200 Message-Id: <4.2.0.58.20020516120236.02246e98@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr Date: Thu, 16 May 2002 03:16:00 -0000 To: gdb-patches@sources.redhat.com From: Pierre Muller Subject: [RFC] Remove fprintf calls in parsers. Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2002-05/txt/msg00633.txt.bz2 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