This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] unbuffered consistency, revert 7445


Reverts 7445, as discussed.

Cleanups for unbuffered filebufs.

-benjamin

tested x86/linux

gcc
gcc-3_2-branch

2002-08-15  Benjamin Kosnik  <bkoz@redhat.com>

	* include/ext/stdio_filebuf.h (stdio_filebuf): Explicitly set
	_M_buf_size_opt to zero when unbuffering.
	* include/bits/fstream.tcc (filebuf::showmanyc): Simplify.
	Consistency checks for _M_buf_size_opt.

	Revert PR libstdc++/7445
	* src/locale.cc (locale::classic): Revert.
	
	* docs/html/17_intro/TODO: Add.

Index: docs/html/17_intro/TODO
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/docs/html/17_intro/TODO,v
retrieving revision 1.6
diff -c -p -r1.6 TODO
*** docs/html/17_intro/TODO	19 Mar 2002 17:17:43 -0000	1.6
--- docs/html/17_intro/TODO	15 Aug 2002 21:08:05 -0000
*************** executable speed.
*** 17,23 ****
  
  - benchmarking addition to the testsuite that does the above.
  
! - implement symbol versioning for ELF targets.
  
  - exception specifications need to be reviewed for all parts of the
  library support and utility areas, particularly <new>. 
--- 17,32 ----
  
  - benchmarking addition to the testsuite that does the above.
  
! - implement testing for symbol versioning for ELF targets.
! 
! - review streambuf, filebuf, stringbuf to optimize data member
! placement.  Do pback bits need to be in streambuf? How about
! _M_set_indeterminate, etc?
! 
! - Think about naming all member data and member functions consistently
! as per
! funtions: _M_verb_adverb
! data: _M_noun_adjective
  
  - exception specifications need to be reviewed for all parts of the
  library support and utility areas, particularly <new>. 
Index: include/bits/fstream.tcc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/fstream.tcc,v
retrieving revision 1.39
diff -c -p -r1.39 fstream.tcc
*** include/bits/fstream.tcc	31 Jul 2002 02:47:33 -0000	1.39
--- include/bits/fstream.tcc	15 Aug 2002 21:08:05 -0000
*************** namespace std
*** 90,98 ****
  	    {
  	      _M_allocate_internal_buffer();
  	      _M_mode = __mode;
- 	      
- 	      // For time being, set both (in/out) sets  of pointers.
  	      _M_set_indeterminate();
  	      if ((__mode & ios_base::ate)
  		  && this->seekoff(0, ios_base::end, __mode) < 0)
  		this->close();
--- 90,97 ----
  	    {
  	      _M_allocate_internal_buffer();
  	      _M_mode = __mode;
  	      _M_set_indeterminate();
+ 
  	      if ((__mode & ios_base::ate)
  		  && this->seekoff(0, ios_base::end, __mode) < 0)
  		this->close();
*************** namespace std
*** 147,158 ****
        bool __testin = _M_mode & ios_base::in;
  
        if (__testin && this->is_open())
! 	{
! 	  if (_M_in_cur < _M_in_end)
! 	    __ret = _M_in_end - _M_in_cur;
! 	  else
! 	    __ret = 0;
! 	}
        _M_last_overflowed = false;	
        return __ret;
      }
--- 146,152 ----
        bool __testin = _M_mode & ios_base::in;
  
        if (__testin && this->is_open())
! 	__ret = _M_in_end - _M_in_cur;
        _M_last_overflowed = false;	
        return __ret;
      }
*************** namespace std
*** 316,322 ****
      {
        int_type __ret = traits_type::eof();
        bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
!       bool __testunbuffered = _M_file.is_open() && !_M_buf_size;
  
        if (__testput || __testunbuffered)
  	{
--- 310,316 ----
      {
        int_type __ret = traits_type::eof();
        bool __testput = _M_out_cur && _M_out_beg < _M_out_end;
!       bool __testunbuffered = _M_file.is_open() && !_M_buf_size_opt;
  
        if (__testput || __testunbuffered)
  	{
Index: include/ext/stdio_filebuf.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/stdio_filebuf.h,v
retrieving revision 1.2
diff -c -p -r1.2 stdio_filebuf.h
*** include/ext/stdio_filebuf.h	21 May 2002 20:53:36 -0000	1.2
--- include/ext/stdio_filebuf.h	15 Aug 2002 21:08:08 -0000
*************** namespace __gnu_cxx
*** 123,138 ****
        if (this->is_open())
  	{
  	  _M_mode = __mode;
- 	  _M_buf_size_opt = __size;
- 	  
  	  if (__size > 0 && __size < 4)
  	    {
  	      _M_buf = _M_unbuf;
  	      _M_buf_size = __size;
  	    }
  	  else
! 	    _M_allocate_internal_buffer();
! 	  
  	  _M_set_indeterminate();
  	}
      }
--- 123,140 ----
        if (this->is_open())
  	{
  	  _M_mode = __mode;
  	  if (__size > 0 && __size < 4)
  	    {
+ 	      // Specify unbuffered.
  	      _M_buf = _M_unbuf;
  	      _M_buf_size = __size;
+ 	      _M_buf_size_opt = 0;
  	    }
  	  else
! 	    {
! 	      _M_buf_size_opt = __size;
! 	      _M_allocate_internal_buffer();
! 	    }
  	  _M_set_indeterminate();
  	}
      }
*************** namespace __gnu_cxx
*** 146,161 ****
        if (this->is_open())
  	{
  	  _M_mode = __mode;
- 	  _M_buf_size_opt = __size;
- 	  
  	  if (__size > 0 && __size < 4)
  	    {
  	      _M_buf = _M_unbuf;
  	      _M_buf_size = __size;
  	    }
  	  else
! 	    _M_allocate_internal_buffer();
! 	  
  	  _M_set_indeterminate();
  	}
      }
--- 148,165 ----
        if (this->is_open())
  	{
  	  _M_mode = __mode;
  	  if (__size > 0 && __size < 4)
  	    {
+ 	      // Specify unbuffered.
  	      _M_buf = _M_unbuf;
  	      _M_buf_size = __size;
+ 	      _M_buf_size_opt = 0;
  	    }
  	  else
! 	    {
! 	      _M_buf_size_opt = __size;
! 	      _M_allocate_internal_buffer();
! 	    }
  	  _M_set_indeterminate();
  	}
      }
Index: src/locale.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/locale.cc,v
retrieving revision 1.62
diff -c -p -r1.62 locale.cc
*** src/locale.cc	31 Jul 2002 19:34:08 -0000	1.62
--- src/locale.cc	15 Aug 2002 21:08:08 -0000
*************** namespace std 
*** 284,294 ****
    const locale&
    locale::classic()
    {
      if (!_S_classic)
        {
- 	static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
- 	_STL_auto_lock __auto(__lock);
- 
  	try 
  	  {
  	    // 26 Standard facets, 2 references.
--- 284,294 ----
    const locale&
    locale::classic()
    {
+     static _STL_mutex_lock __lock __STL_MUTEX_INITIALIZER;
+     _STL_auto_lock __auto(__lock);
+ 
      if (!_S_classic)
        {
  	try 
  	  {
  	    // 26 Standard facets, 2 references.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]