diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-10-27 16:32:53 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-10-27 16:32:53 +0000 |
commit | 2232b6136822cc44d835f2b788e8d2d77b898878 (patch) | |
tree | 560ac37621e90e166a797d4a2847c5f57f2982bf | |
parent | f6b710fc6f93db3ce2fda08e025c3badac7996b0 (diff) | |
download | gcc-2232b6136822cc44d835f2b788e8d2d77b898878.tar.gz |
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.
-rw-r--r-- | libstdc++-v3/include/bits/locale_conv.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets_nonio.tcc | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/sstream.tcc | 2 | ||||
-rw-r--r-- | 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 ff84d7349cd..a8639f6ba28 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); |