aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-strlen.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-02-27 22:06:03 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-02-27 15:06:03 -0700
commit1c89478aef3ef9576f40013c3969179b3189ee95 (patch)
tree8c1be1842ced105c7f3ce3afef09764b30ff037a /gcc/tree-ssa-strlen.c
parent76bd270a7df7dbf5a02046072947802365bb67f6 (diff)
downloadgcc-1c89478aef3ef9576f40013c3969179b3189ee95.zip
gcc-1c89478aef3ef9576f40013c3969179b3189ee95.tar.gz
gcc-1c89478aef3ef9576f40013c3969179b3189ee95.tar.bz2
PR translation/84207 - Hard coded plural in gimple-fold.c
gcc/ChangeLog: PR translation/84207 * diagnostic-core.h (warning_n, error_n, inform_n): Change n argument to unsigned HOST_WIDE_INT. * diagnostic.c (warning_n, error_n, inform_n): Ditto. (diagnostic_n_impl): Ditto. Handle arguments in excess of LONG_MAX. * gimple-ssa-sprintf.c (format_directive): Simplify inform_n call. * tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Use warning_n. From-SVN: r258044
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r--gcc/tree-ssa-strlen.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 71ed0ff..1266f39 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1943,27 +1943,27 @@ maybe_diag_stxncpy_trunc (gimple_stmt_iterator gsi, tree src, tree cnt)
gcall *call = as_a <gcall *> (stmt);
if (lenrange[0] == cntrange[1] && cntrange[0] == cntrange[1])
- return warning_at (callloc, OPT_Wstringop_truncation,
- (integer_onep (cnt)
- ? G_("%G%qD output truncated before terminating "
- "nul copying %E byte from a string of the "
- "same length")
- : G_("%G%qD output truncated before terminating nul "
- "copying %E bytes from a string of the same "
- "length")),
- call, func, cnt);
+ return warning_n (callloc, OPT_Wstringop_truncation,
+ cntrange[0].to_uhwi (),
+ "%G%qD output truncated before terminating "
+ "nul copying %E byte from a string of the "
+ "same length",
+ "%G%qD output truncated before terminating nul "
+ "copying %E bytes from a string of the same "
+ "length",
+ call, func, cnt);
else if (wi::geu_p (lenrange[0], cntrange[1]))
{
/* The shortest string is longer than the upper bound of
the count so the truncation is certain. */
if (cntrange[0] == cntrange[1])
- return warning_at (callloc, OPT_Wstringop_truncation,
- integer_onep (cnt)
- ? G_("%G%qD output truncated copying %E byte "
- "from a string of length %wu")
- : G_("%G%qD output truncated copying %E bytes "
- "from a string of length %wu"),
- call, func, cnt, lenrange[0].to_uhwi ());
+ return warning_n (callloc, OPT_Wstringop_truncation,
+ cntrange[0].to_uhwi (),
+ "%G%qD output truncated copying %E byte "
+ "from a string of length %wu",
+ "%G%qD output truncated copying %E bytes "
+ "from a string of length %wu",
+ call, func, cnt, lenrange[0].to_uhwi ());
return warning_at (callloc, OPT_Wstringop_truncation,
"%G%qD output truncated copying between %wu "
@@ -1976,13 +1976,13 @@ maybe_diag_stxncpy_trunc (gimple_stmt_iterator gsi, tree src, tree cnt)
/* The longest string is longer than the upper bound of
the count so the truncation is possible. */
if (cntrange[0] == cntrange[1])
- return warning_at (callloc, OPT_Wstringop_truncation,
- integer_onep (cnt)
- ? G_("%G%qD output may be truncated copying %E "
- "byte from a string of length %wu")
- : G_("%G%qD output may be truncated copying %E "
- "bytes from a string of length %wu"),
- call, func, cnt, lenrange[1].to_uhwi ());
+ return warning_n (callloc, OPT_Wstringop_truncation,
+ cntrange[0].to_uhwi (),
+ "%G%qD output may be truncated copying %E "
+ "byte from a string of length %wu",
+ "%G%qD output may be truncated copying %E "
+ "bytes from a string of length %wu",
+ call, func, cnt, lenrange[1].to_uhwi ());
return warning_at (callloc, OPT_Wstringop_truncation,
"%G%qD output may be truncated copying between %wu "