public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-4169] libstdc++: Fix -Wsign-compare warnings in std::format
Date: Sat, 19 Nov 2022 15:08:16 +0000 (GMT)	[thread overview]
Message-ID: <20221119150816.D73DE3857838@sourceware.org> (raw)

https://gcc.gnu.org/g:18169e8eee1887cdd200897c30ac26bec8721729

commit r13-4169-g18169e8eee1887cdd200897c30ac26bec8721729
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Nov 18 21:06:18 2022 +0000

    libstdc++: Fix -Wsign-compare warnings in std::format
    
    libstdc++-v3/ChangeLog:
    
            * include/std/format: Fix -Wsign-compare warnings.

Diff:
---
 libstdc++-v3/include/std/format | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index f4fc85a16d2..561ae161d16 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -291,7 +291,7 @@ namespace __format
 	}
       else
 	{
-	  constexpr size_t __n = 32;
+	  constexpr int __n = 32;
 	  char __buf[__n]{};
 	  for (int __i = 0; __i < __n && __first != __last; ++__i)
 	    __buf[__i] = __first[__i];
@@ -1544,7 +1544,7 @@ namespace __format
 
 	      if (size_t __extras = int(__d == __p) + __z)
 		{
-		  if (__dynbuf.empty() && __extras <= (__end - __res.ptr))
+		  if (__dynbuf.empty() && __extras <= size_t(__end - __res.ptr))
 		    {
 		      // Move exponent to make space for extra chars.
 		      __builtin_memmove(__start + __p + __extras,
@@ -2357,7 +2357,7 @@ namespace __format
       _M_write(_CharT __c)
       {
 	*_M_next++ = __c;
-	if (_M_next - _M_span.begin() == _M_span.size()) [[unlikely]]
+	if (_M_next - _M_span.begin() == std::ssize(_M_span)) [[unlikely]]
 	  _M_overflow();
       }
 
@@ -2469,7 +2469,7 @@ namespace __format
 	auto __used = this->_M_used();
 	if (_M_max < 0) // No maximum.
 	  _M_out = ranges::copy(__used, std::move(_M_out)).out;
-	else if (_M_count < _M_max)
+	else if (_M_count < size_t(_M_max))
 	  {
 	    auto __max = _M_max - _M_count;
 	    span<_CharT> __first;

                 reply	other threads:[~2022-11-19 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221119150816.D73DE3857838@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).