This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18248] c_parse_error i18n problems
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Oct 2004 10:58:21 -0000
- Subject: [Bug c++/18248] c_parse_error i18n problems
- References: <20041031103409.18248.jsm28@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joseph at codesourcery dot com 2004-10-31 10:58 -------
Subject: Re: c_parse_error i18n problems
On Sun, 31 Oct 2004, gdr at cs dot tamu dot edu wrote:
> Notice that in all the cases where the sentences are combined, the
> parts all come from string lietrals. There ought to be a way to have
> the compiler build those (kind of compile-time introspection facilities).
It's not the compiler that would need to build them, it's exgettext.
We've improved on xgettext's defaults with that wrapper which looks for
parameters called msgid, but at a certain point you reach excess
complexity and it would be better to write the source code in a more
i18n-friendly way.
One possibility I considered to avoid eight sentences everywhere is an
additional format escape, say %K, which takes a token as argument; a new
structure to store both token type and value as a single argument would be
needed. The messages would then be of the form "expected ';' before %K".
The trouble with this is that the token descriptions in c_parse_error
include pieces of English text as well as actual token text; though it
might be possible to change things so that the original token text from
cpplib is available for diagnostics and use something like "before <EOF>"
in place of "at end of input" so all the messages use a single form.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18248