This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] adjust warning_n() to take uhwi (PR 84207)


On Tue, Feb 27, 2018 at 03:06:53PM -0700, Martin Sebor wrote:
> On 02/22/2018 02:15 PM, Joseph Myers wrote:
> > On Thu, 22 Feb 2018, Martin Sebor wrote:
> > 
> > > Ping: https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00858.html
> > > 
> > > This is just a tweak to fix a translation bug introduced by
> > > one of my warnings (calling warning() where warning_n() is
> > > more appropriate), and to enhance warning_n() et al. to do
> > > the n % 1000000 + 1000000 computation so callers don't have
> > > to worry about it.
> > 
> > OK in the absence of diagnostic maintainer objections within 48 hours,
> > with the comment saying "ngettext()" changed to remove the "()" (see the
> > GNU Coding Standards: "Please do not write @samp{()} after a function name
> > just to indicate it is a function.  @code{foo ()} is not a function, it is
> > a function call with no arguments.").
> 
> Committed as r258044.

With the above change I can revert the
eltscnt > INT_MAX ? (eltscnt % 1000000) + 1000000 : eltscnt
stuff from inform_n call, as it can now accept all UHWI values.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed as obvious.

2018-02-28  Jakub Jelinek  <jakub@redhat.com>

	* decl.c (cp_finish_decomp): Don't adjust eltscnt when calling
	inform_n.

--- gcc/cp/decl.c.jj	2018-02-26 20:49:54.938331630 +0100
+++ gcc/cp/decl.c	2018-02-27 23:20:24.315913318 +0100
@@ -7493,10 +7493,7 @@ cp_finish_decomp (tree decl, tree first,
 	    error_n (loc, count,
 		     "only %u name provided for structured binding",
 		     "only %u names provided for structured binding", count);
-	  /* Some languages have special plural rules even for large values,
-	     but it is periodic with period of 10, 100, 1000 etc.  */
-	  inform_n (loc, eltscnt > INT_MAX
-			 ? (eltscnt % 1000000) + 1000000 : eltscnt,
+	  inform_n (loc, eltscnt,
 		    "while %qT decomposes into %wu element",
 		    "while %qT decomposes into %wu elements",
 		    type, eltscnt);

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]