diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-24 23:12:26 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-24 23:12:26 +0000 |
commit | 9c97629c71b58dce735b54e260c661ab4c6b9d3e (patch) | |
tree | 0558f5ac52e349770963b953c4a0a8c8d314d828 /libstdc++-v3 | |
parent | 1ca60af3097a4fec3d249272d45ac08c5a6ec8d9 (diff) | |
download | gcc-9c97629c71b58dce735b54e260c661ab4c6b9d3e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110186 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 10 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/istream.tcc | 42 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/ostream.tcc | 30 | ||||
-rw-r--r-- | libstdc++-v3/include/std/std_istream.h | 38 | ||||
-rw-r--r-- | libstdc++-v3/include/std/std_ostream.h | 24 |
5 files changed, 87 insertions, 57 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ef4577ef87b..b9c2cdb26e5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +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 diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index 184c2bd613f..5b5da65aaf5 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -1,6 +1,6 @@ // 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); diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index 7b80495c7e8..7f9fbcfb077 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -1,6 +1,6 @@ // 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>& diff --git a/libstdc++-v3/include/std/std_istream.h b/libstdc++-v3/include/std/std_istream.h index 659d3e2a2d7..862793e9ffe 100644 --- a/libstdc++-v3/include/std/std_istream.h +++ b/libstdc++-v3/include/std/std_istream.h @@ -1,6 +1,6 @@ // 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); } diff --git a/libstdc++-v3/include/std/std_ostream.h b/libstdc++-v3/include/std/std_ostream.h index 8dc398ed0ef..23a19c98d32 100644 --- a/libstdc++-v3/include/std/std_ostream.h +++ b/libstdc++-v3/include/std/std_ostream.h @@ -1,6 +1,6 @@ // 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) |