Commit e7968bd8 by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/25649 (Bogus "uninitialized" warning)

2006-01-24  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/25649
	* include/std/std_istream.h (operator>>(short&), operator>>(int&)):
	Move out of line...
	* include/bits/istream.tcc: ... here.
	* include/std/std_ostream.h (operator<<(short), operator<<(int)):
	Move out of line...
	* include/bits/ostream.tcc: ... here.

From-SVN: r110186
parent 1bb8d49c
2006-01-24 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/25649
* include/std/std_istream.h (operator>>(short&), operator>>(int&)):
Move out of line...
* include/bits/istream.tcc: ... here.
* include/std/std_ostream.h (operator<<(short), operator<<(int)):
Move out of line...
* include/bits/ostream.tcc: ... here.
2006-01-24 Ed Smith-Rowland <3dw4rd@verizon.net>
* docs/html/faq/index.html ([5.2]): Mention TR1 and point to
......
// istream classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -135,6 +135,46 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::
operator>>(short& __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
long __l;
_M_extract(__l);
if (!this->fail())
{
if (numeric_limits<short>::min() <= __l
&& __l <= numeric_limits<short>::max())
__n = __l;
else
this->setstate(ios_base::failbit);
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::
operator>>(int& __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
long __l;
_M_extract(__l);
if (!this->fail())
{
if (numeric_limits<int>::min() <= __l
&& __l <= numeric_limits<int>::max())
__n = __l;
else
this->setstate(ios_base::failbit);
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::
operator>>(__streambuf_type* __sbout)
{
ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
......
// ostream classes -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -119,6 +119,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
return *this;
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
operator<<(short __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
return _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));
else
return _M_insert(static_cast<long>(__n));
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::
operator<<(int __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
return _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));
else
return _M_insert(static_cast<long>(__n));
}
template<typename _CharT, typename _Traits>
basic_ostream<_CharT, _Traits>&
......
// Input streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -170,45 +170,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return _M_extract(__n); }
__istream_type&
operator>>(short& __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
long __l;
_M_extract(__l);
if (!this->fail())
{
if (numeric_limits<short>::min() <= __l
&& __l <= numeric_limits<short>::max())
__n = __l;
else
this->setstate(ios_base::failbit);
}
return *this;
}
operator>>(short& __n);
__istream_type&
operator>>(unsigned short& __n)
{ return _M_extract(__n); }
__istream_type&
operator>>(int& __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
long __l;
_M_extract(__l);
if (!this->fail())
{
if (numeric_limits<int>::min() <= __l
&& __l <= numeric_limits<int>::max())
__n = __l;
else
this->setstate(ios_base::failbit);
}
return *this;
}
operator>>(int& __n);
__istream_type&
operator>>(unsigned int& __n)
{ return _M_extract(__n); }
......
// Output streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -176,16 +176,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return _M_insert(__n); }
__ostream_type&
operator<<(short __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
return _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));
else
return _M_insert(static_cast<long>(__n));
}
operator<<(short __n);
__ostream_type&
operator<<(unsigned short __n)
......@@ -196,16 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
__ostream_type&
operator<<(int __n)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 117. basic_ostream uses nonexistent num_put member functions.
const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
return _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));
else
return _M_insert(static_cast<long>(__n));
}
operator<<(int __n);
__ostream_type&
operator<<(unsigned int __n)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment