public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-9566] libstdc++: Fix -Wsign-compare warnings in headers
@ 2021-03-29 20:01 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-03-29 20:01 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:66eca0bbc86a31987349cc0ee239b429382f05c9

commit r10-9566-g66eca0bbc86a31987349cc0ee239b429382f05c9
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 27 16:32:53 2020 +0000

    libstdc++: Fix -Wsign-compare warnings in headers
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/locale_conv.h (__str_codecvt_out_all):
            Add cast to compare operands of the same signedness.
            * include/bits/locale_facets_nonio.tcc
            (time_get::_M_extract_wday_or_month): Likewise.
            * include/bits/sstream.tcc (basic_stringbuf::overflow):
            Likewise.
            * include/tr1/legendre_function.tcc (__sph_legendre): Use
            unsigned for loop variable.
    
    (cherry picked from commit 2232b6136822cc44d835f2b788e8d2d77b898878)

Diff:
---
 libstdc++-v3/include/bits/locale_conv.h           | 2 +-
 libstdc++-v3/include/bits/locale_facets_nonio.tcc | 4 ++--
 libstdc++-v3/include/bits/sstream.tcc             | 2 +-
 libstdc++-v3/include/tr1/legendre_function.tcc    | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h
index f1d7032e8bc..52c37a4feac 100644
--- a/libstdc++-v3/include/bits/locale_conv.h
+++ b/libstdc++-v3/include/bits/locale_conv.h
@@ -185,7 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       _State __state = {};
       size_t __n;
       return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n)
-	&& (__n == (__last - __first));
+	&& (__n == size_t(__last - __first));
     }
 
 #ifdef _GLIBCXX_USE_CHAR8_T
diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.tcc b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
index 17b12c92f6c..194a4328550 100644
--- a/libstdc++-v3/include/bits/locale_facets_nonio.tcc
+++ b/libstdc++-v3/include/bits/locale_facets_nonio.tcc
@@ -1046,8 +1046,8 @@ _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11
       if ((__nmatches == 1 && __matches_lengths[0] == __pos)
 	  || (__nmatches == 2 && (__matches_lengths[0] == __pos
 				  || __matches_lengths[1] == __pos)))
-	__member = (__matches[0] >= __indexlen
-		    ? __matches[0] - __indexlen : __matches[0]);
+	__member = (__matches[0] >= (int)__indexlen
+		    ? __matches[0] - (int)__indexlen : __matches[0]);
       else
 	__err |= ios_base::failbit;
 
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 9e70c36d071..5dd06002a0c 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -90,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const __size_type __capacity = _M_string.capacity();
 
 #if _GLIBCXX_USE_CXX11_ABI
-      if ((this->epptr() - this->pbase()) < __capacity)
+      if (size_t(this->epptr() - this->pbase()) < __capacity)
 	{
 	  // There is additional capacity in _M_string that can be used.
 	  char_type* __base = const_cast<char_type*>(_M_string.data());
diff --git a/libstdc++-v3/include/tr1/legendre_function.tcc b/libstdc++-v3/include/tr1/legendre_function.tcc
index 126355beb31..1e66a5a2e57 100644
--- a/libstdc++-v3/include/tr1/legendre_function.tcc
+++ b/libstdc++-v3/include/tr1/legendre_function.tcc
@@ -274,7 +274,7 @@ namespace tr1
               _Tp __y_lm = _Tp(0);
 
               // Compute Y_l^m, l > m+1, upward recursion on l.
-              for (int __ll = __m + 2; __ll <= __l; ++__ll)
+              for (unsigned int __ll = __m + 2; __ll <= __l; ++__ll)
                 {
                   const _Tp __rat1 = _Tp(__ll - __m) / _Tp(__ll + __m);
                   const _Tp __rat2 = _Tp(__ll - __m - 1) / _Tp(__ll + __m - 1);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-29 20:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 20:01 [gcc r10-9566] libstdc++: Fix -Wsign-compare warnings in headers Jonathan Wakely

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).