2003-07-04 15:14:54 +08:00
|
|
|
// basic_ios member functions -*- C++ -*-
|
2000-10-05 19:27:02 +08:00
|
|
|
|
2019-01-01 20:31:55 +08:00
|
|
|
// Copyright (C) 1999-2019 Free Software Foundation, Inc.
|
2000-10-05 19:27:02 +08:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 23:00:19 +08:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2000-10-05 19:27:02 +08:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 23:00:19 +08:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2000-10-05 19:27:02 +08:00
|
|
|
|
2010-12-19 17:21:16 +08:00
|
|
|
/** @file bits/basic_ios.tcc
|
2004-11-24 12:11:23 +08:00
|
|
|
* This is an internal header file, included by other library headers.
|
2010-12-19 17:21:16 +08:00
|
|
|
* Do not attempt to use it directly. @headername{ios}
|
2004-11-24 12:11:23 +08:00
|
|
|
*/
|
|
|
|
|
2003-07-05 12:05:45 +08:00
|
|
|
#ifndef _BASIC_IOS_TCC
|
|
|
|
#define _BASIC_IOS_TCC 1
|
2000-10-05 19:27:02 +08:00
|
|
|
|
2002-02-17 03:33:43 +08:00
|
|
|
#pragma GCC system_header
|
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-31 06:39:36 +08:00
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
2005-12-19 08:56:05 +08:00
|
|
|
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 08:19:13 +08:00
|
|
|
template<typename _CharT, typename _Traits>
|
|
|
|
void
|
|
|
|
basic_ios<_CharT, _Traits>::clear(iostate __state)
|
2004-02-08 12:46:42 +08:00
|
|
|
{
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 08:19:13 +08:00
|
|
|
if (this->rdbuf())
|
|
|
|
_M_streambuf_state = __state;
|
|
|
|
else
|
|
|
|
_M_streambuf_state = __state | badbit;
|
re PR libstdc++/9371 (Bad exception handling in i/ostream::operator>>/<<(streambuf*))
2003-11-26 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/9371
PR libstdc++/9546
PR libstdc++/10093
PR libstdc++/10095
* include/bits/basic_ios.h (basic_ios::setstate): Elide if goodbit.
(basic_ios::_M_setstate): Consolidate common error handling code.
* include/bits/basic_ios.tcc: Tweak.
* include/bits/fstream.tcc: Tweak.
* include/bits/istream.tcc: Use _M_setstate for common exception
handling. Move setstate calls after catch.
(basic_istream::tellg): Check for exceptions thrown by streambuf
virtual functions.
(basic_istream::seekg): Same.
* include/bits/ostream.tcc: Same, but for ostream.
(basic_ostream::flush): Check for exceptions thrown by streambuf
virtual functions.
(basic_istream::tellp): Same.
(basic_istream::seekp): Same.
* include/bits/locale_facets.tcc: Tweak.
* include/bits/streambuf.tcc: Tweak.
(__copy_streambufs): Propagate exceptions.
* testsuite/testsuite_io.h (fail_streambuf): New.
(fail_num_get): New.
(fail_num_put): New.
(facet_error): New.
(underflow_error): New.
(overflow_error): New.
(positioning_error): New.
* testsuite/27_io/basic_istream/exceptions/char/9561.cc: Tweak.
* testsuite/27_io/basic_istream/extractors_arithmetic/char/
exceptions_badbit_throw.cc, exceptions_failbit.cc,
exceptions_failbit_throw.cc: New.
* testsuite/27_io/basic_istream/extractors_other/char/
error_failbit.cc, exceptions_badbit_throw.cc,
exceptions_failbit_throw.cc, exceptions_null.cc: New.
* testsuite/27_io/basic_istream/seekg/char/exceptions_badbit_throw.cc:
New.
* testsuite/27_io/basic_istream/tellg/char/exceptions_badbit_throw.cc:
New.
* testsuite/27_io/basic_ostream/flush/char/exceptions_badbit_throw.cc:
New.
* testsuite/27_io/basic_ostream/inserters_arithmetic/char/
exceptions_badbit_throw.cc, exceptions_failbit_throw.cc: New.
* testsuite/27_io/basic_ostream/inserters_other/char/
error_failbit.cc, exceptions_badbit_throw.cc,
exceptions_failbit_throw.cc, exceptions_null.cc: New.
* testsuite/27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc:
New.
* testsuite/27_io/basic_ostream/tellp/char/exceptions_badbit_throw.cc:
New.
From-SVN: r73979
2003-11-27 16:14:25 +08:00
|
|
|
if (this->exceptions() & this->rdstate())
|
2004-01-27 08:49:03 +08:00
|
|
|
__throw_ios_failure(__N("basic_ios::clear"));
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 08:19:13 +08:00
|
|
|
}
|
2004-02-08 12:46:42 +08:00
|
|
|
|
2000-10-05 19:27:02 +08:00
|
|
|
template<typename _CharT, typename _Traits>
|
2004-02-08 12:46:42 +08:00
|
|
|
basic_streambuf<_CharT, _Traits>*
|
2000-10-05 19:27:02 +08:00
|
|
|
basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
|
|
|
|
{
|
|
|
|
basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;
|
|
|
|
_M_streambuf = __sb;
|
|
|
|
this->clear();
|
|
|
|
return __old;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits>
|
|
|
|
basic_ios<_CharT, _Traits>&
|
|
|
|
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
|
|
|
|
{
|
2003-10-22 23:44:19 +08:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 292. effects of a.copyfmt (a)
|
2003-10-24 22:24:00 +08:00
|
|
|
if (this != &__rhs)
|
2002-04-02 02:39:37 +08:00
|
|
|
{
|
2003-10-24 22:24:00 +08:00
|
|
|
// Per 27.1.1, do not call imbue, yet must trash all caches
|
|
|
|
// associated with imbue()
|
2004-02-08 12:46:42 +08:00
|
|
|
|
2003-10-24 22:24:00 +08:00
|
|
|
// Alloc any new word array first, so if it fails we have "rollback".
|
|
|
|
_Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?
|
|
|
|
_M_local_word : new _Words[__rhs._M_word_size];
|
|
|
|
|
|
|
|
// Bump refs before doing callbacks, for safety.
|
|
|
|
_Callback_list* __cb = __rhs._M_callbacks;
|
2004-02-08 12:46:42 +08:00
|
|
|
if (__cb)
|
2003-10-24 22:24:00 +08:00
|
|
|
__cb->_M_add_reference();
|
|
|
|
_M_call_callbacks(erase_event);
|
2004-02-08 12:46:42 +08:00
|
|
|
if (_M_word != _M_local_word)
|
2003-10-24 22:24:00 +08:00
|
|
|
{
|
|
|
|
delete [] _M_word;
|
|
|
|
_M_word = 0;
|
|
|
|
}
|
|
|
|
_M_dispose_callbacks();
|
|
|
|
|
|
|
|
// NB: Don't want any added during above.
|
2004-02-08 12:46:42 +08:00
|
|
|
_M_callbacks = __cb;
|
2003-10-24 22:24:00 +08:00
|
|
|
for (int __i = 0; __i < __rhs._M_word_size; ++__i)
|
|
|
|
__words[__i] = __rhs._M_word[__i];
|
|
|
|
_M_word = __words;
|
|
|
|
_M_word_size = __rhs._M_word_size;
|
2004-02-08 12:46:42 +08:00
|
|
|
|
2003-10-24 22:24:00 +08:00
|
|
|
this->flags(__rhs.flags());
|
|
|
|
this->width(__rhs.width());
|
|
|
|
this->precision(__rhs.precision());
|
|
|
|
this->tie(__rhs.tie());
|
|
|
|
this->fill(__rhs.fill());
|
|
|
|
_M_ios_locale = __rhs.getloc();
|
|
|
|
_M_cache_locale(_M_ios_locale);
|
2004-02-08 12:46:42 +08:00
|
|
|
|
2003-10-24 22:24:00 +08:00
|
|
|
_M_call_callbacks(copyfmt_event);
|
2004-02-08 12:46:42 +08:00
|
|
|
|
2003-10-24 22:24:00 +08:00
|
|
|
// The next is required to be the last assignment.
|
|
|
|
this->exceptions(__rhs.exceptions());
|
2002-04-02 02:39:37 +08:00
|
|
|
}
|
2000-10-05 19:27:02 +08:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Locales:
|
|
|
|
template<typename _CharT, typename _Traits>
|
|
|
|
locale
|
|
|
|
basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
|
|
|
|
{
|
|
|
|
locale __old(this->getloc());
|
|
|
|
ios_base::imbue(__loc);
|
2003-02-18 13:45:07 +08:00
|
|
|
_M_cache_locale(__loc);
|
2000-10-05 19:27:02 +08:00
|
|
|
if (this->rdbuf() != 0)
|
|
|
|
this->rdbuf()->pubimbue(__loc);
|
|
|
|
return __old;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _CharT, typename _Traits>
|
|
|
|
void
|
|
|
|
basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)
|
|
|
|
{
|
|
|
|
// NB: This may be called more than once on the same object.
|
|
|
|
ios_base::_M_init();
|
2003-02-18 13:45:07 +08:00
|
|
|
|
|
|
|
// Cache locale data and specific facets used by iostreams.
|
2003-06-27 15:25:38 +08:00
|
|
|
_M_cache_locale(_M_ios_locale);
|
2002-01-25 14:36:32 +08:00
|
|
|
|
2002-02-27 09:01:31 +08:00
|
|
|
// NB: The 27.4.4.1 Postconditions Table specifies requirements
|
|
|
|
// after basic_ios::init() has been called. As part of this,
|
|
|
|
// fill() must return widen(' ') any time after init() has been
|
|
|
|
// called, which needs an imbued ctype facet of char_type to
|
|
|
|
// return without throwing an exception. Unfortunately,
|
|
|
|
// ctype<char_type> is not necessarily a required facet, so
|
|
|
|
// streams with char_type != [char, wchar_t] will not have it by
|
|
|
|
// default. Because of this, the correct value for _M_fill is
|
|
|
|
// constructed on the first call of fill(). That way,
|
|
|
|
// unformatted input and output with non-required basic_ios
|
|
|
|
// instantiations is possible even without imbuing the expected
|
|
|
|
// ctype<char_type> facet.
|
2002-07-04 17:20:01 +08:00
|
|
|
_M_fill = _CharT();
|
2002-02-27 09:01:31 +08:00
|
|
|
_M_fill_init = false;
|
2002-01-25 14:36:32 +08:00
|
|
|
|
2003-02-18 13:45:07 +08:00
|
|
|
_M_tie = 0;
|
2000-10-05 19:27:02 +08:00
|
|
|
_M_exception = goodbit;
|
|
|
|
_M_streambuf = __sb;
|
2001-01-06 10:44:11 +08:00
|
|
|
_M_streambuf_state = __sb ? goodbit : badbit;
|
2000-10-05 19:27:02 +08:00
|
|
|
}
|
|
|
|
|
2001-05-31 20:14:56 +08:00
|
|
|
template<typename _CharT, typename _Traits>
|
|
|
|
void
|
2003-02-18 13:45:07 +08:00
|
|
|
basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc)
|
2001-05-31 20:14:56 +08:00
|
|
|
{
|
2003-02-18 13:45:07 +08:00
|
|
|
if (__builtin_expect(has_facet<__ctype_type>(__loc), true))
|
2016-04-28 20:33:07 +08:00
|
|
|
_M_ctype = std::__addressof(use_facet<__ctype_type>(__loc));
|
2004-02-09 17:02:52 +08:00
|
|
|
else
|
|
|
|
_M_ctype = 0;
|
|
|
|
|
2003-08-12 11:46:18 +08:00
|
|
|
if (__builtin_expect(has_facet<__num_put_type>(__loc), true))
|
2016-04-28 20:33:07 +08:00
|
|
|
_M_num_put = std::__addressof(use_facet<__num_put_type>(__loc));
|
2004-02-09 17:02:52 +08:00
|
|
|
else
|
|
|
|
_M_num_put = 0;
|
|
|
|
|
2003-08-12 11:46:18 +08:00
|
|
|
if (__builtin_expect(has_facet<__num_get_type>(__loc), true))
|
2016-04-28 20:33:07 +08:00
|
|
|
_M_num_get = std::__addressof(use_facet<__num_get_type>(__loc));
|
2004-02-09 17:02:52 +08:00
|
|
|
else
|
|
|
|
_M_num_get = 0;
|
2001-05-31 20:14:56 +08:00
|
|
|
}
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 08:19:13 +08:00
|
|
|
|
|
|
|
// Inhibit implicit instantiations for required instantiations,
|
2004-02-08 12:46:42 +08:00
|
|
|
// which are defined via explicit instantiations elsewhere.
|
2003-07-05 12:05:45 +08:00
|
|
|
#if _GLIBCXX_EXTERN_TEMPLATE
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 08:19:13 +08:00
|
|
|
extern template class basic_ios<char>;
|
2002-11-02 01:30:36 +08:00
|
|
|
|
2003-07-05 12:05:45 +08:00
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
Tune for size.
2002-02-15 Benjamin Kosnik <bkoz@redhat.com>
Tune for size.
* src/string-inst.cc (string::_Rep::_S_terminal): Remove redundant
explicit instantiation.
(string::_Rep::_S_max_size): Same.
* include/bits/basic_string.tcc: Add extern explicit
instantiations for string, wstring.
* include/bits/basic_ios.tcc: Add extern explicit instantiations
for ios, wios.
* include/bits/streambuf.tcc: Same, for streambuf, wstreambuf.
* include/bits/istream.tcc: Same, for istream, wistream.
* include/bits/ostream.tcc: Same for ostream, wostream, iostream,
wiostream.
* include/bits/sstream.tcc: Same, for stringbuf, wstringbuf,
istringstream, wistringstream, ostringstream, wostringstream,
stringstream, wstringstream.
* include/bits/fstream.tcc: Same, for filebuf, wfilebuf, ifstream,
wifstream, ofstream, wofstream, fstream, wfstream.
* src/misc-inst.cc: Correct comments.
Add iomanip instantiations for wide streams.
* include/std/std_iomanip.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/std/std_streambuf.h: Correct
_GLIBCPP_FULLY_COMPLIANT_HEADERS guard.
* include/std/std_sstream.h: Same.
* include/std/std_ostream.h: Same.
* include/std/std_istream.h: Same.
* include/std/std_fstream.h: Same.
* include/std/std_streambuf.h: Add definitions for private copy
ctor and assignment operator.
* include/std/std_istream.h: Remove declared but undefined copy
ctor and assignment operator. This is taken care of in ios_base,
so adding it in the derived class as well is superfluous.
* include/std/std_ostream.h: Same.
* include/bits/basic_ios.h (basic_ios::clear): Don't inline.
* include/bits/basic_ios.tcc (basic_ios::clear): Move definition here.
From-SVN: r49798
2002-02-16 08:19:13 +08:00
|
|
|
extern template class basic_ios<wchar_t>;
|
2002-11-02 01:30:36 +08:00
|
|
|
#endif
|
2003-02-14 05:39:03 +08:00
|
|
|
#endif
|
2005-12-19 08:56:05 +08:00
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-31 06:39:36 +08:00
|
|
|
_GLIBCXX_END_NAMESPACE_VERSION
|
2011-03-05 05:51:56 +08:00
|
|
|
} // namespace std
|
2000-10-05 19:27:02 +08:00
|
|
|
|
2004-02-08 12:46:42 +08:00
|
|
|
#endif
|