This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7765 [Patch]
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Kai Henningsen <kaih at khms dot westfalen dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 5 Nov 2002 09:50:12 -0800
- Subject: Re: c++/7765 [Patch]
- References: <20021028175923.GB24090@codesourcery.com> <Pine.LNX.4.44.0210281251240.736-100000@gandalf.ticam.utexas.edu> <8$GThgDXw-B@khms.westfalen.de>
On Tue, Nov 05, 2002 at 08:58:00AM +0200, Kai Henningsen wrote:
> bangerth@ticam.utexas.edu (Wolfgang Bangerth) wrote on 28.10.02 in <Pine.LNX.4.44.0210281251240.736-100000@gandalf.ticam.utexas.edu>:
>
> > > Yes, the order of formats must presently be preserved. I realize that
> > > this interferes with proper translation. What we need to do is
> > > implement the SVR4 "%1$x" printf extension: this allows you to write
> > >
> > > msgid "statement about %d %s"
> > > msgstr "statement about %2$s in quantity %1$d"
> > >
> > > (I will get to this eventually, but the list of things I will get to
> > > eventually has items on it from 1998, so don't hold your breath.
> > > Patches for diagnostic.c are welcome.)
> >
> > Doing this first, before cleaning up what is there now, may be even
> > the simpler way: about 1000 (half of the total) are ordering problems.
> > These could, to a large extent, probably be fixed if the SVR4 syntax would
> > be there, without even knowing the language in question. Maybe even
> > semiautomatically.
>
> Unfortunately, that's not exactly trivial. Maybe one could steal the
> relevant code from glibc?
>
> Essentially, one would have to first build up a list of all specifiers in
> the format string, hope that that gives no holes with unused parameters in
> them where one does not know their type, then process the varargs with the
> type info one has into that list, and finally do another pass to output
> the whole mess - first and third pass in format string sequence, second
> pass in argument sequence.
I'm working on just this. It may take me awhile - it is indeed
nonobvious, and I don't intend to recycle the glibc code because it's
just too messy.
It may well be too invasive for 3.3 - we'll see.
zw