On Tue, Feb 25, 2025 at 05:17:10PM +0100, Jakub Jelinek wrote:
> Hi!
> 
> HOST_WIDE_INT_PRINT* macros aren't supposed to be used in
> gcc-internal-format format strings, we have the w modifier for HOST_WIDE_INT
> in that case, the HOST_WIDE_INT_PRINT* macros might not work properly on
> some hosts (e.g. mingw32 has HOST_LONG_LONG_FORMAT "I64" and that is
> something pretty-print doesn't handle, while it handles "ll" for long long)
> and also the use of macros in the middle of format strings breaks
> translations (both that exgettext can't retrieve the string from there
> and we get
> #: config/pru/pru-pragma.cc:61
> msgid "%<CTABLE_ENTRY%> index %"
> msgstr ""
> 
> #: config/pru/pru-pragma.cc:64
> msgid "redefinition of %<CTABLE_ENTRY %"
> msgstr ""
> in po/gcc.pot and also the macros are different on different hosts,
> so even if exgettext extracted say "%<CTABLE_ENTRY%> index %lld is not valid"
> it could be translated on some hosts but not e.g. mingw32).
> 
> So, the following patch just uses %wd instead.
> 
> Build tested x86_64-linux -> pru-elf cross and tested it before/after the
> patch on
> #pragma ctable_entry 12 0x48040000
> #pragma ctable_entry 1024 0x48040000
> #pragma ctable_entry 12 0x48040001
> and the result is the same.
> 
> Ok for trunk?

Yes, it's ok.

Thank you,
Dimitar

> 
> 2025-02-25  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR translation/118991
>       * config/pru/pru-pragma.cc (pru_pragma_ctable_entry): Use %wd
>       instead of %" HOST_WIDE_INT_PRINT "d to print a hwi in error.
> 

Reply via email to