* [PATCH] Some more translation related tweaks @ 2017-02-26 12:36 Volker Reichelt 2017-02-26 13:25 ` Jakub Jelinek 0 siblings, 1 reply; 11+ messages in thread From: Volker Reichelt @ 2017-02-26 12:36 UTC (permalink / raw) To: gcc-patches; +Cc: Jakub Jelinek, Marek Polacek After Jakub's and Marek's latest translation patches, I grepped for other unmarked messages. Here's what I found in the C++ front-end. Bootstrapped/regtested on x86_64-linux, ok for trunk? Regards, Volker 2017-02-26 Volker Reichelt <v.reichelt@netcologne.de> * init.c: Include intl.h (build_new_1): Mark strings for translation. * pt.c (tsubst_copy_and_build): Mark string for translation. Make the pointer const. * semantics.c (finish_id_expression): Mark strings for translation. Index: gcc/cp/init.c =================================================================== --- gcc/cp/init.c (revision 245719) +++ gcc/cp/init.c (working copy) @@ -29,6 +29,7 @@ #include "varasm.h" #include "gimplify.h" #include "c-family/c-ubsan.h" +#include "intl.h" static bool begin_init_stmts (tree *, tree *); static tree finish_init_stmts (bool, tree, tree); @@ -2805,11 +2806,11 @@ { const char *msg; if (typedef_variant_p (orig_type)) - msg = ("non-constant array new length must be specified " - "directly, not by typedef"); + msg = G_("non-constant array new length must be specified " + "directly, not by typedef"); else - msg = ("non-constant array new length must be specified " - "without parentheses around the type-id"); + msg = G_("non-constant array new length must be specified " + "without parentheses around the type-id"); pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), OPT_Wvla, msg); } Index: gcc/cp/pt.c =================================================================== --- gcc/cp/pt.c (revision 245719) +++ gcc/cp/pt.c (working copy) @@ -17190,10 +17190,11 @@ stricter. */ bool in_lambda = (current_class_type && LAMBDA_TYPE_P (current_class_type)); - char const *msg = "%qD was not declared in this scope, " - "and no declarations were found by " - "argument-dependent lookup at the point " - "of instantiation"; + char const *const msg = + G_("%qD was not declared in this scope, " + "and no declarations were found by " + "argument-dependent lookup at the point " + "of instantiation"); bool diag = true; if (in_lambda) Index: gcc/cp/semantics.c =================================================================== --- gcc/cp/semantics.c (revision 245719) +++ gcc/cp/semantics.c (working copy) @@ -3510,7 +3510,7 @@ && DECL_CONTEXT (decl) == NULL_TREE && !cp_unevaluated_operand) { - *error_msg = "use of parameter outside function body"; + *error_msg = G_("use of parameter outside function body"); return error_mark_node; } } @@ -3520,13 +3520,13 @@ if (TREE_CODE (decl) == TEMPLATE_DECL && !DECL_FUNCTION_TEMPLATE_P (decl)) { - *error_msg = "missing template arguments"; + *error_msg = G_("missing template arguments"); return error_mark_node; } else if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == NAMESPACE_DECL) { - *error_msg = "expected primary-expression"; + *error_msg = G_("expected primary-expression"); return error_mark_node; } =================================================================== ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-26 12:36 [PATCH] Some more translation related tweaks Volker Reichelt @ 2017-02-26 13:25 ` Jakub Jelinek 2017-02-27 10:27 ` Volker Reichelt 0 siblings, 1 reply; 11+ messages in thread From: Jakub Jelinek @ 2017-02-26 13:25 UTC (permalink / raw) To: Volker Reichelt; +Cc: gcc-patches, Marek Polacek On Sun, Feb 26, 2017 at 01:18:57PM +0100, Volker Reichelt wrote: > 2017-02-26 Volker Reichelt <v.reichelt@netcologne.de> > > * init.c: Include intl.h Missing . > @@ -29,6 +29,7 @@ > #include "varasm.h" > #include "gimplify.h" > #include "c-family/c-ubsan.h" > +#include "intl.h" > > static bool begin_init_stmts (tree *, tree *); > static tree finish_init_stmts (bool, tree, tree); > @@ -2805,11 +2806,11 @@ > { > const char *msg; > if (typedef_variant_p (orig_type)) > - msg = ("non-constant array new length must be specified " > - "directly, not by typedef"); > + msg = G_("non-constant array new length must be specified " > + "directly, not by typedef"); > else > - msg = ("non-constant array new length must be specified " > - "without parentheses around the type-id"); > + msg = G_("non-constant array new length must be specified " > + "without parentheses around the type-id"); > pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), > OPT_Wvla, msg); 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"); ? > } > Index: gcc/cp/pt.c > =================================================================== > --- gcc/cp/pt.c (revision 245719) > +++ gcc/cp/pt.c (working copy) > @@ -17190,10 +17190,11 @@ > stricter. */ > bool in_lambda = (current_class_type > && LAMBDA_TYPE_P (current_class_type)); > - char const *msg = "%qD was not declared in this scope, " > - "and no declarations were found by " > - "argument-dependent lookup at the point " > - "of instantiation"; > + char const *const msg = = should go on the next line in this case, i.e. = G_("%qD was not declared in this scope, " Jakub ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-26 13:25 ` Jakub Jelinek @ 2017-02-27 10:27 ` Volker Reichelt 2017-02-27 11:15 ` Jakub Jelinek 2017-02-27 13:33 ` Jakub Jelinek 0 siblings, 2 replies; 11+ messages in thread From: Volker Reichelt @ 2017-02-27 10:27 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Marek Polacek On 26 Feb, Jakub Jelinek wrote: > On Sun, Feb 26, 2017 at 01:18:57PM +0100, Volker Reichelt wrote: >> 2017-02-26 Volker Reichelt <v.reichelt@netcologne.de> >> >> * init.c: Include intl.h > > Missing . Indeed, I noticed that one after I hit the send button. >> @@ -29,6 +29,7 @@ >> #include "varasm.h" >> #include "gimplify.h" >> #include "c-family/c-ubsan.h" >> +#include "intl.h" >> >> static bool begin_init_stmts (tree *, tree *); >> static tree finish_init_stmts (bool, tree, tree); >> @@ -2805,11 +2806,11 @@ >> { >> const char *msg; >> if (typedef_variant_p (orig_type)) >> - msg = ("non-constant array new length must be specified " >> - "directly, not by typedef"); >> + msg = G_("non-constant array new length must be specified " >> + "directly, not by typedef"); >> else >> - msg = ("non-constant array new length must be specified " >> - "without parentheses around the type-id"); >> + msg = G_("non-constant array new length must be specified " >> + "without parentheses around the type-id"); >> pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), >> OPT_Wvla, msg); > > 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.) >> } >> Index: gcc/cp/pt.c >> =================================================================== >> --- gcc/cp/pt.c (revision 245719) >> +++ gcc/cp/pt.c (working copy) >> @@ -17190,10 +17190,11 @@ >> stricter. */ >> bool in_lambda = (current_class_type >> && LAMBDA_TYPE_P (current_class_type)); >> - char const *msg = "%qD was not declared in this scope, " >> - "and no declarations were found by " >> - "argument-dependent lookup at the point " >> - "of instantiation"; >> + char const *const msg = > > = should go on the next line in this case, i.e. > = G_("%qD was not declared in this scope, " Indeed, thanks for noticing. > > Jakub So here's the second attempt: 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de> * init.c: Include intl.h. (build_new_1): Move message strings into pedwarn to make them -Wformat-security friendly. Mark string for translation. * pt.c (tsubst_copy_and_build): Mark string for translation. Make the pointer const. * semantics.c (finish_id_expression): Mark strings for translation. Index: gcc/cp/init.c =================================================================== --- gcc/cp/init.c (revision 245719) +++ gcc/cp/init.c (working copy) @@ -29,6 +29,7 @@ #include "varasm.h" #include "gimplify.h" #include "c-family/c-ubsan.h" +#include "intl.h" static bool begin_init_stmts (tree *, tree *); static tree finish_init_stmts (bool, tree, tree); @@ -2803,15 +2804,12 @@ { if (complain & tf_warning_or_error) { - const char *msg; - if (typedef_variant_p (orig_type)) - msg = ("non-constant array new length must be specified " - "directly, not by typedef"); - else - msg = ("non-constant array new length must be specified " - "without parentheses around the type-id"); - pedwarn (EXPR_LOC_OR_LOC (outer_nelts, input_location), - OPT_Wvla, msg); + 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" + : G_("non-constant array new length must be specified " + "without parentheses around the type-id")); } else return error_mark_node; Index: gcc/cp/pt.c =================================================================== --- gcc/cp/pt.c (revision 245719) +++ gcc/cp/pt.c (working copy) @@ -17190,10 +17190,11 @@ stricter. */ bool in_lambda = (current_class_type && LAMBDA_TYPE_P (current_class_type)); - char const *msg = "%qD was not declared in this scope, " - "and no declarations were found by " - "argument-dependent lookup at the point " - "of instantiation"; + char const *const msg + = G_("%qD was not declared in this scope, " + "and no declarations were found by " + "argument-dependent lookup at the point " + "of instantiation"); bool diag = true; if (in_lambda) Index: gcc/cp/semantics.c =================================================================== --- gcc/cp/semantics.c (revision 245719) +++ gcc/cp/semantics.c (working copy) @@ -3510,7 +3510,7 @@ && DECL_CONTEXT (decl) == NULL_TREE && !cp_unevaluated_operand) { - *error_msg = "use of parameter outside function body"; + *error_msg = G_("use of parameter outside function body"); return error_mark_node; } } @@ -3520,13 +3520,13 @@ if (TREE_CODE (decl) == TEMPLATE_DECL && !DECL_FUNCTION_TEMPLATE_P (decl)) { - *error_msg = "missing template arguments"; + *error_msg = G_("missing template arguments"); return error_mark_node; } else if (TREE_CODE (decl) == TYPE_DECL || TREE_CODE (decl) == NAMESPACE_DECL) { - *error_msg = "expected primary-expression"; + *error_msg = G_("expected primary-expression"); return error_mark_node; } =================================================================== Bootstrapped/regtested on x86_64-linux, ok for trunk? Regards, Volker ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 10:27 ` Volker Reichelt @ 2017-02-27 11:15 ` Jakub Jelinek 2017-02-27 12:49 ` Joseph Myers 2017-02-27 13:33 ` Jakub Jelinek 1 sibling, 1 reply; 11+ messages in thread From: Jakub Jelinek @ 2017-02-27 11:15 UTC (permalink / raw) To: Volker Reichelt, Joseph S. Myers; +Cc: gcc-patches, Marek Polacek 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 11:15 ` Jakub Jelinek @ 2017-02-27 12:49 ` Joseph Myers 2017-02-27 19:23 ` Jakub Jelinek 0 siblings, 1 reply; 11+ messages in thread From: Joseph Myers @ 2017-02-27 12:49 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Volker Reichelt, gcc-patches, Marek Polacek On Mon, 27 Feb 2017, Jakub Jelinek wrote: > 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 Yes, it's generally the case that G_() is used whenever there's a conditional expression for the msgid argument to a diagnostic function. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 12:49 ` Joseph Myers @ 2017-02-27 19:23 ` Jakub Jelinek 2017-02-27 22:27 ` Joseph Myers 2017-03-01 10:20 ` Tom de Vries 0 siblings, 2 replies; 11+ messages in thread From: Jakub Jelinek @ 2017-02-27 19:23 UTC (permalink / raw) To: Joseph Myers; +Cc: Volker Reichelt, gcc-patches, Marek Polacek On Mon, Feb 27, 2017 at 12:47:09PM +0000, Joseph Myers wrote: > On Mon, 27 Feb 2017, Jakub Jelinek wrote: > > > 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 > > Yes, it's generally the case that G_() is used whenever there's a > conditional expression for the msgid argument to a diagnostic function. So, is this ok for trunk? Shall I regenerate gcc.pot or will you? 2017-02-27 Jakub Jelinek <jakub@redhat.com> * config/i386/i386.c (ix86_option_override_internal): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Likewise. * coverage.c (read_counts_file): Likewise. * omp-offload.c (oacc_loop_fixed_partitions): Likewise. * gcov.c (read_count_file): Use cond ? N_("...") : N_("...") instead of just cond ? "..." : "...". c/ * c-parser.c (c_parser_asm_statement): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". (c_parser_oacc_enter_exit_data): Use %s and ternary operator only for "enter"/"exit" keyword. (c_finish_oacc_routine): Don't use %s to supply portions of the message. cp/ * decl.c (find_decomp_class_base): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". (grokdeclarator): Likewise. (build_enumerator): Likewise. * init.c (build_new_1): Likewise. * call.c (build_new_method_call_1): Likewise. * parser.c (cp_parser_oacc_enter_exit_data): Use %s and ternary operator only for "enter"/"exit" keyword. (cp_finalize_oacc_routine): Don't use %s to supply portions of the message. fortran/ * parse.c (parse_critical_block): Use cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". * scanner.c (gfc_next_char_literal): Likewise. * match.c (match_exit_cycle): Likewise. --- gcc/config/i386/i386.c.jj 2017-02-21 15:38:48.000000000 +0100 +++ gcc/config/i386/i386.c 2017-02-27 15:47:08.665621000 +0100 @@ -5265,11 +5265,11 @@ ix86_option_override_internal (bool main else if (!strcmp (opts->x_ix86_tune_string, "x86-64")) warning (OPT_Wdeprecated, main_args_p - ? "%<-mtune=x86-64%> is deprecated; use %<-mtune=k8%> " - "or %<-mtune=generic%> instead as appropriate" - : "%<target(\"tune=x86-64\")%> is deprecated; use " - "%<target(\"tune=k8\")%> or %<target(\"tune=generic\")%> " - "instead as appropriate"); + ? G_("%<-mtune=x86-64%> is deprecated; use %<-mtune=k8%> " + "or %<-mtune=generic%> instead as appropriate") + : G_("%<target(\"tune=x86-64\")%> is deprecated; use " + "%<target(\"tune=k8\")%> or %<target(\"tune=generic\")%>" + " instead as appropriate")); } else { @@ -5418,17 +5418,19 @@ ix86_option_override_internal (bool main if (!strcmp (opts->x_ix86_arch_string, "generic")) { error (main_args_p - ? "%<generic%> CPU can be used only for %<-mtune=%> switch" - : "%<generic%> CPU can be used only for " - "%<target(\"tune=\")%> attribute"); + ? G_("%<generic%> CPU can be used only for %<-mtune=%> " + "switch") + : G_("%<generic%> CPU can be used only for " + "%<target(\"tune=\")%> attribute")); return false; } else if (!strcmp (opts->x_ix86_arch_string, "intel")) { error (main_args_p - ? "%<intel%> CPU can be used only for %<-mtune=%> switch" - : "%<intel%> CPU can be used only for " - "%<target(\"tune=\")%> attribute"); + ? G_("%<intel%> CPU can be used only for %<-mtune=%> " + "switch") + : G_("%<intel%> CPU can be used only for " + "%<target(\"tune=\")%> attribute")); return false; } @@ -5656,8 +5658,8 @@ ix86_option_override_internal (bool main if (i == pta_size) { error (main_args_p - ? "bad value (%qs) for %<-march=%> switch" - : "bad value (%qs) for %<target(\"arch=\")%> attribute", + ? G_("bad value (%qs) for %<-march=%> switch") + : G_("bad value (%qs) for %<target(\"arch=\")%> attribute"), opts->x_ix86_arch_string); auto_vec <const char *> candidates; @@ -5674,16 +5676,16 @@ ix86_option_override_internal (bool main if (hint) inform (input_location, main_args_p - ? "valid arguments to %<-march=%> switch are: " - "%s; did you mean %qs?" - : "valid arguments to %<target(\"arch=\")%> attribute are: " - "%s; did you mean %qs?", s, hint); + ? G_("valid arguments to %<-march=%> switch are: " + "%s; did you mean %qs?") + : G_("valid arguments to %<target(\"arch=\")%> attribute are: " + "%s; did you mean %qs?"), s, hint); else inform (input_location, main_args_p - ? "valid arguments to %<-march=%> switch are: %s" - : "valid arguments to %<target(\"arch=\")%> attribute are: %s", - s); + ? G_("valid arguments to %<-march=%> switch are: %s") + : G_("valid arguments to %<target(\"arch=\")%> attribute " + "are: %s"), s); XDELETEVEC (s); } @@ -5729,8 +5731,8 @@ ix86_option_override_internal (bool main if (ix86_tune_specified && i == pta_size) { error (main_args_p - ? "bad value (%qs) for %<-mtune=%> switch" - : "bad value (%qs) for %<target(\"tune=\")%> attribute", + ? G_("bad value (%qs) for %<-mtune=%> switch") + : G_("bad value (%qs) for %<target(\"tune=\")%> attribute"), opts->x_ix86_tune_string); auto_vec <const char *> candidates; @@ -5745,16 +5747,16 @@ ix86_option_override_internal (bool main if (hint) inform (input_location, main_args_p - ? "valid arguments to %<-mtune=%> switch are: " - "%s; did you mean %qs?" - : "valid arguments to %<target(\"tune=\")%> attribute are: " - "%s; did you mean %qs?", s, hint); + ? G_("valid arguments to %<-mtune=%> switch are: " + "%s; did you mean %qs?") + : G_("valid arguments to %<target(\"tune=\")%> attribute are: " + "%s; did you mean %qs?"), s, hint); else inform (input_location, main_args_p - ? "valid arguments to %<-mtune=%> switch are: %s" - : "valid arguments to %<target(\"tune=\")%> attribute are: %s", - s); + ? G_("valid arguments to %<-mtune=%> switch are: %s") + : G_("valid arguments to %<target(\"tune=\")%> attribute " + "are: %s"), s); XDELETEVEC (s); } @@ -5856,8 +5858,9 @@ ix86_option_override_internal (bool main if (TARGET_RTD_P (opts->x_target_flags)) warning (0, - main_args_p ? "%<-mrtd%> is ignored in 64bit mode" - : "%<target(\"rtd\")%> is ignored in 64bit mode"); + main_args_p + ? G_("%<-mrtd%> is ignored in 64bit mode") + : G_("%<target(\"rtd\")%> is ignored in 64bit mode")); } else { @@ -5979,8 +5982,8 @@ ix86_option_override_internal (bool main if (TARGET_SSEREGPARM_P (opts->x_target_flags) && ! TARGET_SSE_P (opts->x_ix86_isa_flags)) error (main_args_p - ? "%<-msseregparm%> used without SSE enabled" - : "%<target(\"sseregparm\")%> used without SSE enabled"); + ? G_("%<-msseregparm%> used without SSE enabled") + : G_("%<target(\"sseregparm\")%> used without SSE enabled")); if (opts_set->x_ix86_fpmath) { @@ -6047,10 +6050,11 @@ ix86_option_override_internal (bool main if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS) warning (0, main_args_p - ? "stack probing requires %<-maccumulate-outgoing-args%> " - "for correctness" - : "stack probing requires " - "%<target(\"accumulate-outgoing-args\")%> for correctness"); + ? G_("stack probing requires %<-maccumulate-outgoing-args%> " + "for correctness") + : G_("stack probing requires " + "%<target(\"accumulate-outgoing-args\")%> for " + "correctness")); opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS; } @@ -6062,9 +6066,10 @@ ix86_option_override_internal (bool main if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS) warning (0, main_args_p - ? "fixed ebp register requires %<-maccumulate-outgoing-args%>" - : "fixed ebp register requires " - "%<target(\"accumulate-outgoing-args\")%>"); + ? G_("fixed ebp register requires " + "%<-maccumulate-outgoing-args%>") + : G_("fixed ebp register requires " + "%<target(\"accumulate-outgoing-args\")%>")); opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS; } --- gcc/config/nvptx/nvptx.c.jj 2017-02-21 15:36:03.000000000 +0100 +++ gcc/config/nvptx/nvptx.c 2017-02-27 15:48:20.031688240 +0100 @@ -4542,8 +4542,8 @@ nvptx_goacc_validate_dims (tree decl, in if (fn_level < 0 && dims[GOMP_DIM_VECTOR] >= 0) warning_at (decl ? DECL_SOURCE_LOCATION (decl) : UNKNOWN_LOCATION, 0, dims[GOMP_DIM_VECTOR] - ? "using vector_length (%d), ignoring %d" - : "using vector_length (%d), ignoring runtime setting", + ? G_("using vector_length (%d), ignoring %d") + : G_("using vector_length (%d), ignoring runtime setting"), PTX_VECTOR_LENGTH, dims[GOMP_DIM_VECTOR]); dims[GOMP_DIM_VECTOR] = PTX_VECTOR_LENGTH; changed = true; --- gcc/cp/decl.c.jj 2017-02-27 15:19:13.000000000 +0100 +++ gcc/cp/decl.c 2017-02-27 15:36:41.655834700 +0100 @@ -7224,8 +7224,9 @@ find_decomp_class_base (location_t loc, error_at (loc, "cannot decompose non-public member %qD of %qT", field, type); inform (DECL_SOURCE_LOCATION (field), - TREE_PRIVATE (field) ? "declared private here" - : "declared protected here"); + TREE_PRIVATE (field) + ? G_("declared private here") + : G_("declared protected here")); return error_mark_node; } else @@ -11001,8 +11002,8 @@ grokdeclarator (const cp_declarator *dec { maybe_warn_cpp0x (CPP0X_REF_QUALIFIER); error ((flags == DTOR_FLAG) - ? "destructors may not be ref-qualified" - : "constructors may not be ref-qualified"); + ? G_("destructors may not be ref-qualified") + : G_("constructors may not be ref-qualified")); rqual = REF_QUAL_NONE; } @@ -14484,9 +14485,10 @@ build_enumerator (tree name, tree value, } if (type && cxx_dialect < cxx11 && itk > itk_unsigned_long) - pedwarn (input_location, OPT_Wlong_long, pos ? "\ -incremented enumerator value is too large for %<unsigned long%>" : "\ -incremented enumerator value is too large for %<long%>"); + pedwarn (input_location, OPT_Wlong_long, + pos ? G_("\ +incremented enumerator value is too large for %<unsigned long%>") : G_("\ +incremented enumerator value is too large for %<long%>")); } if (type == NULL_TREE) overflowed = true; --- gcc/cp/parser.c.jj 2017-02-24 21:39:13.000000000 +0100 +++ gcc/cp/parser.c 2017-02-27 15:38:31.480392105 +0100 @@ -36293,9 +36293,8 @@ cp_parser_oacc_enter_exit_data (cp_parse if (strcmp (p, "data") != 0) { - error_at (loc, enter - ? "expected %<data%> after %<#pragma acc enter%>" - : "expected %<data%> after %<#pragma acc exit%>"); + error_at (loc, "expected %<data%> after %<#pragma acc %s%>", + enter ? "enter" : "exit"); cp_parser_skip_to_pragma_eol (parser, pragma_tok); return NULL_TREE; } @@ -37573,8 +37572,10 @@ cp_finalize_oacc_routine (cp_parser *par if (TREE_USED (fndecl) || (!is_defn && DECL_SAVED_TREE (fndecl))) { error_at (parser->oacc_routine->loc, - "%<#pragma acc routine%> must be applied before %s", - TREE_USED (fndecl) ? "use" : "definition"); + TREE_USED (fndecl) + ? G_("%<#pragma acc routine%> must be applied before use") + : G_("%<#pragma acc routine%> must be applied before " + "definition")); parser->oacc_routine = NULL; return; } --- gcc/cp/init.c.jj 2017-02-27 15:19:13.000000000 +0100 +++ gcc/cp/init.c 2017-02-27 18:20:40.162038982 +0100 @@ -2806,8 +2806,8 @@ build_new_1 (vec<tree, va_gc> **placemen { 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" + ? G_("non-constant array new length must be specified " + "directly, not by typedef") : G_("non-constant array new length must be specified " "without parentheses around the type-id")); } --- gcc/cp/call.c.jj 2017-02-25 09:32:11.000000000 +0100 +++ gcc/cp/call.c 2017-02-27 15:35:04.939105117 +0100 @@ -8772,8 +8772,8 @@ build_new_method_call_1 (tree instance, else if (DECL_CONSTRUCTOR_P (current_function_decl) || DECL_DESTRUCTOR_P (current_function_decl)) warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) - ? "pure virtual %q#D called from constructor" - : "pure virtual %q#D called from destructor"), + ? G_("pure virtual %q#D called from constructor") + : G_("pure virtual %q#D called from destructor")), fn); } --- gcc/c/c-parser.c.jj 2017-02-24 21:39:13.000000000 +0100 +++ gcc/c/c-parser.c 2017-02-27 15:33:46.634133688 +0100 @@ -6159,8 +6159,8 @@ c_parser_asm_statement (c_parser *parser { if (!c_parser_require (parser, CPP_COLON, is_goto - ? "expected %<:%>" - : "expected %<:%> or %<)%>")) + ? G_("expected %<:%>") + : G_("expected %<:%> or %<)%>"))) goto error_close_paren; /* Once past any colon, we're no longer a simple asm. */ @@ -13925,9 +13925,8 @@ c_parser_oacc_enter_exit_data (c_parser if (strcmp (p, "data") != 0) { - error_at (loc, enter - ? "expected %<data%> after %<#pragma acc enter%>" - : "expected %<data%> after %<#pragma acc exit%>"); + error_at (loc, "expected %<data%> after %<#pragma acc %s%>", + enter ? "enter" : "exit"); parser->error = true; c_parser_skip_to_pragma_eol (parser); return; @@ -13942,9 +13941,8 @@ c_parser_oacc_enter_exit_data (c_parser if (omp_find_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE) { - error_at (loc, enter - ? "%<#pragma acc enter data%> has no data movement clause" - : "%<#pragma acc exit data%> has no data movement clause"); + error_at (loc, "%<#pragma acc %s data%> has no data movement clause", + enter ? "enter" : "exit"); return; } @@ -14270,8 +14268,10 @@ c_finish_oacc_routine (struct oacc_routi if (TREE_USED (fndecl) || (!is_defn && DECL_SAVED_TREE (fndecl))) { error_at (data->loc, - "%<#pragma acc routine%> must be applied before %s", - TREE_USED (fndecl) ? "use" : "definition"); + TREE_USED (fndecl) + ? G_("%<#pragma acc routine%> must be applied before use") + : G_("%<#pragma acc routine%> must be applied before " + "definition")); data->error_seen = true; return; } --- gcc/gcov.c.jj 2017-01-22 20:27:10.000000000 +0100 +++ gcc/gcov.c 2017-02-27 15:24:49.919183680 +0100 @@ -1669,7 +1669,10 @@ read_count_file (function_t *fns) gcov_sync (base, length); if ((error = gcov_is_error ())) { - fnotice (stderr, error < 0 ? "%s:overflowed\n" : "%s:corrupted\n", + fnotice (stderr, + error < 0 + ? N_("%s:overflowed\n") + : N_("%s:corrupted\n"), da_file_name); goto cleanup; } --- gcc/coverage.c.jj 2017-01-01 12:45:35.000000000 +0100 +++ gcc/coverage.c 2017-02-27 15:22:31.736998766 +0100 @@ -327,7 +327,9 @@ read_counts_file (void) gcov_sync (offset, length); if ((is_error = gcov_is_error ())) { - error (is_error < 0 ? "%qs has overflowed" : "%qs is corrupted", + error (is_error < 0 + ? G_("%qs has overflowed") + : G_("%qs is corrupted"), da_file_name); delete counts_hash; counts_hash = NULL; --- gcc/fortran/parse.c.jj 2017-02-20 13:43:22.000000000 +0100 +++ gcc/fortran/parse.c 2017-02-27 15:40:58.610459485 +0100 @@ -4340,8 +4340,8 @@ parse_critical_block (void) for (sd = gfc_state_stack; sd; sd = sd->previous) if (sd->state == COMP_OMP_STRUCTURED_BLOCK) gfc_error_now (is_oacc (sd) - ? "CRITICAL block inside of OpenACC region at %C" - : "CRITICAL block inside of OpenMP region at %C"); + ? G_("CRITICAL block inside of OpenACC region at %C") + : G_("CRITICAL block inside of OpenMP region at %C")); s.ext.end_do_label = new_st.label1; --- gcc/fortran/scanner.c.jj 2017-01-01 12:45:47.000000000 +0100 +++ gcc/fortran/scanner.c 2017-02-27 15:41:56.106706170 +0100 @@ -1406,10 +1406,11 @@ restart: if (i == 4) old_loc = gfc_current_locus; } - gfc_error (is_openmp ? "Wrong OpenACC continuation at %C: " - "expected !$ACC, got !$OMP" - : "Wrong OpenMP continuation at %C: " - "expected !$OMP, got !$ACC"); + gfc_error (is_openmp + ? G_("Wrong OpenACC continuation at %C: " + "expected !$ACC, got !$OMP") + : G_("Wrong OpenMP continuation at %C: " + "expected !$OMP, got !$ACC")); } if (c != '&') @@ -1502,10 +1503,11 @@ restart: if (gfc_wide_tolower (c) != (unsigned char) "*$acc"[i]) is_openmp = 1; } - gfc_error (is_openmp ? "Wrong OpenACC continuation at %C: " - "expected !$ACC, got !$OMP" - : "Wrong OpenMP continuation at %C: " - "expected !$OMP, got !$ACC"); + gfc_error (is_openmp + ? G_("Wrong OpenACC continuation at %C: " + "expected !$ACC, got !$OMP") + : G_("Wrong OpenMP continuation at %C: " + "expected !$OMP, got !$ACC")); } else if (!openmp_flag && !openacc_flag) for (i = 0; i < 5; i++) --- gcc/fortran/match.c.jj 2017-02-13 12:20:49.000000000 +0100 +++ gcc/fortran/match.c 2017-02-27 15:40:04.876165309 +0100 @@ -2731,8 +2731,8 @@ match_exit_cycle (gfc_statement st, gfc_ if (o != NULL) { gfc_error (is_oacc (p) - ? "%s statement at %C leaving OpenACC structured block" - : "%s statement at %C leaving OpenMP structured block", + ? G_("%s statement at %C leaving OpenACC structured block") + : G_("%s statement at %C leaving OpenMP structured block"), gfc_ascii_statement (st)); return MATCH_ERROR; } --- gcc/omp-offload.c.jj 2017-02-14 20:40:09.000000000 +0100 +++ gcc/omp-offload.c 2017-02-27 15:27:11.694321400 +0100 @@ -1117,9 +1117,9 @@ oacc_loop_fixed_partitions (oacc_loop *l if (noisy) error_at (loop->loc, seq_par - ? "%<seq%> overrides other OpenACC loop specifiers" - : "%<auto%> conflicts with other OpenACC loop " - "specifiers"); + ? G_("%<seq%> overrides other OpenACC loop specifiers") + : G_("%<auto%> conflicts with other OpenACC loop " + "specifiers")); maybe_auto = false; loop->flags &= ~OLF_AUTO; if (seq_par) Jakub ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 19:23 ` Jakub Jelinek @ 2017-02-27 22:27 ` Joseph Myers 2017-03-01 10:20 ` Tom de Vries 1 sibling, 0 replies; 11+ messages in thread From: Joseph Myers @ 2017-02-27 22:27 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Volker Reichelt, gcc-patches, Marek Polacek On Mon, 27 Feb 2017, Jakub Jelinek wrote: > > Yes, it's generally the case that G_() is used whenever there's a > > conditional expression for the msgid argument to a diagnostic function. > > So, is this ok for trunk? Shall I regenerate gcc.pot or will you? OK. I'll regenerate gcc.pot in a few weeks' time. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 19:23 ` Jakub Jelinek 2017-02-27 22:27 ` Joseph Myers @ 2017-03-01 10:20 ` Tom de Vries 2017-03-01 11:14 ` Jakub Jelinek 1 sibling, 1 reply; 11+ messages in thread From: Tom de Vries @ 2017-03-01 10:20 UTC (permalink / raw) To: Jakub Jelinek, Joseph Myers; +Cc: Volker Reichelt, gcc-patches, Marek Polacek On 27/02/17 18:33, Jakub Jelinek wrote: > On Mon, Feb 27, 2017 at 12:47:09PM +0000, Joseph Myers wrote: >> On Mon, 27 Feb 2017, Jakub Jelinek wrote: >> >>> 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 >> >> Yes, it's generally the case that G_() is used whenever there's a >> conditional expression for the msgid argument to a diagnostic function. > > So, is this ok for trunk? Shall I regenerate gcc.pot or will you? > > 2017-02-27 Jakub Jelinek <jakub@redhat.com> > > * config/i386/i386.c (ix86_option_override_internal): Use > cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". > * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Likewise. > --- gcc/config/nvptx/nvptx.c.jj 2017-02-21 15:36:03.000000000 +0100 > +++ gcc/config/nvptx/nvptx.c 2017-02-27 15:48:20.031688240 +0100 > @@ -4542,8 +4542,8 @@ nvptx_goacc_validate_dims (tree decl, in > if (fn_level < 0 && dims[GOMP_DIM_VECTOR] >= 0) > warning_at (decl ? DECL_SOURCE_LOCATION (decl) : UNKNOWN_LOCATION, 0, > dims[GOMP_DIM_VECTOR] > - ? "using vector_length (%d), ignoring %d" > - : "using vector_length (%d), ignoring runtime setting", > + ? G_("using vector_length (%d), ignoring %d") > + : G_("using vector_length (%d), ignoring runtime setting"), > PTX_VECTOR_LENGTH, dims[GOMP_DIM_VECTOR]); > dims[GOMP_DIM_VECTOR] = PTX_VECTOR_LENGTH; > changed = true; This breaks the nvptx build: ... src/gcc-mainline/gcc/config/nvptx/nvptx.c: In function 'bool nvptx_goacc_validate_dims(tree, int*, int)': src/gcc-mainline/gcc/config/nvptx/nvptx.c:4545:51: error: 'G_' was not declared in this scope ... I suppose an #include "intl.h" will fix that. Thanks, - Tom ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-03-01 10:20 ` Tom de Vries @ 2017-03-01 11:14 ` Jakub Jelinek 0 siblings, 0 replies; 11+ messages in thread From: Jakub Jelinek @ 2017-03-01 11:14 UTC (permalink / raw) To: Tom de Vries; +Cc: Joseph Myers, Volker Reichelt, gcc-patches, Marek Polacek On Wed, Mar 01, 2017 at 11:20:37AM +0100, Tom de Vries wrote: > > 2017-02-27 Jakub Jelinek <jakub@redhat.com> > > > > * config/i386/i386.c (ix86_option_override_internal): Use > > cond ? G_("...") : G_("...") instead of just cond ? "..." : "...". > > * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Likewise. > > > --- gcc/config/nvptx/nvptx.c.jj 2017-02-21 15:36:03.000000000 +0100 > > +++ gcc/config/nvptx/nvptx.c 2017-02-27 15:48:20.031688240 +0100 > > @@ -4542,8 +4542,8 @@ nvptx_goacc_validate_dims (tree decl, in > > if (fn_level < 0 && dims[GOMP_DIM_VECTOR] >= 0) > > warning_at (decl ? DECL_SOURCE_LOCATION (decl) : UNKNOWN_LOCATION, 0, > > dims[GOMP_DIM_VECTOR] > > - ? "using vector_length (%d), ignoring %d" > > - : "using vector_length (%d), ignoring runtime setting", > > + ? G_("using vector_length (%d), ignoring %d") > > + : G_("using vector_length (%d), ignoring runtime setting"), > > PTX_VECTOR_LENGTH, dims[GOMP_DIM_VECTOR]); > > dims[GOMP_DIM_VECTOR] = PTX_VECTOR_LENGTH; > > changed = true; > > This breaks the nvptx build: > ... > src/gcc-mainline/gcc/config/nvptx/nvptx.c: In function 'bool > nvptx_goacc_validate_dims(tree, int*, int)': > src/gcc-mainline/gcc/config/nvptx/nvptx.c:4545:51: error: 'G_' was not > declared in this scope > ... Oops, sorry, I've fixed it in i386.c and two other files, but missed nvptx.c. Fixed thusly, committed to trunk: 2017-03-01 Jakub Jelinek <jakub@redhat.com> * config/nvptx/nvptx.c: Include intl.h. --- gcc/config/nvptx/nvptx.c.jj 2017-02-28 16:24:05.000000000 +0100 +++ gcc/config/nvptx/nvptx.c 2017-03-01 11:24:04.178802355 +0100 @@ -69,6 +69,7 @@ #include "tree-phinodes.h" #include "cfgloop.h" #include "fold-const.h" +#include "intl.h" /* This file should be included last. */ #include "target-def.h" Jakub ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 10:27 ` Volker Reichelt 2017-02-27 11:15 ` Jakub Jelinek @ 2017-02-27 13:33 ` Jakub Jelinek 2017-02-27 13:40 ` Volker Reichelt 1 sibling, 1 reply; 11+ messages in thread From: Jakub Jelinek @ 2017-02-27 13:33 UTC (permalink / raw) To: Volker Reichelt; +Cc: gcc-patches, Marek Polacek On Mon, Feb 27, 2017 at 11:04:36AM +0100, Volker Reichelt wrote: > So here's the second attempt: > > 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de> > > * init.c: Include intl.h. > (build_new_1): Move message strings into pedwarn to make them > -Wformat-security friendly. Mark string for translation. > * pt.c (tsubst_copy_and_build): Mark string for translation. > Make the pointer const. > * semantics.c (finish_id_expression): Mark strings for translation. Ok for trunk then, I'll deal with the rest I've mentioned in another mail myself. Jakub ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Some more translation related tweaks 2017-02-27 13:33 ` Jakub Jelinek @ 2017-02-27 13:40 ` Volker Reichelt 0 siblings, 0 replies; 11+ messages in thread From: Volker Reichelt @ 2017-02-27 13:40 UTC (permalink / raw) To: Jakub Jelinek; +Cc: gcc-patches, Marek Polacek On 27 Feb, Jakub Jelinek wrote: > On Mon, Feb 27, 2017 at 11:04:36AM +0100, Volker Reichelt wrote: >> So here's the second attempt: >> >> 2017-02-27 Volker Reichelt <v.reichelt@netcologne.de> >> >> * init.c: Include intl.h. >> (build_new_1): Move message strings into pedwarn to make them >> -Wformat-security friendly. Mark string for translation. >> * pt.c (tsubst_copy_and_build): Mark string for translation. >> Make the pointer const. >> * semantics.c (finish_id_expression): Mark strings for translation. > > Ok for trunk then, I'll deal with the rest I've mentioned in another mail > myself. > > Jakub Ok, committed as revision 245757. Volker ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-03-01 11:14 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-02-26 12:36 [PATCH] Some more translation related tweaks Volker Reichelt 2017-02-26 13:25 ` Jakub Jelinek 2017-02-27 10:27 ` Volker Reichelt 2017-02-27 11:15 ` Jakub Jelinek 2017-02-27 12:49 ` Joseph Myers 2017-02-27 19:23 ` Jakub Jelinek 2017-02-27 22:27 ` Joseph Myers 2017-03-01 10:20 ` Tom de Vries 2017-03-01 11:14 ` Jakub Jelinek 2017-02-27 13:33 ` Jakub Jelinek 2017-02-27 13:40 ` Volker Reichelt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).