This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] remove calls to fprintf in language parsers


At 16:13 21/06/2002 , Andrew Cagney a écrit:
>>At 02:49 21/06/2002 , Andrew Cagney a écrit:
>>
>>>>+/* Function used to avoid direct calls to fprintf
>>>>+   in the code generated by the bison parser.  */
>>>>+
>>>>+extern void parser_fprintf (FILE *, const char *, ...);
>>
>>>
>>>Hmm, wonder if there is any benefit in adding ATTR_FORMAT(printf, 2, 3) to the declaration?
>>
>>I didn't even  know this modifier :(
>
>BTW, attr_format was only added to error() (one of GDBs most important functions) a month or so ago.  While the attribute has been around for a while, it is relativly new for GDB.
>
>>But it does look appropriate indeed.
>
>My only reservation was that bison/yacc could turn out to generate badly formatted printf statements.  However, if that is happening then we need to know anyway.

Isn't it the purpose of this modifer to check if the format and the parameter list match?

>As for indentation.  GNU indent doesn't handle ATTR_FORMAT() very well so any location is likely ok.
>
>>>Anyway, yes,
>>
>>Does this mean I can apply the patch?
>
>Yes, either way.

Committed.

>Andrew
>(I'm just happy to see these fprintf() slowly disappearing :-)

The only fprintf call remaining
(at least for cygwin native GDB)  is in tracepoint.c 
function tracepoint_save_command
but this is directly to a disk file, so it shouldn't harm any program using GDB lib
like Insight.
Nevertheless for consistency,
this FILE *fp local var should probably also be converted into a 
ui_file by using gdb_fopen instead of fopen, no?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]