[C++ PATCH] Make some type forbidden diagnostics translatable (PR translation/90035)
Jason Merrill
jason@redhat.com
Thu Apr 11 15:20:00 GMT 2019
On 4/11/19 3:50 AM, Jakub Jelinek wrote:
> Hi!
>
> While looking into another PR, I've noticed that in two spots the
> parser->type_definition_forbidden_message messages are untranslatable,
> we construct them at runtime from 3 strings using concat.
>
> The following patch fixes it by adding a const char * member
> to the parser structure and passing that as another argument to error,
> in the more usual case where the argument string only contains %< and %>
> and not %qs added in this patch it will be just ignored.
>
> I believe this patch is more friendly to the translators (as well as
> less expensive at compile time because it doesn't have to concat/allocate
> anything).
>
> Another possibility would be to just use in cp_parser_has_attribute_expression
> G_("types may not be defined in %<__builtin_has_attribute%> expressions")
> and in cp_parser_sizeof_operand use a switch based on the 3 possible keyword
> values and use
> G_("types may not be defined in %<sizeof%> expressions")
> G_("types may not be defined in %<__alignof__%> expressions")
> G_("types may not be defined in %<alignof%> expressions")
> G_("types may not be defined in %<typeof%> expressions")
> depending on that (and C++ mode which determines which alignof spelling is
> in ridpointers). We wouldn't need to add an extra member, on the other side
> the translators would need to translate 5 messages instead of just one.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK.
Jason
More information about the Gcc-patches
mailing list