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.
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>::
* @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;
{
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;
}
}
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;
}
}
}
}
-#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();
}
}
-#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();
}
}
-#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();
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();
}
}
-#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();
}
}
-#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();
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()
}
}
-#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();
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()
}
}
-#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();