summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-16 22:37:53 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-16 22:37:53 +0000
commitb812c14ed170e83aca6581918905793d549dbf99 (patch)
treeace03b23724b8ff5b0ec175af9fd1e176033b3cd /libstdc++-v3
parent487df8fdc24f79a802d71a55701ea6476afd291e (diff)
downloadgcc-b812c14ed170e83aca6581918905793d549dbf99.tar.gz
2003-10-16 Petur Runolfsson <peturr02@ru.is>
PR libstdc++/8610 PR libstdc++/11450 PR libstdc++/11543 PR libstdc++/12065 * config/io/basic_file_stdio.cc (__basic_file::seekoff): Change return value from streampos to streamoff. (__basic_file::seekpos): Delete. * config/io/basic_file_stdio.h: Same. * config/io/c_io_stdio.h: Remove streamoff and wstreamsize typedefs. * include/Makefile.am (bits_headers): Add bits/postypes.h. * include/bits/char_traits.h: Include bits/postypes.h instead of bits/fpos.h. * include/bits/fstream.tcc (basic_filebuf::open, basic_filebuf::pbackfail): Don't use < or >= to compare pos_type values, use == and != instead. (basic_filebuf::_M_seek): Use explicit conversion from streamoff to pos_type. (basic_filebuf::imbue): Don't use ! on pos_type values, use == instead. Don't use __check_facet(_M_codecvt) unless is_open(). * include/bits/postypes.h: New file. Add __streamoff_base_type typedef, streamsize. (streamoff, streampos, wstreampos): Define typedefs, with streamoff defined as... (streamoff): New class. Document implementation defined aspects. (fpos): New implementation. Document implementation defined aspects. * include/bits/sstream.tcc (basic_stringbuf::seekpos): Use explicit conversion from pos_type to off_type. * include/std/std_iosfwd.h: Include bits/postypes.h instead of bits/fpos.h. * testsuite/27_io/basic_filebuf/seekoff/char/11543.cc: New test. * testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc: New test. * testsuite/27_io/fpos/11450.cc: New test. * testsuite/27_io/fpos/mbstate_t/12065.cc: New test. * testsuite/27_io/fpos/mbstate_t/4_neg.cc: New test. * testsuite/27_io/types/3.cc: New test. 2003-10-16 Benjamin Kosnik <bkoz@redhat.com> * configure.host: Remove fpos_include_dir. * configure.ac: Remove FPOS_INC_SRCDIR. * configure: Regenerate. * acinclude.m4 (GLIBCXX_ENABLE_CSTDIO): Remove FPOS_H. * aclocal.m4: Regenerate. * include/Makefile.am (host_headers): Remove fpos.h. (bits_headers): Add postypes.h. * include/Makefile.in: Regenerate. * config/os/gnu-linux/fposh: Remove. * config/os/generic/fpos.h: Remove. * testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc: Fixup. * testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc: Same. * testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc: Same. * testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc: Same. * testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc: Same. * testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc: Same. * testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc: Same. * testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc: Same. * testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc: Same. * testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc: Same. * testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc: Same. * testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc: Same. * testsuite/27_io/basic_istream/seekg/char/2.cc: Same. * testsuite/27_io/basic_stringbuf/seekoff/char/1.cc: Same. * testsuite/27_io/basic_stringbuf/seekpos/char/1.cc: Same. * testsuite/27_io/fpos/mbstate_t/3.cc: Same. * testsuite/27_io/objects/char/10.cc: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72582 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog71
-rw-r--r--libstdc++-v3/acinclude.m44
-rw-r--r--libstdc++-v3/aclocal.m44
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.cc6
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.h5
-rw-r--r--libstdc++-v3/config/io/c_io_stdio.h7
-rw-r--r--libstdc++-v3/config/os/generic/fpos.h118
-rw-r--r--libstdc++-v3/config/os/gnu-linux/fpos.h144
-rwxr-xr-xlibstdc++-v3/configure9
-rw-r--r--libstdc++-v3/configure.ac2
-rw-r--r--libstdc++-v3/configure.host4
-rw-r--r--libstdc++-v3/include/Makefile.am4
-rw-r--r--libstdc++-v3/include/Makefile.in23
-rw-r--r--libstdc++-v3/include/bits/char_traits.h2
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc52
-rw-r--r--libstdc++-v3/include/bits/postypes.h253
-rw-r--r--libstdc++-v3/include/bits/sstream.tcc2
-rw-r--r--libstdc++-v3/include/std/std_iosfwd.h3
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/11543.cc152
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc142
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2.cc3
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc10
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc6
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/11450.cc43
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/12065.cc47
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc3
-rw-r--r--libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc42
-rw-r--r--libstdc++-v3/testsuite/27_io/objects/char/10.cc2
-rw-r--r--libstdc++-v3/testsuite/27_io/types/3.cc50
41 files changed, 900 insertions, 385 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7cbde1b8cb0..cd0c934200f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,74 @@
+2003-10-16 Petur Runolfsson <peturr02@ru.is>
+
+ PR libstdc++/8610
+ PR libstdc++/11450
+ PR libstdc++/11543
+ PR libstdc++/12065
+ * config/io/basic_file_stdio.cc (__basic_file::seekoff):
+ Change return value from streampos to streamoff.
+ (__basic_file::seekpos): Delete.
+ * config/io/basic_file_stdio.h: Same.
+ * config/io/c_io_stdio.h: Remove streamoff and wstreamsize typedefs.
+ * include/Makefile.am (bits_headers): Add bits/postypes.h.
+ * include/bits/char_traits.h: Include bits/postypes.h instead of
+ bits/fpos.h.
+ * include/bits/fstream.tcc (basic_filebuf::open,
+ basic_filebuf::pbackfail): Don't use < or >= to compare pos_type
+ values, use == and != instead.
+ (basic_filebuf::_M_seek): Use explicit conversion from streamoff
+ to pos_type.
+ (basic_filebuf::imbue): Don't use ! on pos_type values, use
+ == instead. Don't use __check_facet(_M_codecvt) unless is_open().
+ * include/bits/postypes.h: New file.
+ Add __streamoff_base_type typedef, streamsize.
+ (streamoff, streampos, wstreampos): Define typedefs, with
+ streamoff defined as...
+ (streamoff): New class. Document implementation defined
+ aspects.
+ (fpos): New implementation. Document implementation defined
+ aspects.
+ * include/bits/sstream.tcc (basic_stringbuf::seekpos): Use
+ explicit conversion from pos_type to off_type.
+ * include/std/std_iosfwd.h: Include bits/postypes.h instead
+ of bits/fpos.h.
+ * testsuite/27_io/basic_filebuf/seekoff/char/11543.cc: New test.
+ * testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc: New test.
+ * testsuite/27_io/fpos/11450.cc: New test.
+ * testsuite/27_io/fpos/mbstate_t/12065.cc: New test.
+ * testsuite/27_io/fpos/mbstate_t/4_neg.cc: New test.
+ * testsuite/27_io/types/3.cc: New test.
+
+2003-10-16 Benjamin Kosnik <bkoz@redhat.com>
+
+ * configure.host: Remove fpos_include_dir.
+ * configure.ac: Remove FPOS_INC_SRCDIR.
+ * configure: Regenerate.
+ * acinclude.m4 (GLIBCXX_ENABLE_CSTDIO): Remove FPOS_H.
+ * aclocal.m4: Regenerate.
+ * include/Makefile.am (host_headers): Remove fpos.h.
+ (bits_headers): Add postypes.h.
+ * include/Makefile.in: Regenerate.
+ * config/os/gnu-linux/fposh: Remove.
+ * config/os/generic/fpos.h: Remove.
+
+ * testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc: Fixup.
+ * testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc: Same.
+ * testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc: Same.
+ * testsuite/27_io/basic_istream/seekg/char/2.cc: Same.
+ * testsuite/27_io/basic_stringbuf/seekoff/char/1.cc: Same.
+ * testsuite/27_io/basic_stringbuf/seekpos/char/1.cc: Same.
+ * testsuite/27_io/fpos/mbstate_t/3.cc: Same.
+ * testsuite/27_io/objects/char/10.cc: Same.
+
2003-10-16 Paolo Carlini <pcarlini@suse.de>
* src/locale.cc (locale::locale(const char*)): ... one
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 394fc436949..57875a17dc4 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1153,11 +1153,7 @@ AC_DEFUN(GLIBCXX_ENABLE_CSTDIO, [
;;
esac
- dnl Set directory for fpos.h
- FPOS_H=$fpos_include_dir
-
AC_SUBST(CSTDIO_H)
- AC_SUBST(FPOS_H)
AC_SUBST(BASIC_FILE_H)
AC_SUBST(BASIC_FILE_CC)
])
diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4
index b0ecb7d3edb..9d7e3ac4922 100644
--- a/libstdc++-v3/aclocal.m4
+++ b/libstdc++-v3/aclocal.m4
@@ -1166,11 +1166,7 @@ AC_DEFUN(GLIBCXX_ENABLE_CSTDIO, [
;;
esac
- dnl Set directory for fpos.h
- FPOS_H=$fpos_include_dir
-
AC_SUBST(CSTDIO_H)
- AC_SUBST(FPOS_H)
AC_SUBST(BASIC_FILE_H)
AC_SUBST(BASIC_FILE_CC)
])
diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc
index b3223f50ca7..a74ac07e890 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.cc
+++ b/libstdc++-v3/config/io/basic_file_stdio.cc
@@ -260,14 +260,10 @@ namespace std
return __ret;
}
- streampos
+ streamoff
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way)
{ return lseek(this->fd(), __off, __way); }
- streampos
- __basic_file<char>::seekpos(streampos __pos)
- { return lseek(this->fd(), __pos, ios_base::beg); }
-
int
__basic_file<char>::sync()
{ return fflush(_M_cfile); }
diff --git a/libstdc++-v3/config/io/basic_file_stdio.h b/libstdc++-v3/config/io/basic_file_stdio.h
index 2ff2ba464fc..212ebbe8dc7 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.h
+++ b/libstdc++-v3/config/io/basic_file_stdio.h
@@ -97,12 +97,9 @@ namespace std
streamsize
xsgetn(char* __s, streamsize __n);
- streampos
+ streamoff
seekoff(streamoff __off, ios_base::seekdir __way);
- streampos
- seekpos(streampos __pos);
-
int
sync();
diff --git a/libstdc++-v3/config/io/c_io_stdio.h b/libstdc++-v3/config/io/c_io_stdio.h
index 592abb6052b..c9ae4322171 100644
--- a/libstdc++-v3/config/io/c_io_stdio.h
+++ b/libstdc++-v3/config/io/c_io_stdio.h
@@ -38,13 +38,6 @@
namespace std
{
- // for fpos.h
- typedef long streamoff;
- typedef ptrdiff_t streamsize; // Signed integral type
-#if _GLIBCXX_USE_WCHAR_T
- typedef ptrdiff_t wstreamsize;
-#endif
-
typedef __gthread_mutex_t __c_lock;
// for basic_file.h
diff --git a/libstdc++-v3/config/os/generic/fpos.h b/libstdc++-v3/config/os/generic/fpos.h
deleted file mode 100644
index 869749088f5..00000000000
--- a/libstdc++-v3/config/os/generic/fpos.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// File position object and stream types, generic version -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003
-// Free Software Foundation, Inc.
-//
-// 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
-// Free Software Foundation; either version 2, or (at your option)
-// 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.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 27 Input/output library
-//
-
-/** @file fpos.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_BITS_FPOS_H
-#define _CPP_BITS_FPOS_H 1
-
-#pragma GCC system_header
-
-#include <bits/c++io.h>
-#include <cwchar> // For mbstate_t.
-
-namespace std
-{
- // 27.4.1 Types
-
- // [27.4.3] template class fpos
- /**
- * @doctodo
- */
- template<typename _StateT>
- class fpos
- {
- private:
- streamoff _M_off;
- _StateT _M_st;
-
- public:
- _StateT
- state() const { return _M_st; }
-
- void
- state(_StateT __st) { _M_st = __st; }
-
- fpos(): _M_off(streamoff()), _M_st(_StateT()) { }
-
- // NB: The standard defines only the implicit copy ctor and the
- // previous two members. The rest is a "conforming extension".
- fpos(streamoff __off, _StateT __st = _StateT())
- : _M_off(__off), _M_st(__st) { }
-
- operator streamoff() const { return _M_off; }
-
- fpos&
- operator+=(streamoff __off) { _M_off += __off; return *this; }
-
- fpos&
- operator-=(streamoff __off) { _M_off -= __off; return *this; }
-
- fpos
- operator+(streamoff __off)
- {
- fpos __t(*this);
- __t += __off;
- return __t;
- }
-
- fpos
- operator-(streamoff __off)
- {
- fpos __t(*this);
- __t -= __off;
- return __t;
- }
-
- bool
- operator==(const fpos& __pos) const
- { return _M_off == __pos._M_off; }
-
- bool
- operator!=(const fpos& __pos) const
- { return !(*this == __pos); }
- };
-
- /// 27.2, paragraph 10 about fpos/char_traits circularity
- typedef fpos<mbstate_t> streampos;
-# ifdef _GLIBCXX_USE_WCHAR_T
- /// 27.2, paragraph 10 about fpos/char_traits circularity
- typedef fpos<mbstate_t> wstreampos;
-# endif
-} // namespace std
-
-#endif
diff --git a/libstdc++-v3/config/os/gnu-linux/fpos.h b/libstdc++-v3/config/os/gnu-linux/fpos.h
deleted file mode 100644
index 3f7900686dc..00000000000
--- a/libstdc++-v3/config/os/gnu-linux/fpos.h
+++ /dev/null
@@ -1,144 +0,0 @@
-// File position object and stream types, GNU version -*- C++ -*-
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003
-// Free Software Foundation, Inc.
-//
-// 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
-// Free Software Foundation; either version 2, or (at your option)
-// 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.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 27 Input/output library
-//
-
-/** @file fpos.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_BITS_FPOS_H
-#define _CPP_BITS_FPOS_H 1
-
-#pragma GCC system_header
-
-#include <bits/c++io.h>
-#include <cwchar> // For mbstate_t.
-
-namespace std
-{
- // 27.4.1 Types
-
- // [27.4.3] template class fpos
- /**
- * @doctodo
- */
- template<typename _StateT>
- class fpos
- {
- private:
- fpos_t _M_pos;
-
- public:
- _StateT
- state() const;
-
- void
- state(_StateT __st);
-
- fpos() : _M_pos(fpos_t()) { }
-
- // NB: The standard defines only the implicit copy ctor and the
- // previous two members. The rest is a "conforming extension".
- fpos(streamoff __off, _StateT __st = _StateT());
-
- fpos(const fpos_t& __pos) : _M_pos(__pos) { }
-
- operator streamoff() const { return _M_pos.__pos; }
-
- operator fpos_t() const { return _M_pos; }
-
- fpos&
- operator+=(streamoff __off)
- {
- _M_pos.__pos += __off;
- return *this;
- }
-
- fpos&
- operator-=(streamoff __off)
- {
- _M_pos.__pos -= __off;
- return *this;
- }
-
- fpos
- operator+(streamoff __off)
- {
- fpos __t(*this);
- __t += __off;
- return __t;
- }
-
- fpos
- operator-(streamoff __off)
- {
- fpos __t(*this);
- __t -= __off;
- return __t;
- }
-
- bool
- operator==(const fpos& __pos) const
- { return _M_pos.__pos == __pos._M_pos.__pos; }
-
- bool
- operator!=(const fpos& __pos) const
- { return !(*this == __pos); }
- };
-
- template<>
- inline mbstate_t
- fpos<mbstate_t>::state() const { return _M_pos.__state; }
-
- template<>
- inline void
- fpos<mbstate_t>::state(mbstate_t __st) { _M_pos.__state = __st; }
-
- template<>
- inline
- fpos<mbstate_t>::fpos(streamoff __off, mbstate_t __st) : _M_pos(fpos_t())
- {
- _M_pos.__pos = __off;
- _M_pos.__state = __st;
- }
-
- /// 27.2, paragraph 10 about fpos/char_traits circularity
- typedef fpos<mbstate_t> streampos;
-# ifdef _GLIBCXX_USE_WCHAR_T
- /// 27.2, paragraph 10 about fpos/char_traits circularity
- typedef fpos<mbstate_t> wstreampos;
-# endif
-} // namespace std
-
-#endif
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 5323ce5cd4c..c888d97abcb 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -308,7 +308,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE LIBUNWIND_FLAG GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H FPOS_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CCODECVT_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE glibcxx_thread_h DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS SYMVER_MAP port_specific_symbol_files GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE baseline_dir GLIBCXX_TEST_WCHAR_T_TRUE GLIBCXX_TEST_WCHAR_T_FALSE GLIBCXX_TEST_ABI_TRUE GLIBCXX_TEST_ABI_FALSE ATOMICITY_INC_SRCDIR FPOS_INC_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBTOOL CXXCPP CPPFLAGS enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE LIBUNWIND_FLAG GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC CPP EGREP check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CCODECVT_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE glibcxx_thread_h DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS SYMVER_MAP port_specific_symbol_files GLIBCXX_BUILD_VERSIONED_SHLIB_TRUE GLIBCXX_BUILD_VERSIONED_SHLIB_FALSE baseline_dir GLIBCXX_TEST_WCHAR_T_TRUE GLIBCXX_TEST_WCHAR_T_FALSE GLIBCXX_TEST_ABI_TRUE GLIBCXX_TEST_ABI_FALSE ATOMICITY_INC_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -5059,9 +5059,6 @@ echo "${ECHO_T}stdio" >&6
;;
esac
- FPOS_H=$fpos_include_dir
-
-
@@ -61549,8 +61546,6 @@ done
# uses it, and it only gets used in this file.)
ATOMICITY_INC_SRCDIR=config/${atomicity_include_dir}
OS_INC_SRCDIR=config/${os_include_dir}
-FPOS_INC_SRCDIR=config/${fpos_include_dir}
-
@@ -62644,7 +62639,6 @@ s,@GLIBCXX_BUILD_PCH_TRUE@,$GLIBCXX_BUILD_PCH_TRUE,;t t
s,@GLIBCXX_BUILD_PCH_FALSE@,$GLIBCXX_BUILD_PCH_FALSE,;t t
s,@glibcxx_PCHFLAGS@,$glibcxx_PCHFLAGS,;t t
s,@CSTDIO_H@,$CSTDIO_H,;t t
-s,@FPOS_H@,$FPOS_H,;t t
s,@BASIC_FILE_H@,$BASIC_FILE_H,;t t
s,@BASIC_FILE_CC@,$BASIC_FILE_CC,;t t
s,@CPP@,$CPP,;t t
@@ -62694,7 +62688,6 @@ s,@GLIBCXX_TEST_WCHAR_T_FALSE@,$GLIBCXX_TEST_WCHAR_T_FALSE,;t t
s,@GLIBCXX_TEST_ABI_TRUE@,$GLIBCXX_TEST_ABI_TRUE,;t t
s,@GLIBCXX_TEST_ABI_FALSE@,$GLIBCXX_TEST_ABI_FALSE,;t t
s,@ATOMICITY_INC_SRCDIR@,$ATOMICITY_INC_SRCDIR,;t t
-s,@FPOS_INC_SRCDIR@,$FPOS_INC_SRCDIR,;t t
s,@OS_INC_SRCDIR@,$OS_INC_SRCDIR,;t t
s,@glibcxx_prefixdir@,$glibcxx_prefixdir,;t t
s,@gxx_include_dir@,$gxx_include_dir,;t t
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 9a612cf8d14..893b6f8a946 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -261,9 +261,7 @@ GLIBCXX_CONFIGURE_TESTSUITE
# uses it, and it only gets used in this file.)
ATOMICITY_INC_SRCDIR=config/${atomicity_include_dir}
OS_INC_SRCDIR=config/${os_include_dir}
-FPOS_INC_SRCDIR=config/${fpos_include_dir}
AC_SUBST(ATOMICITY_INC_SRCDIR)
-AC_SUBST(FPOS_INC_SRCDIR)
AC_SUBST(OS_INC_SRCDIR)
# Determine cross-compile flags and AM_CONDITIONALs.
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index e830e1b7a4e..3b800238824 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -30,8 +30,6 @@
# abi_baseline_pair directory name for ABI compat testing,
# defaults to host_cpu-host_os (as per config.guess)
#
-# fpos_include_dir directory for definition of fpos template
-#
# atomicity_include_dir location of atomicity.h,
# defaults to cpu_include_dir
#
@@ -59,7 +57,6 @@
# systems out there. :-)
c_model=c_std
c_compatibility=no
-fpos_include_dir="os/generic"
# HOST-SPECIFIC OVERRIDES
# Set any CPU-dependent bits.
@@ -149,7 +146,6 @@ case "${host_os}" in
;;
gnu* | linux*)
os_include_dir="os/gnu-linux"
- fpos_include_dir=$os_include_dir
;;
hpux*)
os_include_dir="os/hpux"
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 3a8bf72ade9..862b0a3a8a0 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -118,6 +118,7 @@ bits_headers = \
${bits_srcdir}/localefwd.h \
${bits_srcdir}/mask_array.h \
${bits_srcdir}/ostream.tcc \
+ ${bits_srcdir}/postypes.h \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/slice_array.h \
@@ -311,8 +312,7 @@ host_headers = \
${host_srcdir}/ctype_inline.h \
${host_srcdir}/ctype_noninline.h \
${host_srcdir}/os_defines.h \
- ${glibcxx_srcdir}/$(ATOMICITY_INC_SRCDIR)/atomicity.h \
- ${glibcxx_srcdir}/$(FPOS_INC_SRCDIR)/fpos.h
+ ${glibcxx_srcdir}/$(ATOMICITY_INC_SRCDIR)/atomicity.h
# Non-installed host_header files.
host_headers_noinst = \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 35c724e6a27..1db9bfcd555 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.7.6 from Makefile.am.
+# Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
@@ -80,8 +80,6 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
-FPOS_H = @FPOS_H@
-FPOS_INC_SRCDIR = @FPOS_INC_SRCDIR@
GLIBCXX_BUILD_DEBUG_FALSE = @GLIBCXX_BUILD_DEBUG_FALSE@
GLIBCXX_BUILD_DEBUG_TRUE = @GLIBCXX_BUILD_DEBUG_TRUE@
GLIBCXX_BUILD_PCH_FALSE = @GLIBCXX_BUILD_PCH_FALSE@
@@ -316,6 +314,7 @@ bits_headers = \
${bits_srcdir}/localefwd.h \
${bits_srcdir}/mask_array.h \
${bits_srcdir}/ostream.tcc \
+ ${bits_srcdir}/postypes.h \
${bits_srcdir}/stream_iterator.h \
${bits_srcdir}/streambuf_iterator.h \
${bits_srcdir}/slice_array.h \
@@ -491,12 +490,12 @@ c_compatibility_headers = \
${c_compatibility_srcdir}/wchar.h \
${c_compatibility_srcdir}/wctype.h
-@GLIBCXX_C_HEADERS_C_STD_FALSE@c_base_headers_extra =
# Some of the different "C" header models need extra files.
# Some "C" header schemes require the "C" compatibility headers.
# For --enable-cheaders=c_std
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_base_headers_extra = ${c_base_srcdir}/cmath.tcc
+@GLIBCXX_C_HEADERS_C_STD_FALSE@c_base_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@c_compatibility_headers_extra =
@GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@c_compatibility_headers_extra = ${c_compatibility_headers}
@@ -508,8 +507,7 @@ host_headers = \
${host_srcdir}/ctype_inline.h \
${host_srcdir}/ctype_noninline.h \
${host_srcdir}/os_defines.h \
- ${glibcxx_srcdir}/$(ATOMICITY_INC_SRCDIR)/atomicity.h \
- ${glibcxx_srcdir}/$(FPOS_INC_SRCDIR)/fpos.h
+ ${glibcxx_srcdir}/$(ATOMICITY_INC_SRCDIR)/atomicity.h
# Non-installed host_header files.
@@ -539,10 +537,10 @@ pch_input = ${host_builddir}/stdc++.h
pch_output_builddir = ${host_builddir}/stdc++.h.gch
pch_source = ${glibcxx_srcdir}/include/stdc++.h
PCHFLAGS = -Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
-@GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_input}
@GLIBCXX_BUILD_PCH_FALSE@pch_build =
-@GLIBCXX_BUILD_PCH_TRUE@pch_install = install-pch
+@GLIBCXX_BUILD_PCH_TRUE@pch_build = ${pch_input}
@GLIBCXX_BUILD_PCH_FALSE@pch_install =
+@GLIBCXX_BUILD_PCH_TRUE@pch_install = install-pch
# List of all timestamp files. By keeping only one copy of this list, both
# CLEANFILES and all-local are kept up-to-date.
@@ -571,7 +569,8 @@ CONFIG_CLEAN_FILES =
depcomp =
am__depfiles_maybe =
DIST_SOURCES =
-DIST_COMMON = $(top_srcdir)/fragment.am Makefile.am Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/fragment.am \
+ Makefile.am
all: all-am
.SUFFIXES:
@@ -654,7 +653,7 @@ clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -664,7 +663,7 @@ clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-
+ -rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
@@ -686,7 +685,7 @@ install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-
+ -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index ba0499f12da..34479755e85 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -44,7 +44,7 @@
#include <cstring> // For memmove, memset, memchr
#include <bits/stl_algobase.h>// For copy, lexicographical_compare, fill_n
-#include <bits/fpos.h> // For streampos
+#include <bits/postypes.h> // For streampos
namespace __gnu_cxx
{
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index f6f1b755a9c..a93459a71f3 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -106,7 +106,8 @@ namespace std
// 27.8.1.3,4
if ((__mode & ios_base::ate)
- && this->seekoff(0, ios_base::end, __mode) < 0)
+ && this->seekoff(0, ios_base::end, __mode)
+ == pos_type(off_type(-1)))
this->close();
else
__ret = this;
@@ -333,7 +334,7 @@ namespace std
this->gbump(-1);
__tmp = traits_type::to_int_type(*this->gptr());
}
- else if (this->seekoff(-1, ios_base::cur) >= 0)
+ else if (this->seekoff(-1, ios_base::cur) != pos_type(off_type(-1)))
{
__tmp = this->underflow();
if (traits_type::eq_int_type(__tmp, __ret))
@@ -653,7 +654,7 @@ namespace std
}
// Returns pos_type(off_type(-1)) in case of failure.
- pos_type __ret = _M_file.seekoff(__off, __way);
+ pos_type __ret (_M_file.seekoff(__off, __way));
_M_reading = false;
_M_writing = false;
@@ -673,24 +674,35 @@ namespace std
basic_filebuf<_CharT, _Traits>::
imbue(const locale& __loc)
{
- const bool __testbeg = !this->seekoff(0, ios_base::cur, this->_M_mode);
- const bool __teststate = __check_facet(_M_codecvt).encoding() == -1;
-
- if (this->_M_buf_locale != __loc
- && (!this->is_open() || (__testbeg && !__teststate)))
+ if (this->_M_buf_locale != __loc)
{
- this->_M_buf_locale = __loc;
- if (__builtin_expect(has_facet<__codecvt_type>(__loc), true))
- _M_codecvt = &use_facet<__codecvt_type>(__loc);
- else
- _M_codecvt = 0;
-
- // NB This may require the reconversion of previously
- // converted chars. This in turn may cause the
- // reconstruction of the original file. YIKES!! This
- // implementation interprets this requirement as requiring
- // the file position be at the beginning, and a stateless
- // encoding, or that the filebuf be closed. Opinions may differ.
+ bool __testfail = false;
+ if (this->is_open())
+ {
+ const bool __testbeg =
+ this->seekoff(0, ios_base::cur, this->_M_mode) ==
+ pos_type(off_type(0));
+ const bool __teststate =
+ __check_facet(_M_codecvt).encoding() == -1;
+
+ __testfail = !__testbeg || __teststate;
+ }
+
+ if (!__testfail)
+ {
+ this->_M_buf_locale = __loc;
+ if (__builtin_expect(has_facet<__codecvt_type>(__loc), true))
+ _M_codecvt = &use_facet<__codecvt_type>(__loc);
+ else
+ _M_codecvt = 0;
+
+ // NB This may require the reconversion of previously
+ // converted chars. This in turn may cause the
+ // reconstruction of the original file. YIKES!! This
+ // implementation interprets this requirement as requiring
+ // the file position be at the beginning, and a stateless
+ // encoding, or that the filebuf be closed. Opinions may differ.
+ }
}
_M_last_overflowed = false;
}
diff --git a/libstdc++-v3/include/bits/postypes.h b/libstdc++-v3/include/bits/postypes.h
new file mode 100644
index 00000000000..50781ba6a50
--- /dev/null
+++ b/libstdc++-v3/include/bits/postypes.h
@@ -0,0 +1,253 @@
+// Position types -*- C++ -*-
+
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 27.4.1 - Types
+// ISO C++ 14882: 27.4.3 - Template class fpos
+//
+
+/** @file postypes.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_POSTYPES_H
+#define _GLIBCXX_POSTYPES_H 1
+
+#pragma GCC system_header
+
+#include <cwchar> // For mbstate_t
+
+namespace std
+{
+ // The types streamoff, streampos and wstreampos and the class
+ // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2,
+ // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbage, the
+ // behaviour of these types is mostly implementation defined or
+ // unspecified. The behaviour in this implementation is as noted
+ // below.
+ typedef long __streamoff_base_type;
+ typedef ptrdiff_t streamsize; // Signed integral type
+
+ template<typename _StateT>
+ class fpos;
+
+ // Class streamoff is an implementation defined type that meets the
+ // requirements for streamoff. It stores an offset as a signed
+ // integer. Note: this class is an implementation detail.
+ class streamoff
+ {
+ private:
+ __streamoff_base_type _M_off;
+
+ public:
+ // Nothing in the standard requires that streamoff can be default
+ // constructed. In this implementation a default constructor that
+ // stores the value 0 is provided.
+ streamoff()
+ : _M_off(0) { }
+
+ // The standard only requires that streamoff can be constructed
+ // from streamsize using the constructor syntax. This
+ // implementation also allows implicit conversion from integer
+ // types to streamoff.
+ streamoff(__streamoff_base_type __off)
+ : _M_off(__off) { }
+
+ // The standard requires that streamoff can be constructed from
+ // instances of fpos using the constructor syntax, but gives no
+ // semantics for this construction. In this implementation it
+ // extracts the offset stored by the fpos object.
+ // Note: In versions of GCC up to and including GCC 3.3, implicit
+ // conversion from fpos to streamoff was allowed. This constructor
+ // has now been made explicit to improve type safety.
+ template<typename _StateT>
+ explicit
+ streamoff(const fpos<_StateT>&);
+
+ // The standard requires that streamsize can be constructed from
+ // streamoff using the constructor syntax. This implementation
+ // also allows implicit conversion. This allows streamoff objects
+ // to be used in arithmetic expressions and to be compared against
+ // each other and integer types.
+ operator __streamoff_base_type() const
+ { return _M_off; }
+
+ // This implementation allows the use of operators +=, -=, ++ and
+ // -- on streamoff objects.
+ streamoff&
+ operator+=(__streamoff_base_type __off)
+ {
+ _M_off += __off;
+ return *this;
+ }
+
+ streamoff&
+ operator-=(__streamoff_base_type __off)
+ {
+ _M_off -= __off;
+ return *this;
+ }
+ };
+
+ // In clauses 21.1.3.1 and 27.4.1 streamoff is described as an
+ // implementation defined type. In this implementation it is a
+ // distinct class type.
+ // Note: In versions of GCC up to and including GCC 3.3, streamoff
+ // was typedef long.
+ typedef class streamoff streamoff;
+
+ // The standard fails to place any requiremens on the template
+ // argument StateT. In this implementation StateT must be
+ // DefaultConstructible, CopyConstructible and Assignable. The
+ // standard only requires that fpos should contain a member of type
+ // StateT. In this implementation it also contains an offset stored
+ // as a signed integer.
+ template<typename _StateT>
+ class fpos
+ {
+ private:
+ friend class streamoff;
+
+ __streamoff_base_type _M_off;
+ _StateT _M_state;
+
+ public:
+ // The standard doesn't require that fpos objects can be default
+ // constructed. This implementation provides a default
+ // constructor that initializes the offset to 0 and default
+ // constructs the state.
+ fpos()
+ : _M_off(0), _M_state() { }
+
+ // The standard requires implicit conversion from integers to
+ // fpos, but gives no meaningful semantics for this
+ // conversion. In this implementation this constructor stores
+ // the integer as the offset and default constructs the state.
+ fpos(__streamoff_base_type __off)
+ : _M_off(__off), _M_state() { }
+
+ // The standard requires that fpos objects can be constructed
+ // from streamoff objects using the constructor syntax, and
+ // fails to give any meaningful semantics. In this
+ // implementation implicit conversion is also allowed, and this
+ // constructor stores the streamoff as the offset and default
+ // constructs the state.
+ fpos(const streamoff& __off)
+ : _M_off(__off), _M_state() { }
+
+ void
+ state(_StateT __st)
+ { _M_state = __st; }
+
+ _StateT
+ state() const
+ { return _M_state; }
+
+ // The standard only requires that operator== must be an
+ // equivalence relation. In this implementation two fpos<StateT>
+ // objects belong to the same equivalence class if the contained
+ // offsets compare equal.
+ bool
+ operator==(const fpos& __other) const
+ { return _M_off == __other._M_off; }
+
+ bool
+ operator!=(const fpos& __other) const
+ { return _M_off != __other._M_off; }
+
+ // The standard requires that this operator must be defined, but
+ // gives no semantics. In this implemenation it just adds it's
+ // argument to the stored offset and returns *this.
+ fpos&
+ operator+=(const streamoff& __off)
+ {
+ _M_off += __off;
+ return *this;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // gives no semantics. In this implemenation it just subtracts
+ // it's argument from the stored offset and returns *this.
+ fpos&
+ operator-=(const streamoff& __off)
+ {
+ _M_off -= __off;
+ return *this;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // defines it's semantics only in terms of operator-. In this
+ // implementation it constructs a copy of *this, adds the
+ // argument to that copy using operator+= and then returns the
+ // copy.
+ fpos
+ operator+(const streamoff& __off) const
+ {
+ fpos __pos(*this);
+ __pos += __off;
+ return __pos;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // defines it's semantics only in terms of operator+. In this
+ // implementation it constructs a copy of *this, subtracts the
+ // argument from that copy using operator-= and then returns the
+ // copy.
+ fpos
+ operator-(const streamoff& __off) const
+ {
+ fpos __pos(*this);
+ __pos -= __off;
+ return __pos;
+ }
+
+ // The standard requires that this operator must be defined, but
+ // defines it's semantics only in terms of operator+. In this
+ // implementation it returns the difference between the offset
+ // stored in *this and in the argument.
+ streamoff
+ operator-(const fpos& __other) const
+ { return _M_off - __other._M_off; }
+ };
+
+ template<typename _StateT>
+ inline
+ streamoff::streamoff(const fpos<_StateT>& __pos)
+ : _M_off(__pos._M_off) { }
+
+ // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos
+ // as implementation defined types, but clause 27.2 requires that
+ // they must both be typedefs for fpos<mbstate_t>
+ typedef fpos<mbstate_t> streampos;
+ typedef fpos<mbstate_t> wstreampos;
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/bits/sstream.tcc b/libstdc++-v3/include/bits/sstream.tcc
index 0430a260d75..dfa1d6810bd 100644
--- a/libstdc++-v3/include/bits/sstream.tcc
+++ b/libstdc++-v3/include/bits/sstream.tcc
@@ -185,7 +185,7 @@ namespace std
if (_M_string.capacity())
{
- off_type __pos = __sp; // Use streamoff operator to do conversion.
+ off_type __pos (__sp);
const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
char_type* __beg = __testin ? this->eback() : this->pbase();
diff --git a/libstdc++-v3/include/std/std_iosfwd.h b/libstdc++-v3/include/std/std_iosfwd.h
index 71288b5b404..050b9e8bab7 100644
--- a/libstdc++-v3/include/std/std_iosfwd.h
+++ b/libstdc++-v3/include/std/std_iosfwd.h
@@ -44,9 +44,10 @@
#include <bits/c++config.h>
#include <bits/c++locale.h>
+#include <bits/c++io.h>
#include <cctype> // For isspace, etc.
#include <bits/stringfwd.h> // For string forward declarations.
-#include <bits/fpos.h>
+#include <bits/postypes.h>
#include <bits/functexcept.h>
namespace std
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc
index e5f6f99b187..bef5cf7329b 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc
@@ -65,7 +65,7 @@ void test05()
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
strmsz_2 = fb.in_avail();
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '9' );
@@ -81,7 +81,7 @@ void test05()
//cur
pt_2 = fb.pubseekoff(2, ios_base::cur);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '1' );
@@ -98,7 +98,7 @@ void test05()
//end
pt_2 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb.sputc('\n');
strmsz_1 = fb.sputn("because because because. . .", 28);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
index 248f819cc8f..b6a8c0cb67d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
@@ -65,7 +65,7 @@ void test05()
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
strmsz_2 = fb.in_avail();
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '9' );
@@ -81,7 +81,7 @@ void test05()
//cur
pt_2 = fb.pubseekoff(2, ios_base::cur);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '1' );
@@ -96,7 +96,7 @@ void test05()
//end
pt_2 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb.sputc('\n');
strmsz_1 = fb.sputn("because because because. . .", 28);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc
index f83af783d3c..1cd29316acd 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc
@@ -66,7 +66,7 @@ void test05()
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
strmsz_2 = fb.in_avail();
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == traits_type::eof() );
@@ -82,7 +82,7 @@ void test05()
//cur
pt_2 = fb.pubseekoff(2, ios_base::cur);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == traits_type::eof() );
@@ -97,7 +97,7 @@ void test05()
//end
pt_2 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb.sputc('\n');
strmsz_1 = fb.sputn("because because because. . .", 28);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/11543.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/11543.cc
new file mode 100644
index 00000000000..dccebbc77f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/11543.cc
@@ -0,0 +1,152 @@
+// Copyright (C) 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.8.1.4 Overridden virtual functions
+
+#include <fstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+struct MyState
+{
+};
+
+struct MyCharTraits : std::char_traits<char>
+{
+ typedef std::fpos<MyState> pos_type;
+ typedef MyState state_type;
+};
+
+namespace std
+{
+ template <>
+ class codecvt<char, char, MyState> :
+ public locale::facet, public codecvt_base
+ {
+ public:
+ typedef char intern_type;
+ typedef char extern_type;
+ typedef MyState state_type;
+
+ explicit codecvt(size_t refs = 0)
+ : locale::facet(refs) { }
+
+ result out(state_type& state, const intern_type* from,
+ const intern_type* from_end, const intern_type*& from_next,
+ extern_type* to, extern_type* to_limit,
+ extern_type*& to_next) const
+ { return do_out(state, from, from_end, from_next,
+ to, to_limit, to_next); }
+
+ result unshift(state_type& state, extern_type* to, extern_type* to_limit,
+ extern_type*& to_next) const
+ { return do_unshift(state, to, to_limit, to_next); }
+
+ result in(state_type& state, const extern_type* from,
+ const extern_type* from_end, const extern_type*& from_next,
+ intern_type* to, intern_type* to_limit,
+ intern_type*& to_next) const
+ { return do_in(state, from, from_end, from_next,
+ to, to_limit, to_next); }
+
+ int encoding() const throw()
+ { return do_encoding(); }
+
+ bool always_noconv() const throw()
+ { return do_always_noconv(); }
+
+ int length(state_type& state, const extern_type* from,
+ const extern_type* end, size_t max) const
+ { return do_length(state, from, end, max); }
+
+ int max_length() const throw()
+ { return do_max_length(); }
+
+ static locale::id id;
+
+ protected:
+ virtual ~codecvt();
+
+ virtual result do_out(state_type&, const intern_type* from,
+ const intern_type*, const intern_type*& from_next,
+ extern_type* to, extern_type*,
+ extern_type*& to_next) const
+ {
+ from_next = from;
+ to_next = to;
+ return noconv;
+ }
+
+ virtual result do_in(state_type&, const extern_type* from,
+ const extern_type*, const extern_type*& from_next,
+ intern_type* to, intern_type*,
+ intern_type*& to_next) const
+ {
+ from_next = from;
+ to_next = to;
+ return noconv;
+ }
+
+ virtual result do_unshift(state_type&, extern_type*, extern_type*,
+ extern_type*&) const
+ { return noconv; }
+
+ virtual int do_encoding() const throw()
+ { return 1; }
+
+ virtual bool do_always_noconv() const throw()
+ { return true; }
+
+ virtual int do_length(state_type&, const extern_type* from,
+ const extern_type* end, size_t max) const
+ {
+ size_t len = end - from;
+ return std::min(max, len);
+ }
+
+ virtual int do_max_length() const throw()
+ { return 1; }
+ };
+
+ locale::id codecvt<char, char, MyState>::id;
+
+ codecvt<char, char, MyState>::~codecvt()
+ { }
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::locale loc(std::locale::classic(),
+ new std::codecvt<char, char, MyState>);
+ std::basic_filebuf<char, MyCharTraits> fb;
+ fb.pubimbue(loc);
+ fb.open("tmp_11543", std::ios_base::out);
+ VERIFY( fb.is_open() );
+ MyCharTraits::pos_type pos = fb.pubseekoff(0, std::ios_base::beg);
+ VERIFY( pos != MyCharTraits::pos_type(MyCharTraits::off_type(-1)) );
+ fb.close();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc
index 84a52a74100..96ac5821a71 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc
@@ -66,7 +66,7 @@ void test05()
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
strmsz_2 = fb.in_avail();
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '9' );
@@ -82,7 +82,7 @@ void test05()
//cur
pt_2 = fb.pubseekoff(2, ios_base::cur);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '1' );
@@ -99,7 +99,7 @@ void test05()
//end
pt_2 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb.sputc('\n');
strmsz_1 = fb.sputn("because because because. . .", 28);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
index 9fc418f830e..f636bbbeffd 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
@@ -65,7 +65,7 @@ void test05()
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
strmsz_2 = fb.in_avail();
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '9' );
@@ -81,7 +81,7 @@ void test05()
//cur
pt_2 = fb.pubseekoff(2, ios_base::cur);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == '1' );
@@ -96,7 +96,7 @@ void test05()
//end
pt_2 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb.sputc('\n');
strmsz_1 = fb.sputn("because because because. . .", 28);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc
index cae238940cd..2f78957444e 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc
@@ -66,7 +66,7 @@ void test05()
strmsz_1 = fb.in_avail();
pt_1 = fb.pubseekoff(2, ios_base::beg);
strmsz_2 = fb.in_avail();
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == traits_type::eof() );
@@ -82,7 +82,7 @@ void test05()
//cur
pt_2 = fb.pubseekoff(2, ios_base::cur);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( (off_2 == (off_1 + 2 + 1 + 1)) );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == traits_type::eof() );
@@ -97,7 +97,7 @@ void test05()
//end
pt_2 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 > off_2 ); //weak, but don't know exactly where it ends
c3 = fb.sputc('\n');
strmsz_1 = fb.sputn("because because because. . .", 28);
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc
new file mode 100644
index 00000000000..9684fe30cea
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc
@@ -0,0 +1,142 @@
+// Copyright (C) 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.8.1.4 Overridden virtual functions
+
+#include <fstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+struct MyState
+{
+};
+
+struct MyCharTraits : std::char_traits<wchar_t>
+{
+ typedef std::fpos<MyState> pos_type;
+ typedef MyState state_type;
+};
+
+namespace std
+{
+ template <>
+ class codecvt<wchar_t, char, MyState> :
+ public locale::facet, public codecvt_base
+ {
+ public:
+ typedef wchar_t intern_type;
+ typedef char extern_type;
+ typedef MyState state_type;
+
+ explicit codecvt(size_t refs = 0)
+ : locale::facet(refs) { }
+
+ result out(state_type& state, const intern_type* from,
+ const intern_type* from_end, const intern_type*& from_next,
+ extern_type* to, extern_type* to_limit,
+ extern_type*& to_next) const
+ { return do_out(state, from, from_end, from_next,
+ to, to_limit, to_next); }
+
+ result unshift(state_type& state, extern_type* to, extern_type* to_limit,
+ extern_type*& to_next) const
+ { return do_unshift(state, to, to_limit, to_next); }
+
+ result in(state_type& state, const extern_type* from,
+ const extern_type* from_end, const extern_type*& from_next,
+ intern_type* to, intern_type* to_limit,
+ intern_type*& to_next) const
+ { return do_in(state, from, from_end, from_next,
+ to, to_limit, to_next); }
+
+ int encoding() const throw()
+ { return do_encoding(); }
+
+ bool always_noconv() const throw()
+ { return do_always_noconv(); }
+
+ int length(state_type& state, const extern_type* from,
+ const extern_type* end, size_t max) const
+ { return do_length(state, from, end, max); }
+
+ int max_length() const throw()
+ { return do_max_length(); }
+
+ static locale::id id;
+
+ protected:
+ virtual ~codecvt();
+
+ virtual result do_out(state_type&, const intern_type*,
+ const intern_type*, const intern_type*&,
+ extern_type*, extern_type*, extern_type*&) const
+ { return error; }
+
+ virtual result do_in(state_type&, const extern_type*, const extern_type*,
+ const extern_type*&, intern_type*, intern_type*,
+ intern_type*&) const
+ { return error; }
+
+ virtual result do_unshift(state_type&, extern_type*, extern_type*,
+ extern_type*&) const
+ { return noconv; }
+
+ virtual int do_encoding() const throw()
+ { return 1; }
+
+ virtual bool do_always_noconv() const throw()
+ { return false; }
+
+ virtual int do_length(state_type&, const extern_type* from,
+ const extern_type* end, size_t max) const
+ {
+ size_t len = end - from;
+ return std::min(max, len);
+ }
+
+ virtual int do_max_length() const throw()
+ { return 1; }
+ };
+
+ locale::id codecvt<wchar_t, char, MyState>::id;
+
+ codecvt<wchar_t, char, MyState>::~codecvt()
+ { }
+}
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::locale loc(std::locale::classic(),
+ new std::codecvt<wchar_t, char, MyState>);
+ std::basic_filebuf<wchar_t, MyCharTraits> fb;
+ fb.pubimbue(loc);
+ fb.open("tmp_11543", std::ios_base::out);
+ VERIFY( fb.is_open() );
+ MyCharTraits::pos_type pos = fb.pubseekoff(0, std::ios_base::beg);
+ VERIFY( pos != MyCharTraits::pos_type(MyCharTraits::off_type(-1)) );
+ fb.close();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc
index 55345b9748a..bf7756b7a1c 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc
@@ -63,7 +63,7 @@ void test05()
// beg
pt_1 = fb.pubseekoff(78, ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == 't' );
@@ -77,7 +77,7 @@ void test05()
c3 = fb.sgetc();
fb.pubsync(); //resets pointers
pt_2 = fb.pubseekpos(pt_1);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = fb.snextc(); //current in pointer +1
VERIFY( c2 == traits_type::eof() );
@@ -85,7 +85,7 @@ void test05()
// end
pt_1 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > off_2 );
fb.sputn("\nof the wonderful things he does!!\nok", 37);
fb.pubsync();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
index 23f663cda0a..eea3be8108f 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
@@ -63,7 +63,7 @@ void test05()
// beg
pt_1 = fb.pubseekoff(78, ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == 't' );
@@ -77,14 +77,14 @@ void test05()
c3 = fb.sgetc();
fb.pubsync(); //resets pointers
pt_2 = fb.pubseekpos(pt_1);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = fb.snextc(); //current in pointer +1
VERIFY( c2 == c3 );
// end
pt_1 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > off_2 );
fb.sputn("\nof the wonderful things he does!!\nok", 37);
fb.pubsync();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc
index 8773f6e00bb..cc29a27204d 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc
@@ -64,7 +64,7 @@ void test05()
// beg
pt_1 = fb.pubseekoff(78, ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == traits_type::eof() );
@@ -78,7 +78,7 @@ void test05()
c3 = fb.sgetc();
fb.pubsync(); //resets pointers
pt_2 = fb.pubseekpos(pt_1);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = fb.snextc(); //current in pointer +1
VERIFY( c2 != c3 );
@@ -86,7 +86,7 @@ void test05()
// end
pt_1 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > off_2 );
fb.sputn("\nof the wonderful things he does!!\nok", 37);
fb.pubsync();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc
index cec2cdf748f..4bead04ca9b 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc
@@ -64,7 +64,7 @@ void test05()
// beg
pt_1 = fb.pubseekoff(78, ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == 't' );
@@ -78,7 +78,7 @@ void test05()
c3 = fb.sgetc();
fb.pubsync(); //resets pointers
pt_2 = fb.pubseekpos(pt_1);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = fb.snextc(); //current in pointer +1
VERIFY( c2 == traits_type::eof() );
@@ -86,7 +86,7 @@ void test05()
// end
pt_1 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > off_2 );
fb.sputn("\nof the wonderful things he does!!\nok", 37);
fb.pubsync();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc
index c564e1bda28..73fb8b55ff6 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc
@@ -63,7 +63,7 @@ void test05()
// beg
pt_1 = fb.pubseekoff(78, ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == 't' );
@@ -77,14 +77,14 @@ void test05()
c3 = fb.sgetc();
fb.pubsync(); //resets pointers
pt_2 = fb.pubseekpos(pt_1);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = fb.snextc(); //current in pointer +1
VERIFY( c2 == c3 );
// end
pt_1 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > off_2 );
fb.sputn("\nof the wonderful things he does!!\nok", 37);
fb.pubsync();
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc
index a919f4fc32e..df145735df2 100644
--- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc
@@ -64,7 +64,7 @@ void test05()
// beg
pt_1 = fb.pubseekoff(78, ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > 0 );
c1 = fb.snextc(); //current in pointer +1
VERIFY( c1 == traits_type::eof() );
@@ -78,7 +78,7 @@ void test05()
c3 = fb.sgetc();
fb.pubsync(); //resets pointers
pt_2 = fb.pubseekpos(pt_1);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = fb.snextc(); //current in pointer +1
VERIFY( c2 != c3 );
@@ -86,7 +86,7 @@ void test05()
// end
pt_1 = fb.pubseekoff(0, ios_base::end);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 > off_2 );
fb.sputn("\nof the wonderful things he does!!\nok", 37);
fb.pubsync();
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2.cc
index e20854c3f82..33cb81276a0 100644
--- a/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/seekg/char/2.cc
@@ -36,7 +36,8 @@ void test01()
int count1 = ist.gcount();
ist.seekg(pos);
int count2 = ist.gcount();
- ist.seekg(pos, ios::beg);
+ VERIFY( count1 == count2 );
+ ist.seekg(ios::off_type(pos), ios::beg);
count2 = ist.gcount();
VERIFY( count1 == count2 );
}
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
index aa32edde22d..08e5afbce51 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc
@@ -63,7 +63,7 @@ void test04()
//IN|OUT
//beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 >= 0 );
c1 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == 'o' );
@@ -72,12 +72,12 @@ void test04()
VERIFY( strb_01.str() == str_tmp );
//cur
pt_1 = strb_01.pubseekoff(2, std::ios_base::cur);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 == -1 ); // can't seekoff for in and out + cur in sstreams
pt_1 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
pt_2 = strb_01.pubseekoff(2, std::ios_base::cur, std::ios_base::in);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_2 == off_1 + 2 );
c1 = strb_01.snextc(); //current in pointer + 1
VERIFY( c1 == ' ' );
@@ -86,7 +86,7 @@ void test04()
VERIFY( strb_01.str() == str_tmp );
//end
pt_2 = strb_01.pubseekoff(2, std::ios_base::end);
- off_1 = pt_2;
+ off_1 = off_type(pt_2);
VERIFY( off_1 == -1 ); // not a valid position
VERIFY( strb_01.str() == str_tmp );
// end part two (from the filebuf tests)
diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
index 9ed89f9da3e..c84dbcd47a7 100644
--- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc
@@ -63,10 +63,10 @@ void test04()
//IN|OUT
//beg
pt_1 = strb_01.pubseekoff(2, std::ios_base::beg);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
VERIFY( off_1 >= 0 );
pt_1 = strb_01.pubseekoff(0, std::ios_base::cur, std::ios_base::out);
- off_1 = pt_1;
+ off_1 = off_type(pt_1);
c1 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == 'o' );
c2 = strb_01.sputc('x'); //test current out pointer
@@ -74,7 +74,7 @@ void test04()
VERIFY( strb_01.str() == str_tmp );
strb_01.pubsync(); //resets pointers
pt_2 = strb_01.pubseekpos(pt_1, std::ios_base::in|std::ios_base::out);
- off_2 = pt_2;
+ off_2 = off_type(pt_2);
VERIFY( off_1 == off_2 );
c3 = strb_01.snextc(); //current in pointer +1
VERIFY( c1 == c3 );
diff --git a/libstdc++-v3/testsuite/27_io/fpos/11450.cc b/libstdc++-v3/testsuite/27_io/fpos/11450.cc
new file mode 100644
index 00000000000..18e8765d838
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos/11450.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.3 fpos
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+// libstdc++/11450
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::fpos<int> p;
+ VERIFY( p.state() == 0 );
+ p.state(42);
+ VERIFY( p.state() == 42 );
+
+ std::fpos<int> q = p + static_cast<std::streamoff>(1);
+ VERIFY( q.state() == 42 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/12065.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/12065.cc
new file mode 100644
index 00000000000..908d58018b4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/12065.cc
@@ -0,0 +1,47 @@
+// Copyright (C) 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.3 fpos
+
+#include <typeinfo>
+#include <ios>
+#include <testsuite_hooks.h>
+
+// libstdc++/12065
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::streampos p(0);
+ const std::streampos q(0);
+ std::streamoff o(0);
+
+ VERIFY( typeid(p + o) == typeid(std::streampos) );
+ VERIFY( typeid(q + o) == typeid(std::streampos) );
+ VERIFY( typeid(p - o) == typeid(std::streampos) );
+ VERIFY( typeid(q - o) == typeid(std::streampos) );
+ VERIFY( typeid(p - q) == typeid(std::streamoff) );
+ VERIFY( typeid(q - p) == typeid(std::streamoff) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc
index 4b79950fa8c..0458bb6a039 100644
--- a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/3.cc
@@ -41,9 +41,8 @@ void test03()
std::streamoff off01;
// casts to const streamoff
- // (yes, I know this is weak code)
const std::streampos pos01 = 0;
- off01 = pos01;
+ off01 = std::streamoff(pos01);
// equality/inequality with const args
const std::streampos pos02(54);
diff --git a/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc
new file mode 100644
index 00000000000..ace81eb2669
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/fpos/mbstate_t/4_neg.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.3 fpos
+
+// { dg-do compile }
+
+#include <ios>
+
+void test04()
+{
+ std::streampos pos;
+ long n;
+
+ // Implicit conversion
+ n = pos; // { dg-error "cannot convert" }
+
+ // Explicit conversion
+ n = static_cast<long>(pos); // { dg-error "invalid static_cast" }
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/objects/char/10.cc b/libstdc++-v3/testsuite/27_io/objects/char/10.cc
index 57188ca10d3..ff55907eef0 100644
--- a/libstdc++-v3/testsuite/27_io/objects/char/10.cc
+++ b/libstdc++-v3/testsuite/27_io/objects/char/10.cc
@@ -50,7 +50,7 @@ void test10()
streamoff n = p2 - p1;
VERIFY( n > 0 );
- for (streamoff i = 0; i < n; ++i)
+ for (int i = 0; i < n; ++i)
{
streampos p3 = cin.tellg();
VERIFY( streamoff(p3) == i );
diff --git a/libstdc++-v3/testsuite/27_io/types/3.cc b/libstdc++-v3/testsuite/27_io/types/3.cc
new file mode 100644
index 00000000000..40ea32b6399
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/types/3.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2003
+// Free Software Foundation, Inc.
+//
+// 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
+// Free Software Foundation; either version 2, or (at your option)
+// 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.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.4.3 streamoff
+
+#include <ios>
+#include <limits>
+#include <testsuite_hooks.h>
+
+void check(std::streamsize n)
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY( std::streamsize(std::streamoff(n)) == n );
+}
+
+void test03()
+{
+ check(0);
+ check(-1);
+ check(1);
+ check(std::numeric_limits<std::streamsize>::min());
+ check(std::numeric_limits<std::streamsize>::min() + 1);
+ check(std::numeric_limits<std::streamsize>::min() / 2);
+ check(std::numeric_limits<std::streamsize>::max());
+ check(std::numeric_limits<std::streamsize>::max() - 1);
+ check(std::numeric_limits<std::streamsize>::max() / 2);
+}
+
+int main()
+{
+ test03();
+ return 0;
+}