std_fstream.h (_S_pback_size): Remove definition.

2003-05-22  Paolo Carlini  <pcarlini@unitus.it>

	* include/std/std_fstream.h (_S_pback_size): Remove definition.
	(_M_create_pback(), _M_destroy_pback()): Simplify for a single-char
	pback buffer.
	* include/bits/fstream.tcc (_S_pback_size): Remove declaration.
	* testsuite/27_io/basic_filebuf/3.cc: Remove explicit instantiation
	of _S_pback_size for systems with no COMDAT or weak support.
	* testsuite/27_io/basic_filebuf/seekoff/10132-2.cc: Likewise.
	* testsuite/27_io/basic_filebuf/seekpos/10132-3.cc: Likewise.
	* testsuite/27_io/basic_filebuf/underflow/10096.cc: Likewise.
	* testsuite/27_io/basic_fstream/3.cc: Likewise.
	* testsuite/27_io/basic_ifstream/3.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/3983-fstream.cc: Likewise.
	* testsuite/27_io/basic_ofstream/3.cc: Likewise.
	* testsuite/27_io/basic_ostream/sentry/char/3983-fstream.cc: Likewise.
	* testsuite/27_io/basic_streambuf/3.cc: Likewise.

From-SVN: r67102
This commit is contained in:
Paolo Carlini 2003-05-23 00:16:41 +02:00 committed by Paolo Carlini
parent 5f875c8fc6
commit d7ccc91760
13 changed files with 23 additions and 85 deletions

View File

@ -1,6 +1,24 @@
2003-05-22 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (_M_underflow): simplify:
* include/std/std_fstream.h (_S_pback_size): Remove definition.
(_M_create_pback(), _M_destroy_pback()): Simplify for a single-char
pback buffer.
* include/bits/fstream.tcc (_S_pback_size): Remove declaration.
* testsuite/27_io/basic_filebuf/3.cc: Remove explicit instantiation
of _S_pback_size for systems with no COMDAT or weak support.
* testsuite/27_io/basic_filebuf/seekoff/10132-2.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/10132-3.cc: Likewise.
* testsuite/27_io/basic_filebuf/underflow/10096.cc: Likewise.
* testsuite/27_io/basic_fstream/3.cc: Likewise.
* testsuite/27_io/basic_ifstream/3.cc: Likewise.
* testsuite/27_io/basic_istream/sentry/char/3983-fstream.cc: Likewise.
* testsuite/27_io/basic_ofstream/3.cc: Likewise.
* testsuite/27_io/basic_ostream/sentry/char/3983-fstream.cc: Likewise.
* testsuite/27_io/basic_streambuf/3.cc: Likewise.
2003-05-22 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (_M_underflow): Simplify:
!__testout implies _M_filepos == _M_in_end, therefore
the first _M_file.seekoff call is never issued.

View File

@ -39,10 +39,6 @@
namespace std
{
template<typename _CharT, typename _Traits>
const size_t
basic_filebuf<_CharT, _Traits>::_S_pback_size;
template<typename _CharT, typename _Traits>
void
basic_filebuf<_CharT, _Traits>::

View File

@ -158,8 +158,7 @@ namespace std
* @note pbacks of over one character are not currently supported.
* @endif
*/
static const size_t _S_pback_size = 1;
char_type _M_pback[_S_pback_size];
char_type _M_pback[1];
char_type* _M_pback_cur_save;
char_type* _M_pback_end_save;
bool _M_pback_init;
@ -176,12 +175,9 @@ namespace std
{
if (!_M_pback_init)
{
size_t __dist = this->_M_in_end - this->_M_in_cur;
size_t __len = std::min(_S_pback_size, __dist);
traits_type::copy(_M_pback, this->_M_in_cur, __len);
_M_pback_cur_save = this->_M_in_cur;
_M_pback_end_save = this->_M_in_end;
this->setg(_M_pback, _M_pback, _M_pback + __len);
this->setg(_M_pback, _M_pback, _M_pback + 1);
_M_pback_init = true;
}
}
@ -195,17 +191,9 @@ namespace std
if (_M_pback_init)
{
// Length _M_in_cur moved in the pback buffer.
size_t __off_cur = this->_M_in_cur - _M_pback;
// For in | out buffers, the end can be pushed back...
size_t __off_end = 0;
size_t __pback_len = this->_M_in_end - _M_pback;
size_t __save_len = _M_pback_end_save - this->_M_buf;
if (__pback_len > __save_len)
__off_end = __pback_len - __save_len;
const size_t __off_cur = this->_M_in_cur - _M_pback;
this->setg(this->_M_buf, _M_pback_cur_save + __off_cur,
_M_pback_end_save + __off_end);
_M_pback_end_save);
_M_pback_init = false;
}
}

View File

@ -127,13 +127,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();

View File

@ -129,13 +129,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();

View File

@ -129,13 +129,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();

View File

@ -63,13 +63,6 @@ void test01()
VERIFY( fb.sgetc() == MyTraits::eof() );
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<char, MyTraits>::int_type
std::basic_filebuf<char, MyTraits>::_S_pback_size;
#endif
int main()
{
test01();

View File

@ -131,13 +131,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();

View File

@ -131,13 +131,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();

View File

@ -180,10 +180,6 @@ template
template
unsigned char
std::basic_string<unsigned char>::_Rep::_S_terminal;
template
std::basic_filebuf<unsigned char>::int_type
std::basic_filebuf<unsigned char>::_S_pback_size;
#endif
int main()

View File

@ -131,13 +131,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();

View File

@ -151,10 +151,6 @@ template
template
unsigned char
std::basic_string<unsigned char>::_Rep::_S_terminal;
template
std::basic_filebuf<unsigned char>::int_type
std::basic_filebuf<unsigned char>::_S_pback_size;
#endif
int main()

View File

@ -129,13 +129,6 @@ void test07()
}
}
#if !__GXX_WEAK__
// Explicitly instantiate for systems with no COMDAT or weak support.
template
std::basic_filebuf<gnu_char_type>::int_type
std::basic_filebuf<gnu_char_type>::_S_pback_size;
#endif
int main()
{
test07();