* [PATCH] Use warning_n instead of warning_at in gimple-ssa-warn-restrict.c
@ 2018-02-28 9:49 Jakub Jelinek
2018-02-28 18:27 ` Joseph Myers
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-02-28 9:49 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches, Martin Sebor
Hi!
This patch should fix most of the translation issues with plural forms
in gimple-ssa-warn-restrict.c, now that warning_n accepts UHWI, we can and
should just use warning_n in those cases.
I haven't touched the first set of warning_at calls, because the current wording
requires two plural forms in a single diagnostics, which is something
gettext can't handle. I think the only way to fix it is to break the
message appart into warning_n and inform_n.
Anyway, following has been bootstrapped/regtested on x86_64-linux and
i686-linux, ok for trunk?
2018-02-28 Jakub Jelinek <jakub@redhat.com>
* gimple-ssa-warn-restrict.c (maybe_diag_overlap): Use warning_n
instead of warning_at with conditional singular and plural messages
where possible.
--- gcc/gimple-ssa-warn-restrict.c.jj 2018-02-21 11:32:56.417681850 +0100
+++ gcc/gimple-ssa-warn-restrict.c 2018-02-27 23:39:39.157721511 +0100
@@ -1399,42 +1399,38 @@ maybe_diag_overlap (location_t loc, gcal
call, func, sizrange[0],
offstr[0], offstr[1], ovlsiz[0], offstr[2]);
else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ())
- warning_at (loc, OPT_Wrestrict,
- sizrange[0] == 1
- ? G_("%G%qD accessing %wu byte at offsets %s "
- "and %s overlaps between %wu and %wu bytes "
- "at offset %s")
- : G_("%G%qD accessing %wu bytes at offsets %s "
- "and %s overlaps between %wu and %wu bytes "
- "at offset %s"),
- call, func, sizrange[0],
- offstr[0], offstr[1], ovlsiz[0], ovlsiz[1],
- offstr[2]);
+ warning_n (loc, OPT_Wrestrict, sizrange[0],
+ "%G%qD accessing %wu byte at offsets %s "
+ "and %s overlaps between %wu and %wu bytes "
+ "at offset %s",
+ "%G%qD accessing %wu bytes at offsets %s "
+ "and %s overlaps between %wu and %wu bytes "
+ "at offset %s",
+ call, func, sizrange[0], offstr[0], offstr[1],
+ ovlsiz[0], ovlsiz[1], offstr[2]);
else
- warning_at (loc, OPT_Wrestrict,
- sizrange[0] == 1
- ? G_("%G%qD accessing %wu byte at offsets %s and "
- "%s overlaps %wu or more bytes at offset %s")
- : G_("%G%qD accessing %wu bytes at offsets %s and "
- "%s overlaps %wu or more bytes at offset %s"),
- call, func, sizrange[0],
- offstr[0], offstr[1], ovlsiz[0], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, sizrange[0],
+ "%G%qD accessing %wu byte at offsets %s and "
+ "%s overlaps %wu or more bytes at offset %s",
+ "%G%qD accessing %wu bytes at offsets %s and "
+ "%s overlaps %wu or more bytes at offset %s",
+ call, func, sizrange[0],
+ offstr[0], offstr[1], ovlsiz[0], offstr[2]);
return true;
}
if (sizrange[1] >= 0 && sizrange[1] < maxobjsize.to_shwi ())
{
if (ovlsiz[0] == ovlsiz[1])
- warning_at (loc, OPT_Wrestrict,
- ovlsiz[0] == 1
- ? G_("%G%qD accessing between %wu and %wu bytes "
- "at offsets %s and %s overlaps %wu byte at "
- "offset %s")
- : G_("%G%qD accessing between %wu and %wu bytes "
- "at offsets %s and %s overlaps %wu bytes "
- "at offset %s"),
- call, func, sizrange[0], sizrange[1],
- offstr[0], offstr[1], ovlsiz[0], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, ovlsiz[0],
+ "%G%qD accessing between %wu and %wu bytes "
+ "at offsets %s and %s overlaps %wu byte at "
+ "offset %s",
+ "%G%qD accessing between %wu and %wu bytes "
+ "at offsets %s and %s overlaps %wu bytes "
+ "at offset %s",
+ call, func, sizrange[0], sizrange[1],
+ offstr[0], offstr[1], ovlsiz[0], offstr[2]);
else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ())
warning_at (loc, OPT_Wrestrict,
"%G%qD accessing between %wu and %wu bytes at "
@@ -1457,14 +1453,13 @@ maybe_diag_overlap (location_t loc, gcal
ovlsiz[1] = maxobjsize.to_shwi ();
if (ovlsiz[0] == ovlsiz[1])
- warning_at (loc, OPT_Wrestrict,
- ovlsiz[0] == 1
- ? G_("%G%qD accessing %wu or more bytes at offsets "
- "%s and %s overlaps %wu byte at offset %s")
- : G_("%G%qD accessing %wu or more bytes at offsets "
- "%s and %s overlaps %wu bytes at offset %s"),
- call, func, sizrange[0], offstr[0], offstr[1],
- ovlsiz[0], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, ovlsiz[0],
+ "%G%qD accessing %wu or more bytes at offsets "
+ "%s and %s overlaps %wu byte at offset %s",
+ "%G%qD accessing %wu or more bytes at offsets "
+ "%s and %s overlaps %wu bytes at offset %s",
+ call, func, sizrange[0], offstr[0], offstr[1],
+ ovlsiz[0], offstr[2]);
else if (ovlsiz[1] >= 0 && ovlsiz[1] < maxobjsize.to_shwi ())
warning_at (loc, OPT_Wrestrict,
"%G%qD accessing %wu or more bytes at offsets %s "
@@ -1501,77 +1496,70 @@ maybe_diag_overlap (location_t loc, gcal
if (ovlsiz[1] == 1)
{
if (open_range)
- warning_at (loc, OPT_Wrestrict,
- sizrange[1] == 1
- ? G_("%G%qD accessing %wu byte may overlap "
- "%wu byte")
- : G_("%G%qD accessing %wu bytes may overlap "
- "%wu byte"),
- call, func, sizrange[1], ovlsiz[1]);
+ warning_n (loc, OPT_Wrestrict, sizrange[1],
+ "%G%qD accessing %wu byte may overlap "
+ "%wu byte",
+ "%G%qD accessing %wu bytes may overlap "
+ "%wu byte",
+ call, func, sizrange[1], ovlsiz[1]);
else
- warning_at (loc, OPT_Wrestrict,
- sizrange[1] == 1
- ? G_("%G%qD accessing %wu byte at offsets %s "
- "and %s may overlap %wu byte at offset %s")
- : G_("%G%qD accessing %wu bytes at offsets %s "
- "and %s may overlap %wu byte at offset %s"),
- call, func, sizrange[1], offstr[0], offstr[1],
- ovlsiz[1], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, sizrange[1],
+ "%G%qD accessing %wu byte at offsets %s "
+ "and %s may overlap %wu byte at offset %s",
+ "%G%qD accessing %wu bytes at offsets %s "
+ "and %s may overlap %wu byte at offset %s",
+ call, func, sizrange[1], offstr[0], offstr[1],
+ ovlsiz[1], offstr[2]);
return true;
}
if (open_range)
- warning_at (loc, OPT_Wrestrict,
- sizrange[1] == 1
- ? G_("%G%qD accessing %wu byte may overlap "
- "up to %wu bytes")
- : G_("%G%qD accessing %wu bytes may overlap "
- "up to %wu bytes"),
- call, func, sizrange[1], ovlsiz[1]);
+ warning_n (loc, OPT_Wrestrict, sizrange[1],
+ "%G%qD accessing %wu byte may overlap "
+ "up to %wu bytes",
+ "%G%qD accessing %wu bytes may overlap "
+ "up to %wu bytes",
+ call, func, sizrange[1], ovlsiz[1]);
else
- warning_at (loc, OPT_Wrestrict,
- sizrange[1] == 1
- ? G_("%G%qD accessing %wu byte at offsets %s and "
- "%s may overlap up to %wu bytes at offset %s")
- : G_("%G%qD accessing %wu bytes at offsets %s and "
- "%s may overlap up to %wu bytes at offset %s"),
- call, func, sizrange[1], offstr[0], offstr[1],
- ovlsiz[1], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, sizrange[1],
+ "%G%qD accessing %wu byte at offsets %s and "
+ "%s may overlap up to %wu bytes at offset %s",
+ "%G%qD accessing %wu bytes at offsets %s and "
+ "%s may overlap up to %wu bytes at offset %s",
+ call, func, sizrange[1], offstr[0], offstr[1],
+ ovlsiz[1], offstr[2]);
return true;
}
if (sizrange[1] >= 0 && sizrange[1] < maxobjsize.to_shwi ())
{
if (open_range)
- warning_at (loc, OPT_Wrestrict,
- ovlsiz[1] == 1
- ? G_("%G%qD accessing between %wu and %wu bytes "
- "may overlap %wu byte")
- : G_("%G%qD accessing between %wu and %wu bytes "
- "may overlap up to %wu bytes"),
- call, func, sizrange[0], sizrange[1], ovlsiz[1]);
+ warning_n (loc, OPT_Wrestrict, ovlsiz[1],
+ "%G%qD accessing between %wu and %wu bytes "
+ "may overlap %wu byte",
+ "%G%qD accessing between %wu and %wu bytes "
+ "may overlap up to %wu bytes",
+ call, func, sizrange[0], sizrange[1], ovlsiz[1]);
else
- warning_at (loc, OPT_Wrestrict,
- ovlsiz[1] == 1
- ? G_("%G%qD accessing between %wu and %wu bytes "
- "at offsets %s and %s may overlap %wu byte "
- "at offset %s")
- : G_("%G%qD accessing between %wu and %wu bytes "
- "at offsets %s and %s may overlap up to %wu "
- "bytes at offset %s"),
- call, func, sizrange[0], sizrange[1],
- offstr[0], offstr[1], ovlsiz[1], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, ovlsiz[1],
+ "%G%qD accessing between %wu and %wu bytes "
+ "at offsets %s and %s may overlap %wu byte "
+ "at offset %s",
+ "%G%qD accessing between %wu and %wu bytes "
+ "at offsets %s and %s may overlap up to %wu "
+ "bytes at offset %s",
+ call, func, sizrange[0], sizrange[1],
+ offstr[0], offstr[1], ovlsiz[1], offstr[2]);
return true;
}
- warning_at (loc, OPT_Wrestrict,
- ovlsiz[1] == 1
- ? G_("%G%qD accessing %wu or more bytes at offsets %s "
- "and %s may overlap %wu byte at offset %s")
- : G_("%G%qD accessing %wu or more bytes at offsets %s "
- "and %s may overlap up to %wu bytes at offset %s"),
- call, func, sizrange[0], offstr[0], offstr[1],
- ovlsiz[1], offstr[2]);
+ warning_n (loc, OPT_Wrestrict, ovlsiz[1],
+ "%G%qD accessing %wu or more bytes at offsets %s "
+ "and %s may overlap %wu byte at offset %s",
+ "%G%qD accessing %wu or more bytes at offsets %s "
+ "and %s may overlap up to %wu bytes at offset %s",
+ call, func, sizrange[0], offstr[0], offstr[1],
+ ovlsiz[1], offstr[2]);
return true;
}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Use warning_n instead of warning_at in gimple-ssa-warn-restrict.c
2018-02-28 9:49 [PATCH] Use warning_n instead of warning_at in gimple-ssa-warn-restrict.c Jakub Jelinek
@ 2018-02-28 18:27 ` Joseph Myers
0 siblings, 0 replies; 2+ messages in thread
From: Joseph Myers @ 2018-02-28 18:27 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, Martin Sebor
On Wed, 28 Feb 2018, Jakub Jelinek wrote:
> Hi!
>
> This patch should fix most of the translation issues with plural forms
> in gimple-ssa-warn-restrict.c, now that warning_n accepts UHWI, we can and
> should just use warning_n in those cases.
>
> I haven't touched the first set of warning_at calls, because the current wording
> requires two plural forms in a single diagnostics, which is something
> gettext can't handle. I think the only way to fix it is to break the
> message appart into warning_n and inform_n.
>
> Anyway, following has been bootstrapped/regtested on x86_64-linux and
> i686-linux, ok for trunk?
OK.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-28 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 9:49 [PATCH] Use warning_n instead of warning_at in gimple-ssa-warn-restrict.c Jakub Jelinek
2018-02-28 18:27 ` Joseph Myers
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).