From: Andrew Cagney <ac131313@cygnus.com>
To: Eli Zaretskii <eliz@is.elta.co.il>
Cc: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: Re: [fyi] fix mips-tdep.c -Wprintf(a?"%d":"%d%d", ...)
Date: Wed, 21 Feb 2001 10:30:00 -0000 [thread overview]
Message-ID: <3A9408B5.256F077F@cygnus.com> (raw)
In-Reply-To: <Pine.SUN.3.91.1010221122508.18287W-100000@is>
Eli Zaretskii wrote:
>
> On Tue, 20 Feb 2001, Andrew Cagney wrote:
>
> > I've checked in the attatched. A GCC variant didn't like conditional
> > formats vis:
> >
> > printf (cond ? "arg1=%d" : "arg1=%d arg2+%d", arg1, arg2);
>
> That's one of my gripes with latest versions of GCC (which version did
> you use, btw?): this change caused lots of valid C code to start
> emitting tons of warnings. Ulrich Drepper tried to change GCC
> maintainers' minds on this one (evidently, glibc uses such expressions
> in printf's), to no avail IIRC.
>
> Isn't there a compiler switch to turn this warning off? Perhaps we
> should use it instead of ``fixing'' that which isn't broken.
ac131313@localhost$ gcc --version
egcs-1.1.2
but I know it is lieing - there should be a ``+ NetBSD patches''
appended.
The warning comes from the ``-Wprintf'' flag so I think fixing this
little nuance is far less of a hassle than dropping -Wprintf. (To be
honest, I personally don't like the ``?:'' operator - I can't debug it -
so I don't object to this ``fix'' :-).
The other thing to keep in mind is that the ui_out interface strongly
discourages the above convention. What was:
> printf (cond ? "arg1=%d" : "arg1=%d arg2+%d", arg1, arg2);
and I rewrote to something like:
printf ("arg1=");
printf ("%d", arg1);
if (cond)
{
printf (" arg2+");
printf ("%d", arg2);
}
will eventually be written as something like:
ui_out_text ("arg1=");
ui_out_int (arg1, fmt, "arg1");
if (cond)
{
ui_out_text (" arg2+");
ui_out_int (arg2, fmt, "arg2");
}
so I'm in a way just helping the code along a little :-)
enjoy,
Andrew
prev parent reply other threads:[~2001-02-21 10:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-20 15:49 Andrew Cagney
2001-02-21 2:27 ` Eli Zaretskii
2001-02-21 10:30 ` Andrew Cagney [this message]
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=3A9408B5.256F077F@cygnus.com \
--to=ac131313@cygnus.com \
--cc=eliz@is.elta.co.il \
--cc=gdb-patches@sourceware.cygnus.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