From: Jakub Jelinek Date: Thu, 18 Apr 2019 10:28:21 +0000 (+0200) Subject: re PR translation/79183 (Hard coded plurals in gimple-ssa-sprintf.c:2050) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff146a59dd0cb24043897cf90ea011eb2aa3d38b;p=gcc.git re PR translation/79183 (Hard coded plurals in gimple-ssa-sprintf.c:2050) PR translation/79183 * gimple-ssa-sprintf.c (format_directive): Use inform_n instead of inform where appropriate. From-SVN: r270438 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8100e2d187..783ae7adc93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-18 Jakub Jelinek + + PR translation/79183 + * gimple-ssa-sprintf.c (format_directive): Use inform_n instead of + inform where appropriate. + 2019-04-18 Richard Biener * tree.c (get_qualified_type): Put found type variants at the diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index ef9b874f997..a788879df6d 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -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)) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 67d9244c450..f7cfacceb9f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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)) diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index b6527bfc8d5..80b0bf825ef 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -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",