mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-26 21:33:59 +08:00
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
This commit is contained in:
parent
da1cb0929e
commit
d32c94be18
@ -1,7 +1,30 @@
|
||||
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>
|
||||
|
||||
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/irix5.2/bits: New, copied from irix6.5/bits.
|
||||
* config/os/irix/irix5.2/bits/ctype_base.h: Use _U, _L, _N,
|
||||
|
@ -43,11 +43,9 @@ namespace std
|
||||
#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
|
||||
typedef _IO_off64_t streamoff;
|
||||
typedef _IO_fpos64_t __c_streampos;
|
||||
typedef _IO_off64_t wstreamoff;
|
||||
#else
|
||||
typedef _IO_off_t streamoff;
|
||||
typedef _IO_fpos_t __c_streampos;
|
||||
typedef _IO_off_t wstreamoff;
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCPP_USE_THREADS
|
||||
|
@ -42,7 +42,6 @@ namespace std
|
||||
typedef long streamoff;
|
||||
typedef ptrdiff_t streamsize; // Signed integral type
|
||||
#if _GLIBCPP_USE_WCHAR_T
|
||||
typedef long wstreamoff;
|
||||
typedef ptrdiff_t wstreamsize;
|
||||
#endif
|
||||
typedef fpos_t __c_streampos;
|
||||
@ -51,6 +50,7 @@ namespace std
|
||||
typedef __mutext_type __c_lock;
|
||||
#else
|
||||
typedef int __c_lock;
|
||||
|
||||
#endif
|
||||
|
||||
// from basic_file.h
|
||||
|
@ -36,28 +36,14 @@
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/std_cwchar.h> // For mbstate_t.
|
||||
#include <bits/std_cstring.h> // For memmove, memset, memchr
|
||||
#include <bits/fpos.h> // For streamoff, streamsize
|
||||
|
||||
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
|
||||
#include <bits/fpos.h> // For streampos
|
||||
|
||||
namespace std
|
||||
{
|
||||
// 21.1.2 Basis for explicit _Traits specialization
|
||||
// NB: That for any given actual character type this definition is
|
||||
// probably wrong.
|
||||
|
||||
template<class _CharT>
|
||||
struct char_traits
|
||||
{
|
||||
@ -216,7 +202,7 @@ namespace std {
|
||||
{
|
||||
typedef wchar_t char_type;
|
||||
typedef wint_t int_type;
|
||||
typedef wstreamoff off_type;
|
||||
typedef streamoff off_type;
|
||||
typedef wstreampos pos_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
@ -287,6 +273,4 @@ namespace std {
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif /* _CPP_BITS_CHAR_TRAITS_H */
|
||||
|
||||
#endif
|
||||
|
@ -36,14 +36,11 @@
|
||||
|
||||
#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/std_cwchar.h> // For mbstate_t.
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
// 27.4.1 Types
|
||||
|
||||
// 27.4.3 Template class fpos
|
||||
@ -80,11 +77,27 @@ namespace std
|
||||
fpos&
|
||||
operator-=(streamoff __off) { _M_off -= __off; return *this; }
|
||||
|
||||
bool
|
||||
operator==(const fpos& __pos) const { return _M_off == __pos._M_off; }
|
||||
fpos&
|
||||
operator+(streamoff __off)
|
||||
{
|
||||
fpos t(*this);
|
||||
return t += __off;
|
||||
}
|
||||
|
||||
fpos&
|
||||
operator-(streamoff __off)
|
||||
{
|
||||
fpos t(*this);
|
||||
return t -= __off;
|
||||
}
|
||||
|
||||
bool
|
||||
operator!=(const fpos& __pos) const { return _M_off != __pos._M_off; }
|
||||
operator==(const fpos& __pos) const
|
||||
{ return _M_off == __pos._M_off; }
|
||||
|
||||
bool
|
||||
operator!=(const fpos& __pos) const
|
||||
{ return _M_off != __pos._M_off; }
|
||||
|
||||
streamoff
|
||||
_M_position() const { return _M_off; }
|
||||
@ -93,29 +106,14 @@ namespace std
|
||||
_M_position(streamoff __off) { _M_off = __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 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(); }
|
||||
|
||||
// 27.2, paragraph 10 about fpos/char_traits circularity
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
# endif
|
||||
} // namespace std
|
||||
|
||||
#endif /* _CPP_BITS_FPOS_H */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -37,18 +37,12 @@
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <bits/std_cwchar.h> // For mbstate_t
|
||||
#include <bits/stringfwd.h> // For string forward declarations.
|
||||
#include <bits/fpos.h>
|
||||
#include <bits/functexcept.h>
|
||||
|
||||
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> >
|
||||
class basic_ios;
|
||||
|
||||
@ -103,18 +97,6 @@ namespace std
|
||||
class ios_base;
|
||||
#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_streambuf<char> streambuf;
|
||||
typedef basic_istream<char> istream;
|
||||
|
@ -42,6 +42,11 @@ namespace std
|
||||
{
|
||||
template<class _CharT>
|
||||
struct char_traits;
|
||||
|
||||
template<> class char_traits<char>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<> class char_traits<wchar_t>;
|
||||
#endif
|
||||
|
||||
template<typename _Alloc>
|
||||
class allocator;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// 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
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
|
7
libstdc++-v3/testsuite/27_io/istream_seeks-1.tst
Normal file
7
libstdc++-v3/testsuite/27_io/istream_seeks-1.tst
Normal file
@ -0,0 +1,7 @@
|
||||
bd2
|
||||
456x
|
||||
9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
|
||||
because because
|
||||
because. .
|
||||
of the wonderful things he does!!
|
||||
ok
|
7
libstdc++-v3/testsuite/27_io/istream_seeks-1.txt
Normal file
7
libstdc++-v3/testsuite/27_io/istream_seeks-1.txt
Normal file
@ -0,0 +1,7 @@
|
||||
bd2
|
||||
456x
|
||||
9mzuv>?@ABCDEFGHIJKLMNOPQRSTUVWXYZracadabras, i wannaz
|
||||
because because
|
||||
because. .
|
||||
of the wonderful things he does!!
|
||||
ok
|
@ -33,7 +33,7 @@ bool test01()
|
||||
typedef ios::pos_type pos_type;
|
||||
|
||||
bool test = true;
|
||||
const char str_lit01[] = "istream_unformatted-1.tst";
|
||||
const char str_lit01[] = "istream_seeks-1.tst";
|
||||
|
||||
// in
|
||||
// test default ctors leave things in the same positions...
|
||||
@ -65,11 +65,13 @@ bool test01()
|
||||
// fstreams
|
||||
void test04(void)
|
||||
{
|
||||
typedef std::istream::off_type off_type;
|
||||
|
||||
bool test = true;
|
||||
std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
|
||||
std::ios_base::iostate state01, state02;
|
||||
const char str_lit01[] = "istream_unformatted-1.txt";
|
||||
const char str_lit02[] = "istream_unformatted-2.txt";
|
||||
const char str_lit01[] = "istream_seeks-1.txt";
|
||||
const char str_lit02[] = "istream_seeks-2.txt";
|
||||
std::ifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
|
||||
std::ifstream if02(str_lit01, std::ios_base::in);
|
||||
std::ifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
|
||||
@ -112,7 +114,7 @@ void test04(void)
|
||||
is01.seekg(10, std::ios_base::cur);
|
||||
state02 = is01.rdstate();
|
||||
pos01 = is01.tellg();
|
||||
VERIFY( pos01 == pos02 + 10 );
|
||||
VERIFY( pos01 == pos02 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos02 = is01.tellg();
|
||||
VERIFY( pos02 == pos01 );
|
||||
@ -121,7 +123,7 @@ void test04(void)
|
||||
is02.seekg(10, std::ios_base::cur);
|
||||
state02 = is02.rdstate();
|
||||
pos03 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 + 10 );
|
||||
VERIFY( pos03 == pos04 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos04 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 );
|
||||
@ -130,7 +132,7 @@ void test04(void)
|
||||
is03.seekg(10, std::ios_base::cur);
|
||||
state02 = is03.rdstate();
|
||||
pos05 = is03.tellg();
|
||||
VERIFY( pos05 == pos06 + 10 );
|
||||
VERIFY( pos05 == pos06 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos06 = is03.tellg();
|
||||
VERIFY( pos05 == pos06 );
|
||||
@ -140,7 +142,7 @@ void test04(void)
|
||||
is01.seekg(20, std::ios_base::beg);
|
||||
state02 = is01.rdstate();
|
||||
pos01 = is01.tellg();
|
||||
VERIFY( pos01 == pos02 + 10 );
|
||||
VERIFY( pos01 == pos02 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos02 = is01.tellg();
|
||||
VERIFY( pos02 == pos01 );
|
||||
@ -149,7 +151,7 @@ void test04(void)
|
||||
is02.seekg(20, std::ios_base::beg);
|
||||
state02 = is02.rdstate();
|
||||
pos03 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 + 10 );
|
||||
VERIFY( pos03 == pos04 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos04 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 );
|
||||
@ -158,7 +160,7 @@ void test04(void)
|
||||
is03.seekg(20, std::ios_base::beg);
|
||||
state02 = is03.rdstate();
|
||||
pos05 = is03.tellg();
|
||||
VERIFY( pos05 == pos06 + 10 );
|
||||
VERIFY( pos05 == pos06 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos06 = is03.tellg();
|
||||
VERIFY( pos05 == pos06 );
|
||||
@ -171,10 +173,12 @@ void test04(void)
|
||||
// stringstreams
|
||||
void test05(void)
|
||||
{
|
||||
typedef std::istream::off_type off_type;
|
||||
|
||||
bool test = true;
|
||||
std::istream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
|
||||
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 if02(str_lit01);
|
||||
std::ifstream if03(str_lit01);
|
||||
@ -224,7 +228,7 @@ void test05(void)
|
||||
is01.seekg(10, std::ios_base::cur);
|
||||
state02 = is01.rdstate();
|
||||
pos01 = is01.tellg();
|
||||
VERIFY( pos01 == pos02 + 10 );
|
||||
VERIFY( pos01 == pos02 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos02 = is01.tellg();
|
||||
VERIFY( pos02 == pos01 );
|
||||
@ -233,7 +237,7 @@ void test05(void)
|
||||
is02.seekg(10, std::ios_base::cur);
|
||||
state02 = is02.rdstate();
|
||||
pos03 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 + 10 );
|
||||
VERIFY( pos03 == pos04 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos04 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 );
|
||||
@ -252,7 +256,7 @@ void test05(void)
|
||||
is01.seekg(20, std::ios_base::beg);
|
||||
state02 = is01.rdstate();
|
||||
pos01 = is01.tellg();
|
||||
VERIFY( pos01 == pos02 + 10 );
|
||||
VERIFY( pos01 == pos02 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos02 = is01.tellg();
|
||||
VERIFY( pos02 == pos01 );
|
||||
@ -261,7 +265,7 @@ void test05(void)
|
||||
is02.seekg(20, std::ios_base::beg);
|
||||
state02 = is02.rdstate();
|
||||
pos03 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 + 10 );
|
||||
VERIFY( pos03 == pos04 + off_type(10) );
|
||||
VERIFY( state01 == state02 );
|
||||
pos04 = is02.tellg();
|
||||
VERIFY( pos03 == pos04 );
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -461,7 +461,7 @@ int
|
||||
test07()
|
||||
{
|
||||
bool test = true;
|
||||
const char* tfn = "istream_unformatted-3.txt";
|
||||
const char* tfn = "istream_unformatted-1.txt";
|
||||
std::ifstream infile;
|
||||
infile.open(tfn);
|
||||
VERIFY( !(!infile) );
|
||||
|
Loading…
Reference in New Issue
Block a user