re PR translation/79183 (Hard coded plurals in gimple-ssa-sprintf.c:2050)
authorJakub Jelinek <jakub@redhat.com>
Thu, 18 Apr 2019 10:28:21 +0000 (12:28 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 18 Apr 2019 10:28:21 +0000 (12:28 +0200)
PR translation/79183
* gimple-ssa-sprintf.c (format_directive): Use inform_n instead of
inform where appropriate.

From-SVN: r270438

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

index c8100e2d1877e6e5006323c7bbbefb88389986eb..783ae7adc930aa6af4dbb42559565e4289236cf0 100644 (file)
@@ -1,3 +1,9 @@
+2019-04-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR translation/79183
+       * gimple-ssa-sprintf.c (format_directive): Use inform_n instead of
+       inform where appropriate.
+
 2019-04-18  Richard Biener  <rguenther@suse.de>
 
        * tree.c (get_qualified_type): Put found type variants at the
index ef9b874f997762cd456736c426d9281c95dc49b1..a788879df6d9c96c38b77bfe03e59e5008a2d921 100644 (file)
@@ -2513,7 +2513,24 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
        {
          tree remove = TREE_TYPE (newdecl);
          if (TYPE_MAIN_VARIANT (remove) == remove)
-           gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+           {
+             gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+             /* If remove is the main variant, no need to remove that
+                from the list.  One of the DECL_ORIGINAL_TYPE
+                variants, e.g. created for aligned attribute, might still
+                refer to the newdecl TYPE_DECL though, so remove that one
+                in that case.  */
+             if (DECL_ORIGINAL_TYPE (newdecl)
+                 && DECL_ORIGINAL_TYPE (newdecl) != remove)
+               for (tree t = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (newdecl));
+                    ; t = TYPE_MAIN_VARIANT (t))
+                 if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl)
+                   {
+                     TYPE_NEXT_VARIANT (t)
+                       = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t));
+                     break;
+                   }
+           }       
          else
            for (tree t = TYPE_MAIN_VARIANT (remove); ;
                 t = TYPE_NEXT_VARIANT (t))
index 67d9244c450e3fb878064f243454461644c1ab4c..f7cfacceb9fa5fd2ff52758b907c7a3800685d0f 100644 (file)
@@ -2133,7 +2133,24 @@ next_arg:;
            {
              tree remove = TREE_TYPE (newdecl);
              if (TYPE_MAIN_VARIANT (remove) == remove)
-               gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+               {
+                 gcc_assert (TYPE_NEXT_VARIANT (remove) == NULL_TREE);
+                 /* If remove is the main variant, no need to remove that
+                    from the list.  One of the DECL_ORIGINAL_TYPE
+                    variants, e.g. created for aligned attribute, might still
+                    refer to the newdecl TYPE_DECL though, so remove that one
+                    in that case.  */
+                 if (tree orig = DECL_ORIGINAL_TYPE (newdecl))
+                   if (orig != remove)
+                     for (tree t = TYPE_MAIN_VARIANT (orig); ;
+                          t = TYPE_MAIN_VARIANT (t))
+                       if (TYPE_NAME (TYPE_NEXT_VARIANT (t)) == newdecl)
+                         {
+                           TYPE_NEXT_VARIANT (t)
+                             = TYPE_NEXT_VARIANT (TYPE_NEXT_VARIANT (t));
+                           break;
+                         }
+               }           
              else
                for (tree t = TYPE_MAIN_VARIANT (remove); ;
                     t = TYPE_NEXT_VARIANT (t))
index b6527bfc8d53a90d601db541becfa5bfe05c620e..80b0bf825efcbdc0255f2abface89062c00a3d2e 100644 (file)
@@ -3016,12 +3016,10 @@ format_directive (const sprintf_dom_walker::call_info &info,
             help the user figure out how big a buffer they need.  */
 
          if (min == max)
-           inform (callloc,
-                   (min == 1
-                    ? G_("%qE output %wu byte into a destination of size %wu")
-                    : G_("%qE output %wu bytes into a destination of size "
-                         "%wu")),
-                   info.func, min, info.objsize);
+           inform_n (callloc, min,
+                     "%qE output %wu byte into a destination of size %wu",
+                     "%qE output %wu bytes into a destination of size %wu",
+                     info.func, min, info.objsize);
          else if (max < HOST_WIDE_INT_MAX)
            inform (callloc,
                    "%qE output between %wu and %wu bytes into "
@@ -3044,11 +3042,9 @@ format_directive (const sprintf_dom_walker::call_info &info,
             of printf with no destination size just print the computed
             result.  */
          if (min == max)
-           inform (callloc,
-                   (min == 1
-                    ? G_("%qE output %wu byte")
-                    : G_("%qE output %wu bytes")),
-                   info.func, min);
+           inform_n (callloc, min,
+                     "%qE output %wu byte", "%qE output %wu bytes",
+                     info.func, min);
          else if (max < HOST_WIDE_INT_MAX)
            inform (callloc,
                    "%qE output between %wu and %wu bytes",