This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Checking format specifiers (Was: Re: Support for %d$c format specifier in diagnostics.c)
- From: Wolfgang Bangerth <bangerth at ices dot utexas dot edu>
- To: gcc-patches at gcc dot gnu dot org, Ishikawa <ishikawa at yk dot rim dot or dot jp>
- Date: Mon, 21 Jul 2003 17:49:08 -0500
- Subject: Checking format specifiers (Was: Re: Support for %d$c format specifier in diagnostics.c)
Hi Chiaki,
I think it's excellent someone finally looks at positional arguments for
printf! gcc has repeatedly been bitten by the following problem: there's a
message like
Variable %s doesn't exist in class %T
(or so, don't know whether the format specifiers make sens, just assume
they're different), and some translation reads
In der Klasse %T gibt es keine Variable %s
That's easily cured by positional parameters, but unfortunately our
translations are full of such errors. Another, even more obviously wrong
problem is that messages do not have the same number of format specifiers as
the orginal message had. We had several reports for crashes due to this, see
in particular
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9390
and the thread that is referenced in message #5 there, and also
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7765
Because the translations happen outside the gcc project, there was not much I
could do about it. However, I once made an attempt to write a small script
that goes through the translations and checks for every message whether the
format specifiers in the orginal and translated messages are the same in
number and appear in the correct order (in absence of positional
information). The result was largely devastating: there were translations
with hundreds of errors. I imagine that if anyone uses them, they would very
frequently get compiler crashes for this.
I am not familiar with the translation community, but if you are: one of the
really necessary additions in their processes would be a small program that
does what my small script tried to do in a thourough way (i.e., for example,
taking into account positional parameters). If we would then only get "valid"
translations, we should add this script to our makefiles, so that no broken
translations can be checked in unless they pass the script (could be done as
a part of bootstrapping). Since you are already working on a parser for these
things, writing a checker might (or might not) be a byproduct of your work,
and one that would certainly be appreciated!
Thanks for your work
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/