Fix several clang warnings in libstdc++, which were exposed by the

recent atf import.  These changes are purely cosmetic, no functional
change.

MFC after:	1 week
This commit is contained in:
Dimitry Andric 2012-10-23 18:36:07 +00:00
parent cb69178dc0
commit a23701e59d
6 changed files with 44 additions and 34 deletions

View File

@ -38,8 +38,9 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
/// @brief Base class for ctype.
struct ctype_base
class ctype_base
{
public:
// Non-standard typedefs.
typedef const int* __to_type;

View File

@ -641,21 +641,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
setbuf(char_type* __s, streamsize __n)
{
if (!this->is_open())
if (__s == 0 && __n == 0)
_M_buf_size = 1;
else if (__s && __n > 0)
{
// This is implementation-defined behavior, and assumes that
// an external char_type array of length __n exists and has
// been pre-allocated. If this is not the case, things will
// quickly blow up. When __n > 1, __n - 1 positions will be
// used for the get area, __n - 1 for the put area and 1
// position to host the overflow char of a full put area.
// When __n == 1, 1 position will be used for the get area
// and 0 for the put area, as in the unbuffered case above.
_M_buf = __s;
_M_buf_size = __n;
}
{
if (__s == 0 && __n == 0)
_M_buf_size = 1;
else if (__s && __n > 0)
{
// This is implementation-defined behavior, and assumes that
// an external char_type array of length __n exists and has
// been pre-allocated. If this is not the case, things will
// quickly blow up. When __n > 1, __n - 1 positions will be
// used for the get area, __n - 1 for the put area and 1
// position to host the overflow char of a full put area.
// When __n == 1, 1 position will be used for the get area
// and 0 for the put area, as in the unbuffered case above.
_M_buf = __s;
_M_buf_size = __n;
}
}
return this;
}

View File

@ -4335,8 +4335,9 @@ _GLIBCXX_END_LDBL_NAMESPACE
/**
* @brief Messages facet base class providing catalog typedef.
*/
struct messages_base
class messages_base
{
public:
typedef int catalog;
};

View File

@ -316,7 +316,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
int __sep_pos = 0;
while (!__testeof)
{
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep
if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|| __c == __lc->_M_decimal_point)
break;
else if (__c == __lit[__num_base::_S_izero])
@ -558,7 +558,7 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
int __sep_pos = 0;
while (!__testeof)
{
if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep
if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
|| __c == __lc->_M_decimal_point)
break;
else if (__c == __lit[__num_base::_S_izero]
@ -748,16 +748,20 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
const char_type __c = *__beg;
if (__testf)
if (__n < __lc->_M_falsename_size)
__testf = __c == __lc->_M_falsename[__n];
else
break;
{
if (__n < __lc->_M_falsename_size)
__testf = __c == __lc->_M_falsename[__n];
else
break;
}
if (__testt)
if (__n < __lc->_M_truename_size)
__testt = __c == __lc->_M_truename[__n];
else
break;
{
if (__n < __lc->_M_truename_size)
__testt = __c == __lc->_M_truename[__n];
else
break;
}
if (!__testf && !__testt)
break;
@ -1387,9 +1391,9 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
== money_base::space)))
|| (__i == 2 && ((static_cast<part>(__p.field[3])
== money_base::value)
|| __mandatory_sign
|| (__mandatory_sign
&& (static_cast<part>(__p.field[3])
== money_base::sign))))
== money_base::sign)))))
{
const size_type __len = __lc->_M_curr_symbol_size;
size_type __j = 0;

View File

@ -160,7 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
const bool __thiseof = _M_at_eof();
const bool __beof = __b._M_at_eof();
return (__thiseof && __beof || (!__thiseof && !__beof));
return ((__thiseof && __beof) || (!__thiseof && !__beof));
}
private:

View File

@ -240,10 +240,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
const bool __testin = _M_mode & ios_base::in;
if (this->pptr() && this->pptr() > this->egptr())
if (__testin)
this->setg(this->eback(), this->gptr(), this->pptr());
else
this->setg(this->pptr(), this->pptr(), this->pptr());
{
if (__testin)
this->setg(this->eback(), this->gptr(), this->pptr());
else
this->setg(this->pptr(), this->pptr(), this->pptr());
}
}
};