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.
This commit is contained in:
Jonathan Wakely 2020-10-27 16:32:53 +00:00
parent f6b710fc6f
commit 2232b61368
4 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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;

View File

@ -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());

View File

@ -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);