This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA/RFC] printf (stderr,... ->fprintf_unfiltered(gdb_stderr,... in hpread.c
- From: Michael Snyder <msnyder at redhat dot com>
- To: Pierre Muller <muller at cerbere dot u-strasbg dot fr>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 24 Apr 2002 11:49:54 -0700
- Subject: Re: [RFA/RFC] printf (stderr,... ->fprintf_unfiltered(gdb_stderr,... in hpread.c
- Organization: Red Hat, Inc.
- References: <4.2.0.58.20020424151049.01eb0900@ics.u-strasbg.fr>
Pierre Muller wrote:
>
> This is a second of the files that I listed in
> http://sources.redhat.com/ml/gdb/2002-02/msg00212.html
> as still having direct uses of stderr.
>
> I did not fix a 80 char overflow, because I didn't find a good way to do it:
> If I try to align the string "Psymtab for %s already read in. Shouldn't happen.\n"
> with gdb_stderr, I still get an overflow, how show I indent the args then?
> Should I break the string constant?
I've spent more time agonizing over such questions than I care to
admit. ;-)
And I'm fairly strongly opinionated against greater-than-80-char lines.
But I think when it comes to printf and string constants, we have to be
a little loose about it.
If you wanted to do something really perverted, you could try this:
fprintf_unfiltered (gdb_stderr,
"Psymtab for %s %s %s\n",
pst->filename,
"already read in. ",
"Shouldn't happen.");
>
> ChangeLog entry:
>
> 2002-04-24 Pierre Muller <ics.u-strasbg.fr>
> * hpread.c (hpread_psymtab_to_symtab_1,
> hpread_psymtab_to_symtab): Replace fprintf (stderr,...
> with fprintf_unfiltered (gdb_stderr,....
>
> Index: hpread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hpread.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 hpread.c
> --- hpread.c 15 Apr 2002 04:52:08 -0000 1.15
> +++ hpread.c 24 Apr 2002 12:41:18 -0000
> @@ -2693,7 +2693,7 @@ hpread_psymtab_to_symtab_1 (struct parti
> /* Complain if we've already read in this symbol table. */
> if (pst->readin)
> {
> - fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
> + fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
> pst->filename);
> return;
> }
> @@ -2748,7 +2748,7 @@ hpread_psymtab_to_symtab (struct partial
> /* Sanity check. */
> if (pst->readin)
> {
> - fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
> + fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
> pst->filename);
> return;
> }