On Tue, Mar 12, 2019 at 10:58:14AM +0100, Jakub Jelinek wrote:
> These are the only remaining cases of gcc-internal-format diagnostics using
> HOST_WIDE_INT_PRINT*.  That is wrong because the string depends on the exact
> host, and xgettext doesn't handle it anyway, so in gcc.pot the messages are
> truncated at the spot where HOST_WIDE_INT_PRINT* appears.  See also
> PR79846 for an earlier change of the same kind.
> 
> Tested on a cross to s390x-linux on the 
> gcc.target/s390/htm-builtins-compile-2.c
> testcase.  Ok for trunk?
> 
> 2019-03-12  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR target/52726
>       * config/s390/s390.md (tabort): Use %wd instead of
>       HOST_WIDE_INT_PRINT_DEC in error message, reword to avoid two capital
>       letters and periods.
>       * config/tilepro/tilepro.c (tilepro_print_operand): Use %wd in
>       output_operand_lossage instead of HOST_WIDE_INT_PRINT_DEC, replace
>       's with %< and %>.

Unfortunately, today while building gcc.pot I've noticed:
config/tilepro/tilepro.c:4774: warning: Although being used in a format string 
position, the msgid is not a valid C format string. Reason: In the directive 
number 2, the token after '<' is not the name of a format specifier macro. The 
valid macro names are listed in ISO C 99 section 7.8.1.
Indeed, output_operand_lossage argument is not gcc-internal-format, so
it can't use %wd nor %< nor %>.  It is printed using:
  va_start (ap, cmsgid);

  pfx_str = this_is_asm_operands ? _("invalid 'asm': ") : "output_operand: ";
  fmt_string = xasprintf ("%s%s", pfx_str, _(cmsgid));
  new_message = xvasprintf (fmt_string, ap);

  if (this_is_asm_operands)
    error_for_asm (this_is_asm_operands, "%s", new_message);
  else
    internal_error ("%s", new_message);
so can use just the fprintf format specifiers.  While I perhaps could use
%ld instead of %<%wd%> and cast the HOST_WIDE_INT argument to long, it
doesn't seem to be worth it IMHO, if the argument is not a CONST_INT, we
print also just invalid %%t operand, so I'd suggest doing following.

Ok for trunk?

2019-04-11  Jakub Jelinek  <ja...@redhat.com>

        PR target/52726
        * config/tilepro/tilepro.c (tilepro_print_operand): Use just
        "invalid %%t operand" in output_operand_lossage message.

--- gcc/config/tilepro/tilepro.c.jj     2019-03-12 10:46:40.995960027 +0100
+++ gcc/config/tilepro/tilepro.c        2019-04-11 14:54:01.708668318 +0200
@@ -4771,7 +4771,7 @@ tilepro_print_operand (FILE *file, rtx x
        i = exact_log2 (n);
        if (i < 0)
          {
-           output_operand_lossage ("invalid %%t operand %<%wd%>", n);
+           output_operand_lossage ("invalid %%t operand");
            return;
          }
 


        Jakub

Reply via email to