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  <ja...@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

Reply via email to