gimple-ssa-sprintf.c (format_directive): Use inform_n instead of inform with hardcode...
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Dec 2017 21:06:04 +0000 (22:06 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Dec 2017 21:06:04 +0000 (22:06 +0100)
* gimple-ssa-sprintf.c (format_directive): Use inform_n instead of
inform with hardcoded english plural handling.

From-SVN: r255840

gcc/ChangeLog
gcc/gimple-ssa-sprintf.c

index 8a80f18045baf522a21e7b04f735f686b256680b..39b102fc24e8473e4b265231686bfdf42ef02181 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-19  Jakub Jelinek  <jakub@redhat.com>
+
+       * gimple-ssa-sprintf.c (format_directive): Use inform_n instead of
+       inform with hardcoded english plural handling.
+
 2017-12-18  Jeff Law  <law@redhat.com>
 
        PR tree-optimization/83477
index eddc20e2ac4e1006cd910d8b9e3c5fdefd720745..4275755c7bf4bb32e9e44417405e719a679e8f55 100644 (file)
@@ -2933,13 +2933,15 @@ format_directive (const sprintf_dom_walker::call_info &info,
 
   if (warned && fmtres.range.min < fmtres.range.likely
       && fmtres.range.likely < fmtres.range.max)
-    {
-      inform (info.fmtloc,
-             (1 == fmtres.range.likely
-              ? G_("assuming directive output of %wu byte")
-              : G_("assuming directive output of %wu bytes")),
+    /* Some languages have special plural rules even for large values,
+       but it is periodic with period of 10, 100, 1000 etc.  */
+    inform_n (info.fmtloc,
+             fmtres.range.likely > INT_MAX
+             ? (fmtres.range.likely % 1000000) + 1000000
+             : fmtres.range.likely,
+             "assuming directive output of %wu byte",
+             "assuming directive output of %wu bytes",
              fmtres.range.likely);
-    }
 
   if (warned && fmtres.argmin)
     {