This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Some more translation related tweaks
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Volker Reichelt <v dot reichelt at netcologne dot de>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Marek Polacek <polacek at redhat dot com>
- Date: Mon, 27 Feb 2017 11:27:44 +0100
- Subject: Re: [PATCH] Some more translation related tweaks
- Authentication-results: sourceware.org; auth=none
- References: <tkrat.a7532927a533bdd5@netcologne.de> <20170226123555.GW1849@tucnak> <tkrat.531701baee17c0a8@netcologne.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Feb 27, 2017 at 11:04:36AM +0100, Volker Reichelt wrote:
> > This is not -Wformat-security friendly, perhaps better
> > pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), OPT_Wvla,
> > typedef_variant_p (orig_type)
> > ? "non-constant array new length must be specified "
> > "directly, not by typedef"
> > : "non-constant array new length must be specified "
> > "without parentheses around the type-id");
> > ?
>
> Not quite. Like this the second string doesn't end up in the gcc.pot
> file for translation. I had to wrap the second string in G_(...) to make
> it work. (I'll have a look for other instances of this pattern and
> prepare a separate patch.)
Looks like a xgettext bug or missing feature :(. Joseph, shall we just
change all those to be G_() around the second string (well, some could be
simplified to be
error_at (loc, "expected %<data%> after %<#pragma acc %s%>", enter ? "enter : "exit");
because the translations should not translate the text in between %< and %>
anyway.
c/c-parser.c- if (!c_parser_require (parser, CPP_COLON,
c/c-parser.c- is_goto
c/c-parser.c: ? "expected %<:%>"
c/c-parser.c- : "expected %<:%> or %<)%>"))
c/c-parser.c: error_at (loc, enter
c/c-parser.c- ? "expected %<data%> after %<#pragma acc enter%>"
c/c-parser.c- : "expected %<data%> after %<#pragma acc exit%>");
c/c-parser.c- error_at (loc, enter
c/c-parser.c: ? "%<#pragma acc enter data%> has no data movement clause"
c/c-parser.c- : "%<#pragma acc exit data%> has no data movement clause");
cp/call.c- warning (0, (DECL_CONSTRUCTOR_P (current_function_decl)
cp/call.c: ? "pure virtual %q#D called from constructor"
cp/call.c- : "pure virtual %q#D called from destructor"),
cp/call.c- fn);
cp/decl.c- inform (DECL_SOURCE_LOCATION (field),
cp/decl.c: TREE_PRIVATE (field) ? "declared private here"
cp/decl.c- : "declared protected here");
cp/decl.c- error ((flags == DTOR_FLAG)
cp/decl.c: ? "destructors may not be ref-qualified"
cp/decl.c- : "constructors may not be ref-qualified");
cp/parser.c- error_at (loc, enter
cp/parser.c: ? "expected %<data%> after %<#pragma acc enter%>"
cp/parser.c- : "expected %<data%> after %<#pragma acc exit%>");
coverage.c: error (is_error < 0 ? "%qs has overflowed" : "%qs is corrupted",
coverage.c- da_file_name);
omp-offload.c- error_at (loop->loc,
omp-offload.c- seq_par
omp-offload.c: ? "%<seq%> overrides other OpenACC loop specifiers"
omp-offload.c- : "%<auto%> conflicts with other OpenACC loop "
omp-offload.c- "specifiers");
Then we have some really non-translatable ones:
c/c-parser.c- error_at (data->loc,
c/c-parser.c- "%<#pragma acc routine%> must be applied before %s",
c/c-parser.c: TREE_USED (fndecl) ? "use" : "definition");
which should be transformed into ? on the whole format string.
Jakub