This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: Checking format specifiers


Wolfgang Bangerth <bangerth@ices.utexas.edu> writes:

> I don't think you need to make this domain specific -- other problems should 
> certainly have the same problem.

But the test is wrong, in the general case!

It tests whether there is the same number of percent signs both in the
msgid and the msgstr. There is no requirement, in general, that this
needs to be the case. For example, the following might be entirely
reasonable

msgid "We give you %.1f%%\"
msgstr "Wir geben Ihnen %.1 v.H."

(where v.H. is a common translation of '%' to German). Or, more
generally, *unless* the msgid is passed through a printf-style
formatter, percent signs are totally irrelevant.

To indicate whether percent signs are relevant, gettext uses the
c-format tag. Most domains use that tag in all relevant places, so
they don't have any problems with the checks that msgfmt performs.

It is only gcc which has dropped all c-format markers (for a good
reason), so it also dropped the tests that went along with them.

If you can guarantee that the only usage of percent signs in GCC is
for format declarators - fine. In general, such an assumption should
not be made.

> PS: Zumindest scheint mir dass der deutsche gcc-Uebersetzer mit deutscher 
> Gruendlichkeit vorgegangen ist, da finden sich kaum Fehler, im Gegensatz zum 
> Beispiel zu den Griechen oder Franzosen :-)

Dieses Problem liegt *wirklich* nicht am msgfmt. msgfmt führt alle
Tests aus, die es kann - alles andere ist domänenspezifisch.

Ciao,
Martin


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