Commit d32c94be by Benjamin Kosnik

std_iosfwd.h: Remove string forward decls here.


2001-03-07  Benjamin Kosnik  <bkoz@redhat.com>

	* include/bits/std_iosfwd.h: Remove string forward decls here.
	* include/bits/stringfwd.h: Add forward decls for char_traits
	specializations.
	* config/c_io_libio.h (wstreamoff): Delete.
	* config/c_io_stdio.h (wstreamoff): Same.
	* include/bits/char_traits.h: Use streamoff not wstreamoff for
	char_traits<wchar_t>::off_type.
	Remove duplicate typedefs.
	* include/bits/fpos.h: Define streampos/wstreampos here.
	* testsuite/27_io/istream_seeks.cc (test04): Explicitly cast int
	values to off_type.
	(test05): Same.
	Changeup output files.
	* testsuite/27_io/istream_unformatted.cc: Change output files.
	* testsuite/27_io/istream_seeks-1.txt: Add.
	* testsuite/27_io/istream_seeks-2.tst: Add.
	* testsuite/27_io/istream_seeks-1.tst: Add.
	* testsuite/27_io/istream_unformatted-2.tst: Delete.
	* testsuite/27_io/istream_unformatted-3.tst: Delete.
	* testsuite/27_io/istream_unformatted-3.txt: Delete.

From-SVN: r40303
parent da1cb092
2001-03-07 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/std_iosfwd.h: Remove string forward decls here.
* include/bits/stringfwd.h: Add forward decls for char_traits
specializations.
* config/c_io_libio.h (wstreamoff): Delete.
* config/c_io_stdio.h (wstreamoff): Same.
* include/bits/char_traits.h: Use streamoff not wstreamoff for
char_traits<wchar_t>::off_type.
Remove duplicate typedefs.
* include/bits/fpos.h: Define streampos/wstreampos here.
* testsuite/27_io/istream_seeks.cc (test04): Explicitly cast int
values to off_type.
(test05): Same.
Changeup output files.
* testsuite/27_io/istream_unformatted.cc: Change output files.
* testsuite/27_io/istream_seeks-1.txt: Add.
* testsuite/27_io/istream_seeks-2.tst: Add.
* testsuite/27_io/istream_seeks-1.tst: Add.
* testsuite/27_io/istream_unformatted-2.tst: Delete.
* testsuite/27_io/istream_unformatted-3.tst: Delete.
* testsuite/27_io/istream_unformatted-3.txt: Delete.
2001-03-07 Alexandre Oliva <aoliva@redhat.com> 2001-03-07 Alexandre Oliva <aoliva@redhat.com>
Add Irix 5.2, 6.3 support. Add Irix 5.2, 6.3 support.
* config/os/irix/bits: Renamed too... * config/os/irix/bits: Renamed to...
* config/os/irix/irix6.5/bits: this. * config/os/irix/irix6.5/bits: this.
* config/os/irix/irix5.2/bits: New, copied from irix6.5/bits. * config/os/irix/irix5.2/bits: New, copied from irix6.5/bits.
* config/os/irix/irix5.2/bits/ctype_base.h: Use _U, _L, _N, * config/os/irix/irix5.2/bits/ctype_base.h: Use _U, _L, _N,
......
...@@ -43,11 +43,9 @@ namespace std ...@@ -43,11 +43,9 @@ namespace std
#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
typedef _IO_off64_t streamoff; typedef _IO_off64_t streamoff;
typedef _IO_fpos64_t __c_streampos; typedef _IO_fpos64_t __c_streampos;
typedef _IO_off64_t wstreamoff;
#else #else
typedef _IO_off_t streamoff; typedef _IO_off_t streamoff;
typedef _IO_fpos_t __c_streampos; typedef _IO_fpos_t __c_streampos;
typedef _IO_off_t wstreamoff;
#endif #endif
#ifdef _GLIBCPP_USE_THREADS #ifdef _GLIBCPP_USE_THREADS
......
...@@ -42,7 +42,6 @@ namespace std ...@@ -42,7 +42,6 @@ namespace std
typedef long streamoff; typedef long streamoff;
typedef ptrdiff_t streamsize; // Signed integral type typedef ptrdiff_t streamsize; // Signed integral type
#if _GLIBCPP_USE_WCHAR_T #if _GLIBCPP_USE_WCHAR_T
typedef long wstreamoff;
typedef ptrdiff_t wstreamsize; typedef ptrdiff_t wstreamsize;
#endif #endif
typedef fpos_t __c_streampos; typedef fpos_t __c_streampos;
...@@ -51,6 +50,7 @@ namespace std ...@@ -51,6 +50,7 @@ namespace std
typedef __mutext_type __c_lock; typedef __mutext_type __c_lock;
#else #else
typedef int __c_lock; typedef int __c_lock;
#endif #endif
// from basic_file.h // from basic_file.h
......
...@@ -36,28 +36,14 @@ ...@@ -36,28 +36,14 @@
#pragma GCC system_header #pragma GCC system_header
#include <bits/std_cwchar.h> // For mbstate_t.
#include <bits/std_cstring.h> // For memmove, memset, memchr #include <bits/std_cstring.h> // For memmove, memset, memchr
#include <bits/fpos.h> // For streamoff, streamsize #include <bits/fpos.h> // For streampos
namespace std {
// Same as iosfwd
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Can't have self-recursive types for streampos.
// 21.1.3.1 char_traits sets size_type to streampos
// 27.4.1
// And here, where streampos is typedefed to fpos<traits::state_type>
typedef fpos<mbstate_t> streampos;
# ifdef _GLIBCPP_USE_WCHAR_T
typedef fpos<mbstate_t> wstreampos;
# endif
#endif
namespace std
{
// 21.1.2 Basis for explicit _Traits specialization // 21.1.2 Basis for explicit _Traits specialization
// NB: That for any given actual character type this definition is // NB: That for any given actual character type this definition is
// probably wrong. // probably wrong.
template<class _CharT> template<class _CharT>
struct char_traits struct char_traits
{ {
...@@ -216,7 +202,7 @@ namespace std { ...@@ -216,7 +202,7 @@ namespace std {
{ {
typedef wchar_t char_type; typedef wchar_t char_type;
typedef wint_t int_type; typedef wint_t int_type;
typedef wstreamoff off_type; typedef streamoff off_type;
typedef wstreampos pos_type; typedef wstreampos pos_type;
typedef mbstate_t state_type; typedef mbstate_t state_type;
...@@ -287,6 +273,4 @@ namespace std { ...@@ -287,6 +273,4 @@ namespace std {
} // namespace std } // namespace std
#endif
#endif /* _CPP_BITS_CHAR_TRAITS_H */
...@@ -36,14 +36,11 @@ ...@@ -36,14 +36,11 @@
#pragma GCC system_header #pragma GCC system_header
// Need this here as well as in std_ios because fpos is used in
// char_traits, and char_traits is used by string, which may or may
// not have included the std_ios file.
#include <bits/c++io.h> #include <bits/c++io.h>
#include <bits/std_cwchar.h> // For mbstate_t.
namespace std namespace std
{ {
// 27.4.1 Types // 27.4.1 Types
// 27.4.3 Template class fpos // 27.4.3 Template class fpos
...@@ -80,11 +77,27 @@ namespace std ...@@ -80,11 +77,27 @@ namespace std
fpos& fpos&
operator-=(streamoff __off) { _M_off -= __off; return *this; } operator-=(streamoff __off) { _M_off -= __off; return *this; }
fpos&
operator+(streamoff __off)
{
fpos t(*this);
return t += __off;
}
fpos&
operator-(streamoff __off)
{
fpos t(*this);
return t -= __off;
}
bool bool
operator==(const fpos& __pos) const { return _M_off == __pos._M_off; } operator==(const fpos& __pos) const
{ return _M_off == __pos._M_off; }
bool bool
operator!=(const fpos& __pos) const { return _M_off != __pos._M_off; } operator!=(const fpos& __pos) const
{ return _M_off != __pos._M_off; }
streamoff streamoff
_M_position() const { return _M_off; } _M_position() const { return _M_off; }
...@@ -93,29 +106,14 @@ namespace std ...@@ -93,29 +106,14 @@ namespace std
_M_position(streamoff __off) { _M_off = __off; } _M_position(streamoff __off) { _M_off = __off; }
}; };
template<typename _State> // 27.2, paragraph 10 about fpos/char_traits circularity
inline fpos<_State> typedef fpos<mbstate_t> streampos;
operator+(const fpos<_State>& __pos, streamoff __off) # ifdef _GLIBCPP_USE_WCHAR_T
{ typedef fpos<mbstate_t> wstreampos;
fpos<_State> t(__pos); # endif
return t += __off;
}
template<typename _State>
inline fpos<_State>
operator-(const fpos<_State>& __pos, streamoff __off)
{
fpos<_State> t(__pos);
return t -= __off;
}
template<typename _State>
inline streamoff
operator-(const fpos<_State>& __pos1, const fpos<_State>& __pos2)
{ return __pos1._M_position() - __pos2._M_position(); }
} // namespace std } // namespace std
#endif /* _CPP_BITS_FPOS_H */ #endif
...@@ -37,18 +37,12 @@ ...@@ -37,18 +37,12 @@
#pragma GCC system_header #pragma GCC system_header
#include <bits/c++config.h> #include <bits/c++config.h>
#include <bits/std_cwchar.h> // For mbstate_t
#include <bits/stringfwd.h> // For string forward declarations. #include <bits/stringfwd.h> // For string forward declarations.
#include <bits/fpos.h>
#include <bits/functexcept.h> #include <bits/functexcept.h>
namespace std namespace std
{ {
// Forward declarations
template<> class char_traits<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class char_traits<wchar_t>;
#endif
template<typename _CharT, typename _Traits = char_traits<_CharT> > template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ios; class basic_ios;
...@@ -103,18 +97,6 @@ namespace std ...@@ -103,18 +97,6 @@ namespace std
class ios_base; class ios_base;
#endif #endif
template<class _State> struct fpos;
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
// Can't have self-recursive types for streampos.
// 21.1.3.1 char_traits sets size_type to streampos
// 27.4.1
// And here, where streampos is typedefed to fpos<traits::state_type>
typedef fpos<mbstate_t> streampos;
# ifdef _GLIBCPP_USE_WCHAR_T
typedef fpos<mbstate_t> wstreampos;
# endif
#endif
typedef basic_ios<char> ios; typedef basic_ios<char> ios;
typedef basic_streambuf<char> streambuf; typedef basic_streambuf<char> streambuf;
typedef basic_istream<char> istream; typedef basic_istream<char> istream;
......
...@@ -42,6 +42,11 @@ namespace std ...@@ -42,6 +42,11 @@ namespace std
{ {
template<class _CharT> template<class _CharT>
struct char_traits; struct char_traits;
template<> class char_traits<char>;
#ifdef _GLIBCPP_USE_WCHAR_T
template<> class char_traits<wchar_t>;
#endif
template<typename _Alloc> template<typename _Alloc>
class allocator; class allocator;
......
// 1999-09-20 bkoz // 1999-09-20 bkoz
// Copyright (C) 1999 Free Software Foundation, Inc. // Copyright (C) 1999, 2001 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
......
bd2
456x
9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
because because
because. .
of the wonderful things he does!!
ok
\ No newline at end of file
bd2
456x
9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
because because
because. .
of the wonderful things he does!!
ok
\ No newline at end of file
...@@ -33,7 +33,7 @@ bool test01() ...@@ -33,7 +33,7 @@ bool test01()
typedef ios::pos_type pos_type; typedef ios::pos_type pos_type;
bool test = true; bool test = true;
const char str_lit01[] = "istream_unformatted-1.tst"; const char str_lit01[] = "istream_seeks-1.tst";
// in // in
// test default ctors leave things in the same positions... // test default ctors leave things in the same positions...
...@@ -65,11 +65,13 @@ bool test01() ...@@ -65,11 +65,13 @@ bool test01()
// fstreams // fstreams
void test04(void) void test04(void)
{ {
typedef std::istream::off_type off_type;
bool test = true; bool test = true;
std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06; std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
std::ios_base::iostate state01, state02; std::ios_base::iostate state01, state02;
const char str_lit01[] = "istream_unformatted-1.txt"; const char str_lit01[] = "istream_seeks-1.txt";
const char str_lit02[] = "istream_unformatted-2.txt"; const char str_lit02[] = "istream_seeks-2.txt";
std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out); std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
std::ifstream if02(str_lit01, std::ios_base::in); std::ifstream if02(str_lit01, std::ios_base::in);
std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc); std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
...@@ -112,7 +114,7 @@ void test04(void) ...@@ -112,7 +114,7 @@ void test04(void)
is01.seekg(10, std::ios_base::cur); is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate(); state02 = is01.rdstate();
pos01 = is01.tellg(); pos01 = is01.tellg();
VERIFY( pos01 == pos02 + 10 ); VERIFY( pos01 == pos02 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos02 = is01.tellg(); pos02 = is01.tellg();
VERIFY( pos02 == pos01 ); VERIFY( pos02 == pos01 );
...@@ -121,7 +123,7 @@ void test04(void) ...@@ -121,7 +123,7 @@ void test04(void)
is02.seekg(10, std::ios_base::cur); is02.seekg(10, std::ios_base::cur);
state02 = is02.rdstate(); state02 = is02.rdstate();
pos03 = is02.tellg(); pos03 = is02.tellg();
VERIFY( pos03 == pos04 + 10 ); VERIFY( pos03 == pos04 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos04 = is02.tellg(); pos04 = is02.tellg();
VERIFY( pos03 == pos04 ); VERIFY( pos03 == pos04 );
...@@ -130,7 +132,7 @@ void test04(void) ...@@ -130,7 +132,7 @@ void test04(void)
is03.seekg(10, std::ios_base::cur); is03.seekg(10, std::ios_base::cur);
state02 = is03.rdstate(); state02 = is03.rdstate();
pos05 = is03.tellg(); pos05 = is03.tellg();
VERIFY( pos05 == pos06 + 10 ); VERIFY( pos05 == pos06 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos06 = is03.tellg(); pos06 = is03.tellg();
VERIFY( pos05 == pos06 ); VERIFY( pos05 == pos06 );
...@@ -140,7 +142,7 @@ void test04(void) ...@@ -140,7 +142,7 @@ void test04(void)
is01.seekg(20, std::ios_base::beg); is01.seekg(20, std::ios_base::beg);
state02 = is01.rdstate(); state02 = is01.rdstate();
pos01 = is01.tellg(); pos01 = is01.tellg();
VERIFY( pos01 == pos02 + 10 ); VERIFY( pos01 == pos02 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos02 = is01.tellg(); pos02 = is01.tellg();
VERIFY( pos02 == pos01 ); VERIFY( pos02 == pos01 );
...@@ -149,7 +151,7 @@ void test04(void) ...@@ -149,7 +151,7 @@ void test04(void)
is02.seekg(20, std::ios_base::beg); is02.seekg(20, std::ios_base::beg);
state02 = is02.rdstate(); state02 = is02.rdstate();
pos03 = is02.tellg(); pos03 = is02.tellg();
VERIFY( pos03 == pos04 + 10 ); VERIFY( pos03 == pos04 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos04 = is02.tellg(); pos04 = is02.tellg();
VERIFY( pos03 == pos04 ); VERIFY( pos03 == pos04 );
...@@ -158,7 +160,7 @@ void test04(void) ...@@ -158,7 +160,7 @@ void test04(void)
is03.seekg(20, std::ios_base::beg); is03.seekg(20, std::ios_base::beg);
state02 = is03.rdstate(); state02 = is03.rdstate();
pos05 = is03.tellg(); pos05 = is03.tellg();
VERIFY( pos05 == pos06 + 10 ); VERIFY( pos05 == pos06 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos06 = is03.tellg(); pos06 = is03.tellg();
VERIFY( pos05 == pos06 ); VERIFY( pos05 == pos06 );
...@@ -171,10 +173,12 @@ void test04(void) ...@@ -171,10 +173,12 @@ void test04(void)
// stringstreams // stringstreams
void test05(void) void test05(void)
{ {
typedef std::istream::off_type off_type;
bool test = true; bool test = true;
std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06; std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
std::ios_base::iostate state01, state02; std::ios_base::iostate state01, state02;
const char str_lit01[] = "istream_unformatted-1.tst"; const char str_lit01[] = "istream_seeks-1.tst";
std::ifstream if01(str_lit01); std::ifstream if01(str_lit01);
std::ifstream if02(str_lit01); std::ifstream if02(str_lit01);
std::ifstream if03(str_lit01); std::ifstream if03(str_lit01);
...@@ -224,7 +228,7 @@ void test05(void) ...@@ -224,7 +228,7 @@ void test05(void)
is01.seekg(10, std::ios_base::cur); is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate(); state02 = is01.rdstate();
pos01 = is01.tellg(); pos01 = is01.tellg();
VERIFY( pos01 == pos02 + 10 ); VERIFY( pos01 == pos02 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos02 = is01.tellg(); pos02 = is01.tellg();
VERIFY( pos02 == pos01 ); VERIFY( pos02 == pos01 );
...@@ -233,7 +237,7 @@ void test05(void) ...@@ -233,7 +237,7 @@ void test05(void)
is02.seekg(10, std::ios_base::cur); is02.seekg(10, std::ios_base::cur);
state02 = is02.rdstate(); state02 = is02.rdstate();
pos03 = is02.tellg(); pos03 = is02.tellg();
VERIFY( pos03 == pos04 + 10 ); VERIFY( pos03 == pos04 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos04 = is02.tellg(); pos04 = is02.tellg();
VERIFY( pos03 == pos04 ); VERIFY( pos03 == pos04 );
...@@ -252,7 +256,7 @@ void test05(void) ...@@ -252,7 +256,7 @@ void test05(void)
is01.seekg(20, std::ios_base::beg); is01.seekg(20, std::ios_base::beg);
state02 = is01.rdstate(); state02 = is01.rdstate();
pos01 = is01.tellg(); pos01 = is01.tellg();
VERIFY( pos01 == pos02 + 10 ); VERIFY( pos01 == pos02 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos02 = is01.tellg(); pos02 = is01.tellg();
VERIFY( pos02 == pos01 ); VERIFY( pos02 == pos01 );
...@@ -261,7 +265,7 @@ void test05(void) ...@@ -261,7 +265,7 @@ void test05(void)
is02.seekg(20, std::ios_base::beg); is02.seekg(20, std::ios_base::beg);
state02 = is02.rdstate(); state02 = is02.rdstate();
pos03 = is02.tellg(); pos03 = is02.tellg();
VERIFY( pos03 == pos04 + 10 ); VERIFY( pos03 == pos04 + off_type(10) );
VERIFY( state01 == state02 ); VERIFY( state01 == state02 );
pos04 = is02.tellg(); pos04 = is02.tellg();
VERIFY( pos03 == pos04 ); VERIFY( pos03 == pos04 );
......
...@@ -461,7 +461,7 @@ int ...@@ -461,7 +461,7 @@ int
test07() test07()
{ {
bool test = true; bool test = true;
const char* tfn = "istream_unformatted-3.txt"; const char* tfn = "istream_unformatted-1.txt";
std::ifstream infile; std::ifstream infile;
infile.open(tfn); infile.open(tfn);
VERIFY( !(!infile) ); VERIFY( !(!infile) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment