2003-06-24 Paolo Carlini <pcarlini@unitus.it>
Nathan C. Myers <ncm-nospam@cantrip.org>
* include/std/std_fstream.h (_M_filepos): Remove.
(_M_reading, _M_writing): New, encode the various I/O modes:
'read', 'write' and 'uncommitted'.
(sync): If there is something to flush, do it, then go to
'uncommitted' mode.
* include/bits/fstream.tcc (_M_set_buffer): Overhaul to deal
with three different cases: __off > 0 (upon underflow),
__off == 0 (upon overflow), __off == -1 (upon open, setbuf,
seekoff/pos).
(_M_underflow): Don't call overflow, set _M_reading to true
on success, tweak.
(pbackfail): Set _M_reading to true on pback creation, tweak.
(overflow): Don't seek, deal with overflow in 'uncommitted' mode,
set _M_writing to true on success, tweak.
(seekoff): Simplify, set _M_reading, _M_writing to false, call
_M_set_buffer(-1) ('uncommitted').
(open, close, setbuf): Set _M_reading, _M_writing to false and
call _M_set_buffer(-1), tweak.
(basic_filebuf): Don't set _M_buf_unified.
(_M_destroy_internal_buffer): Don't call setg and setp.
* include/ext/stdio_filebuf.h (stdio_filebuf): Use _M_reading,
_M_writing and _M_set_buffer(-1).
* include/std/std_streambuf.h (_M_move_out_cur, _M_move_in_cur,
_M_out_lim, _M_buf_unified): Remove.
(basic_streambuf): Don't set _M_out_lim and _M_buf_unified.
(setp): Don't set _M_out_lim.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-io.cc: Fix for
the new logic ('read', 'write' and 'uncommitted' modes): e.g.,
upon open the mode is 'uncommitted' and therefore the put area
pointers are null.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/seekoff/char/3-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/seekpos/char/3-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/setbuf/char/1.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetn/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/snextc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/snextc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputn/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputn/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc: Ditto.
* testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sungetc/char/1-out.cc: Ditto.
* include/bits/fstream.tcc (showmanyc): Use only the
documented derivation interface to basic_streambuf (gptr(),
setg(), etc.) to work right with user specializations.
* include/bits/streambuf.tcc (sbumpc, sputbackc, sungetc,
sputc, xsgetn, xsputn, __copy_streambufs): Likewise.
* include/std/std_streambuf.h (in_avail, sgetc, uflow, stossc):
Likewise.
* include/std/std_fstream.h (_M_create_pback, _M_destroy_pback,
xsgetn): Likewise.
Co-Authored-By: Nathan C. Myers <ncm-nospam@cantrip.org>
From-SVN: r68420
* configure.host (freebsd*): Set abi_baseline_pair.
* config/abi/i386-freebsd4/baseline_symbols.txt: Update from 3.2
(at or near first release) to 3.3.
* config/abi/i386-freebsd5/baseline_symbols.txt: New file.
* config/abi/alpha-freebsd5/baseline_symbols.txt: New file.
* config/abi/sparc-freebsd5/baseline_symbols.txt: New file.
From-SVN: r68402
2003-06-22 Paolo Carlini <pcarlini@unitus.it>
Nathan C. Myers <ncm-nospam@cantrip.org>
* include/std/std_streambuf.h (_M_move_out_cur): _M_out_lim
is now used only for filebuf, when _M_buf_unified is true.
epgtr() plays the role of _M_out_lim but it's only updated
upon overflow, underflow, uflow, seekoff/pos.
* include/bits/sstream.tcc (_M_underflow): New, implements
stringbuf::underflow and uflow.
(seekoff, seekpos): Tweak, use _M_update_egptr.
* include/std/std_sstream.h (str): Rewrote, deal correctly
with the new logic, in particular, when pptr() > egptr().
(_M_sync): When __testout && !__testin set all the get area
pointers to the current string end.
(_M_update_egptr): New, internal function updating egptr()
to the actual string end.
(_M_underflow): New, declare.
(underflow): Dispatch to _M_underflow(false).
(uflow): Dispatch to _M_underflow(true).
* include/bits/sstream.tcc (pbackfail, overflow, seekoff,
seekpos): Use only the documented derivation interface to
basic_streambuf (gptr(), setg(), etc.) to work right with
user specializations.
* include/std/std_sstream.h (str, _M_sync): Likewise.
From-SVN: r68347
2003-06-20 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/testsuite_performance.h (resource_counter): Don't use
mallinfo at the moment.
From-SVN: r68268
2003-06-18 Nathan C. Myers <ncm-nospam@cantrip.org>
Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (setbuf): Allow (__s, 1) too,
simply equivalent to the unbuffered case (0, 0) as far as
_M_buf_size is concerned.
Co-Authored-By: Paolo Carlini <pcarlini@unitus.it>
From-SVN: r68160
2003-06-16 Paolo Carlini <pcarlini@unitus.it>
* testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc: Fix
for systems with BUFSIZ != 8192.
* testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetn/char/1-out.cc:
Minor tweaks.
From-SVN: r68041
2003-06-13 Nathan C. Myers <ncm-nospam@cantrip.org>
Avoid multi-processor bus contention on increment/decrement-and-
test of the reference count in the empty-string object, by comparing
addresses first, and never touching the reference count of the empty-
string object.
* include/bits/basic_string.h:
(_S_empty_rep_storage): Move into basic_string<>::_Rep for use by its
members.
(_Rep::_S_empty_rep()): New accessor.
(_Rep::_M_length, _Rep::_M_capacity, _Rep::_M_references): Move to
a base class _Rep_base.
(_Rep::_M_dispose, _Rep::_M_refcopy): Check for the empty string.
(basic_string()): Change to use _M_refdata() in place of _M_refcopy(),
since no longer must increment its refcount.
* include/bits/basic_string.tcc:
(_Rep::_M_destroy, _M_leak_hard): Check for the empty string and
return immediately. The former might be unnecessary. The latter
prevents begin() and end() from cloning it unnecessarily.
(_S_construct(_InIterator, _InIterator, const _Alloc&,
input_iterator_tag), _S_construct(_InIterator, _InIterator,
const _Alloc&, forward_iterator_tag), _S_construct(size_type, _CharT,
const _Alloc&)): Change to use _M_refdata() in place of _M_refcopy().
(_M_mutate): Check for the empty string and treat it as shared.
This is necessary here because _M_mutate is sometimes called with
all-zero arguments; in all other uses of _M_is_shared, the test comes
out right anyhow.
From-SVN: r67912
2003-06-10 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (close): Clean up a bit.
* include/bits/streambuf.tcc (sbumpc): Clean up a bit.
* include/std/std_fstream.h (_M_destroy_pback): _M_pback_cur_save
- the saved _M_in_cur, that is - cannot be null.
(sync): Constify a variable.
* include/std/std_streambuf.h: Tweak a comment.
(in_avail): Constify a variable.
From-SVN: r67738
2003-06-09 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (_M_underflow): Do not special
case the unbuffered case, which really means simply a one char
get area.
(basic_filebuf): Initialize _M_buf_size.
(setbuf): Unbuffered means _M_buf_size == 1, since only
_M_buf_size - 1 == 0 chars are going to be used for the
put area and 1 for the get area.
* include/std/std_streambuf.h (_M_buf_size): Move to basic_filebuf.
(~basic_streambuf): Tweak.
(basic_streambuf): Do not initialize _M_buf_size.
* include/std/std_fstream.h (_M_buf_size): Add from basic_streambuf.
(~basic_filebuf): Tweak.
(_M_set_buffer): Tweak, considering that _M_buf_size == 1 is the
unbuffered situation (i.e., put area pointers NULL).
* include/bits/streambuf.tcc (sbumpc): Clean up.
* testsuite/27_io/basic_filebuf/sputbackc/char/1.cc: Split into...
* testsuite/27_io/basic_filebuf/sputbackc/char/1-in.cc: New.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-io.cc: New.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-out.cc: New.
* testsuite/27_io/basic_filebuf/sputbackc/char/2-in.cc: New.
* testsuite/27_io/basic_filebuf/sputbackc/char/2-io.cc: New.
* testsuite/27_io/basic_filebuf/sputbackc/char/2-out.cc: New.
From-SVN: r67686
2003-06-09 Phil Edwards <pme@gcc.gnu.org>
* acinclude.m4: Move all AM_CONDITIONAL calls out.
(GLIBCPP_CONFIGURE): Set defaults for variables used in AM_CONDITIONAL
statements.
* configure.in: Centralize AM_CONDITIONALs so that they are always
run. Make use of GLIBCPP_IS_CROSS_COMPILING.
* aclocal.m4, configure: Regenerated.
From-SVN: r67663
* include/bits/stl_iterator.h
(reverse_iterator::reverse_iterator()): Apply DR235: default
constructor default-initializes data member. Instantiated on a
pointer type, the member has to end up equal to zero.
From-SVN: r67559
* acinclude.m4 (GLIBCPP_CHECK_PCH): Only set glibcpp_PCHFLAGS if
.gch compilation works.
* aclocal.m4, configure: Regenerate.
* testsuite_flags.in (--build-cxx): Use glibcpp_PCHFLAGS to
initialize PCHFLAGS.
From-SVN: r67515
2003-06-02 Paolo Carlini <pcarlini@unitus.it>
* include/bits/sstream.tcc (pbackfail): Minor clean up and
reformatting, consistent with basic_filebuf::pbackfail.
From-SVN: r67342