diff options
author | Jan Hubicka <jh@suse.cz> | 2009-03-28 12:19:41 +0000 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2009-03-28 12:19:41 +0000 |
commit | 354acacdf32316b4842531d3c8d69aca589882eb (patch) | |
tree | edf335d9602e628201446fcec4e092f30256c29e /libstdc++-v3 | |
parent | fa37bab47b5f487d2fb3121a2856f7d89b6e9e1b (diff) |
Merge from mainline.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/pretty-ipa@145180 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
24 files changed, 651 insertions, 160 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d029913f59e..0c51edb7aaf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,79 @@ +2009-03-27 Ian Lance Taylor <iant@google.com> + + * include/backward/hashtable.h (_S_num_primes): Change to 29. + (__stl_prime_list): Add 5 at the start of the list. + +2009-03-25 Edward Smith-Rowland <3dw4rd@verizon.net> + + * include/std/fstream (basic_filebuf<>::open(const std::string&, + ios_base::openmode), basic_ifstream<>::basic_ifstream(const + std::string&, ios_base::openmode), basic_ifstream<>:: + open(const std::string&, ios_base::openmode), basic_ofstream<>:: + basic_ofstream(const std::string&, ios_base::openmode), + basic_ofstream<>::open(const std::string&, ios_base::openmode), + basic_fstream<>::basic_fstream(const std::string&, ios_base::openmode), + basic_fstream<>::open(const std::string&, ios_base::openmode)): + Add in C++0x mode. + * testsuite/27_io/basic_ofstream/open/char/2.cc: New. + * testsuite/27_io/basic_ofstream/cons/char/2.cc: Likewise. + * testsuite/27_io/basic_fstream/open/char/1.cc: Likewise. + * testsuite/27_io/basic_fstream/cons/char/1.cc: Likewise. + * testsuite/27_io/basic_ifstream/open/char/2.cc: Likewise. + * testsuite/27_io/basic_ifstream/cons/char/2.cc: Likewise. + * testsuite/27_io/basic_filebuf/open/char/5.cc: Likewise. + +2009-03-25 Paolo Carlini <paolo.carlini@oracle.com> + + * testsuite/27_io/basic_ofstream/cons/char/2.cc: Rename to... + * testsuite/27_io/basic_ofstream/cons/char/1.cc: ... this. + * testsuite/27_io/basic_fstream/cons/3.cc: Rename to... + * testsuite/27_io/basic_fstream/cons/1.cc: ... this. + +2009-03-25 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/forward_list.h (_Fwd_list_node_base<>:: + _M_transfer_after, _M_reverse_after): Move out of line... + * include/bits/forward_list.tcc: ... here. + (forward_list<>::reverse): Move inline... + * include/bits/forward_list.h: ... here; minor cosmetic changes. + +2009-03-22 Mark Mitchell <mark@codesourcery.com> + + * testsuite/21_strings/basic_string/inserters_extractors/wchar_t/ + 28277.cc: Likewise. + * testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc: + Likewise. + * testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc: + Likewise. + * testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc: + Likewise. + +2009-03-22 Mark Mitchell <mark@codesourcery.com> + + * testsuite/25_algorithms/search_n/iterator.cc: Update copyright + year(s). + * testsuite/25_algorithms/heap/moveable.cc: Likewise. + * testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc + Likewise. + * testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc: + Likewise. + * testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc: + Likewise. + * testsuite/ext/vstring/inserters_extractors/char/28277.cc: Likewise. + +2009-03-22 Mark Mitchell <mark@codesourcery.com> + + * testsuite/25_algorithms/search_n/iterator.cc: Condition + iterations for simulators. + * testsuite/25_algorithms/heap/moveable.cc: Likewise. + * testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc + Condition stream width for simulators. + * testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc: + Likewise. + * testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc: + Likewise. + * testsuite/ext/vstring/inserters_extractors/char/28277.cc: Likewise. + 2009-03-17 Benjamin Kosnik <bkoz@redhat.com> * doc/xml/manual/appendix_contributing.xml: Add docbook style diff --git a/libstdc++-v3/include/backward/hashtable.h b/libstdc++-v3/include/backward/hashtable.h index 62bc5bc5193..c0981ee8565 100644 --- a/libstdc++-v3/include/backward/hashtable.h +++ b/libstdc++-v3/include/backward/hashtable.h @@ -210,16 +210,16 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) }; // Note: assumes long is at least 32 bits. - enum { _S_num_primes = 28 }; + enum { _S_num_primes = 29 }; static const unsigned long __stl_prime_list[_S_num_primes] = { - 53ul, 97ul, 193ul, 389ul, 769ul, - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, - 1610612741ul, 3221225473ul, 4294967291ul + 5ul, 53ul, 97ul, 193ul, 389ul, + 769ul, 1543ul, 3079ul, 6151ul, 12289ul, + 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, + 786433ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul, + 25165843ul, 50331653ul, 100663319ul, 201326611ul, 402653189ul, + 805306457ul, 1610612741ul, 3221225473ul, 4294967291ul }; inline unsigned long diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 55029c9647a..0a4bf3a6a95 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -62,52 +62,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ::other::pointer _Pointer; typedef typename _Alloc::template rebind<_Fwd_list_node_base<_Alloc> > ::other::const_pointer _Const_pointer; - + _Pointer _M_next; - + _Fwd_list_node_base() : _M_next(0) { } - + static void swap(_Fwd_list_node_base& __x, _Fwd_list_node_base& __y) { std::swap(__x._M_next, __y._M_next); } - + void - _M_transfer_after(_Pointer __bbegin, _Pointer __bend) - { - _Pointer __keep = __bbegin->_M_next; - if (__bend) - { - __bbegin->_M_next = __bend->_M_next; - __bend->_M_next = this->_M_next; - } - else - __bbegin->_M_next = 0; - this->_M_next = __keep; - } - + _M_transfer_after(_Pointer __bbegin); + void - _M_transfer_after(_Pointer __bbegin) - { - _Pointer __bend = __bbegin; - while (__bend && __bend->_M_next) - __bend = __bend->_M_next; - _M_transfer_after(__bbegin, __bend); - } - + _M_transfer_after(_Pointer __bbegin, _Pointer __bend); + void - _M_reverse_after() - { - _Pointer __tail = this->_M_next; - if (!__tail) - return; - while (_Pointer __temp = __tail->_M_next) - { - _Pointer __keep = this->_M_next; - this->_M_next = __temp; - __tail->_M_next = __temp->_M_next; - this->_M_next->_M_next = __keep; - } - } + _M_reverse_after(); }; /** @@ -159,16 +130,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std) reference operator*() const - { return __static_pointer_cast<_Node*>(this->_M_node)->_M_value; } + { return __static_pointer_cast<_Node*>(_M_node)->_M_value; } pointer operator->() const - { return &__static_pointer_cast<_Node*>(this->_M_node)->_M_value; } + { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; } _Self& operator++() { - this->_M_node = this->_M_node->_M_next; + _M_node = _M_node->_M_next; return *this; } @@ -176,23 +147,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) operator++(int) { _Self __tmp(*this); - this->_M_node = this->_M_node->_M_next; + _M_node = _M_node->_M_next; return __tmp; } bool operator==(const _Self& __x) const - { return this->_M_node == __x._M_node; } + { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const - { return this->_M_node != __x._M_node; } + { return _M_node != __x._M_node; } _Self _M_next() const { if (_M_node) - return _Fwd_list_iterator(this->_M_node->_M_next); + return _Fwd_list_iterator(_M_node->_M_next); else return _Fwd_list_iterator(0); } @@ -230,16 +201,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std) reference operator*() const - { return __static_pointer_cast<_Node*>(this->_M_node)->_M_value; } + { return __static_pointer_cast<_Node*>(_M_node)->_M_value; } pointer operator->() const - { return &__static_pointer_cast<_Node*>(this->_M_node)->_M_value; } + { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; } _Self& operator++() { - this->_M_node = this->_M_node->_M_next; + _M_node = _M_node->_M_next; return *this; } @@ -247,23 +218,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) operator++(int) { _Self __tmp(*this); - this->_M_node = this->_M_node->_M_next; + _M_node = _M_node->_M_next; return __tmp; } bool operator==(const _Self& __x) const - { return this->_M_node == __x._M_node; } + { return _M_node == __x._M_node; } bool operator!=(const _Self& __x) const - { return this->_M_node != __x._M_node; } + { return _M_node != __x._M_node; } _Self _M_next() const { if (this->_M_node) - return _Fwd_list_const_iterator(this->_M_node->_M_next); + return _Fwd_list_const_iterator(_M_node->_M_next); else return _Fwd_list_const_iterator(0); } @@ -777,7 +748,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) reference front() { - _Node* __front = __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next); + _Node* __front = + __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next); return __front->_M_value; } @@ -1229,7 +1201,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Reverse the order of elements in the list in linear time. */ void - reverse(); + reverse() + { this->_M_impl._M_head._M_reverse_after(); } private: template<typename _Integer> @@ -1328,7 +1301,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<typename _Tp, typename _Alloc> inline void swap(forward_list<_Tp, _Alloc>& __lx, - forward_list<_Tp, _Alloc>&& __ly) + forward_list<_Tp, _Alloc>&& __ly) { __lx.swap(__ly); } _GLIBCXX_END_NAMESPACE // namespace std diff --git a/libstdc++-v3/include/bits/forward_list.tcc b/libstdc++-v3/include/bits/forward_list.tcc index bfc814df4a3..35fb9b30afc 100644 --- a/libstdc++-v3/include/bits/forward_list.tcc +++ b/libstdc++-v3/include/bits/forward_list.tcc @@ -1,6 +1,6 @@ // <forward_list.tcc> -*- C++ -*- -// Copyright (C) 2008 Free Software Foundation, Inc. +// Copyright (C) 2008, 2009 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 @@ -36,6 +36,50 @@ _GLIBCXX_BEGIN_NAMESPACE(std) + template<typename _Alloc> + void + _Fwd_list_node_base<_Alloc>:: + _M_transfer_after(_Pointer __bbegin) + { + _Pointer __bend = __bbegin; + while (__bend && __bend->_M_next) + __bend = __bend->_M_next; + _M_transfer_after(__bbegin, __bend); + } + + template<typename _Alloc> + void + _Fwd_list_node_base<_Alloc>:: + _M_transfer_after(_Pointer __bbegin, _Pointer __bend) + { + _Pointer __keep = __bbegin->_M_next; + if (__bend) + { + __bbegin->_M_next = __bend->_M_next; + __bend->_M_next = _M_next; + } + else + __bbegin->_M_next = 0; + _M_next = __keep; + } + + template<typename _Alloc> + void + _Fwd_list_node_base<_Alloc>:: + _M_reverse_after() + { + _Pointer __tail = _M_next; + if (!__tail) + return; + while (_Pointer __temp = __tail->_M_next) + { + _Pointer __keep = _M_next; + _M_next = __temp; + __tail->_M_next = __temp->_M_next; + _M_next->_M_next = __keep; + } + } + /** * @brief Sort the singly linked list starting after this node. * This node is assumed to be an empty head node (of type @@ -412,12 +456,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } template<typename _Tp, typename _Alloc> - void - forward_list<_Tp, _Alloc>:: - reverse() - { this->_M_impl._M_head._M_reverse_after(); } - - template<typename _Tp, typename _Alloc> bool operator==(const forward_list<_Tp, _Alloc>& __lx, const forward_list<_Tp, _Alloc>& __ly) diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream index 097d5769fa2..11bc743db3c 100644 --- a/libstdc++-v3/include/std/fstream +++ b/libstdc++-v3/include/std/fstream @@ -45,8 +45,11 @@ #include <istream> #include <ostream> #include <bits/codecvt.h> -#include <cstdio> // For BUFSIZ +#include <cstdio> // For BUFSIZ #include <bits/basic_file.h> // For __basic_file, __c_lock +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#include <string> // For std::string overloads. +#endif _GLIBCXX_BEGIN_NAMESPACE(std) @@ -59,7 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * external disk file, and maintains a joint file position for both * sequences. Many of its semantics are described in terms of similar * behavior in the Standard C Library's @c FILE streams. - */ + */ // Requirements on traits_type, specific to this class: // traits_type::pos_type must be fpos<traits_type::state_type> // traits_type::off_type must be streamoff @@ -114,19 +117,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Actual size of internal buffer. This number is equal to the size * of the put area + 1 position, reserved for the overflow char of * a full area. - */ + */ size_t _M_buf_size; // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer. bool _M_buf_allocated; /** - * _M_reading == false && _M_writing == false for 'uncommitted' mode; + * _M_reading == false && _M_writing == false for 'uncommitted' mode; * _M_reading == true for 'read' mode; * _M_writing == true for 'write' mode; * * NB: _M_reading == true && _M_writing == true is unused. - */ + */ bool _M_reading; bool _M_writing; @@ -135,11 +138,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Necessary bits for putback buffer management. * * @note pbacks of over one character are not currently supported. - */ - char_type _M_pback; + */ + char_type _M_pback; char_type* _M_pback_cur_save; char_type* _M_pback_end_save; - bool _M_pback_init; + bool _M_pback_init; //@} // Cached codecvt facet. @@ -149,19 +152,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Buffer for external characters. Used for input when * codecvt::always_noconv() == false. When valid, this corresponds * to eback(). - */ + */ char* _M_ext_buf; /** * Size of buffer held by _M_ext_buf. - */ + */ streamsize _M_ext_buf_size; /** * Pointers into the buffer held by _M_ext_buf that delimit a * subsequence of bytes that have been read but not yet converted. * When valid, _M_ext_next corresponds to egptr(). - */ + */ const char* _M_ext_next; char* _M_ext_end; @@ -169,7 +172,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Initializes pback buffers, and moves normal buffers to safety. * Assumptions: * _M_in_cur has already been moved back - */ + */ void _M_create_pback() { @@ -186,7 +189,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Deactivates pback buffer contents, and restores normal buffer. * Assumptions: * The pback buffer has only moved forward. - */ + */ void _M_destroy_pback() throw() { @@ -206,12 +209,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * The default constructor initializes the parent class using its * own default ctor. - */ + */ basic_filebuf(); /** * @brief The destructor closes the file first. - */ + */ virtual ~basic_filebuf() { this->close(); } @@ -219,7 +222,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Members: /** * @brief Returns true if the external file is open. - */ + */ bool is_open() const throw() { return _M_file.is_open(); } @@ -266,6 +269,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __filebuf_type* open(const char* __s, ios_base::openmode __mode); +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * @return @c this on success, NULL on failure + */ + __filebuf_type* + open(const std::string& __s, ios_base::openmode __mode) + { return open(__s.c_str(), __mode); } +#endif + /** * @brief Closes the currently associated file. * @return @c this on success, NULL on failure @@ -276,7 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * all the characters. The file is then closed. * * If any operations fail, this function also fails. - */ + */ __filebuf_type* close(); @@ -328,7 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * buffer; see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html * for more. - */ + */ virtual __streambuf_type* setbuf(char_type* __s, streamsize __n); @@ -367,11 +382,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * __off == egptr() - eback() upon underflow/uflow ('read' mode); * __off == 0 upon overflow ('write' mode); * __off == -1 upon open, setbuf, seekoff/pos ('uncommitted' mode). - * + * * NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size * reflects the actual allocated memory and the last cell is reserved * for the overflow char of a full put area. - */ + */ void _M_set_buffer(streamsize __off) { @@ -399,7 +414,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * functions from std::basic_istream. To control the associated * sequence, an instance of std::basic_filebuf is used, which this page * refers to as @c sb. - */ + */ template<typename _CharT, typename _Traits> class basic_ifstream : public basic_istream<_CharT, _Traits> { @@ -426,7 +441,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). - */ + */ basic_ifstream() : __istream_type(), _M_filebuf() { this->init(&_M_filebuf); } @@ -439,7 +454,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. - */ + */ explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) : __istream_type(), _M_filebuf() @@ -448,12 +463,30 @@ _GLIBCXX_BEGIN_NAMESPACE(std) this->open(__s, __mode); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Create an input file stream. + * @param s std::string specifying the filename. + * @param mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::in is automatically included in @a mode. + */ + explicit + basic_ifstream(const std::string& __s, + ios_base::openmode __mode = ios_base::in) + : __istream_type(), _M_filebuf() + { + this->init(&_M_filebuf); + this->open(__s, __mode); + } +#endif + /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. - */ + */ ~basic_ifstream() { } @@ -463,7 +496,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @return The current basic_filebuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). - */ + */ __filebuf_type* rdbuf() const { return const_cast<__filebuf_type*>(&_M_filebuf); } @@ -471,7 +504,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() - */ + */ bool is_open() { return _M_filebuf.is_open(); } @@ -492,7 +525,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. - */ + */ void open(const char* __s, ios_base::openmode __mode = ios_base::in) { @@ -504,12 +537,33 @@ _GLIBCXX_BEGIN_NAMESPACE(std) this->clear(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * + * Calls @c std::basic_filebuf::open(s,mode|in). If that function + * fails, @c failbit is set in the stream's error state. + */ + void + open(const std::string& __s, ios_base::openmode __mode = ios_base::in) + { + if (!_M_filebuf.open(__s, __mode | ios_base::in)) + this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); + } +#endif + /** * @brief Close the file. * * Calls @c std::basic_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void close() { @@ -528,7 +582,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * functions from std::basic_ostream. To control the associated * sequence, an instance of std::basic_filebuf is used, which this page * refers to as @c sb. - */ + */ template<typename _CharT, typename _Traits> class basic_ofstream : public basic_ostream<_CharT,_Traits> { @@ -555,7 +609,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). - */ + */ basic_ofstream(): __ostream_type(), _M_filebuf() { this->init(&_M_filebuf); } @@ -569,7 +623,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. - */ + */ explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out|ios_base::trunc) @@ -579,12 +633,31 @@ _GLIBCXX_BEGIN_NAMESPACE(std) this->open(__s, __mode); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Create an output file stream. + * @param s std::string specifying the filename. + * @param mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::out|ios_base::trunc is automatically included in + * @a mode. + */ + explicit + basic_ofstream(const std::string& __s, + ios_base::openmode __mode = ios_base::out|ios_base::trunc) + : __ostream_type(), _M_filebuf() + { + this->init(&_M_filebuf); + this->open(__s, __mode); + } +#endif + /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. - */ + */ ~basic_ofstream() { } @@ -594,7 +667,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @return The current basic_filebuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). - */ + */ __filebuf_type* rdbuf() const { return const_cast<__filebuf_type*>(&_M_filebuf); } @@ -602,7 +675,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() - */ + */ bool is_open() { return _M_filebuf.is_open(); } @@ -623,7 +696,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. - */ + */ void open(const char* __s, ios_base::openmode __mode = ios_base::out | ios_base::trunc) @@ -636,12 +709,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) this->clear(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * + * Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that + * function fails, @c failbit is set in the stream's error state. + */ + void + open(const std::string& __s, + ios_base::openmode __mode = ios_base::out | ios_base::trunc) + { + if (!_M_filebuf.open(__s, __mode | ios_base::out)) + this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); + } +#endif + /** * @brief Close the file. * * Calls @c std::basic_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void close() { @@ -660,7 +755,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * the inherited functions from std::basic_iostream. To control the * associated sequence, an instance of std::basic_filebuf is used, which * this page refers to as @c sb. - */ + */ template<typename _CharT, typename _Traits> class basic_fstream : public basic_iostream<_CharT, _Traits> { @@ -688,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). - */ + */ basic_fstream() : __iostream_type(), _M_filebuf() { this->init(&_M_filebuf); } @@ -700,7 +795,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. - */ + */ explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out) @@ -710,12 +805,28 @@ _GLIBCXX_BEGIN_NAMESPACE(std) this->open(__s, __mode); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Create an input/output file stream. + * @param s Null terminated string specifying the filename. + * @param mode Open file in specified mode (see std::ios_base). + */ + explicit + basic_fstream(const std::string& __s, + ios_base::openmode __mode = ios_base::in | ios_base::out) + : __iostream_type(NULL), _M_filebuf() + { + this->init(&_M_filebuf); + this->open(__s, __mode); + } +#endif + /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. - */ + */ ~basic_fstream() { } @@ -725,7 +836,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @return The current basic_filebuf buffer. * * This hides both signatures of std::basic_ios::rdbuf(). - */ + */ __filebuf_type* rdbuf() const { return const_cast<__filebuf_type*>(&_M_filebuf); } @@ -733,7 +844,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() - */ + */ bool is_open() { return _M_filebuf.is_open(); } @@ -754,7 +865,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Tip: When using std::string to hold the filename, you must use * .c_str() before passing it to this constructor. - */ + */ void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out) @@ -767,12 +878,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) this->clear(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * + * Calls @c std::basic_filebuf::open(s,mode). If that + * function fails, @c failbit is set in the stream's error state. + */ + void + open(const std::string& __s, + ios_base::openmode __mode = ios_base::in | ios_base::out) + { + if (!_M_filebuf.open(__s, __mode)) + this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); + } +#endif + /** * @brief Close the file. * * Calls @c std::basic_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void close() { diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc index 5f60c2ff627..c6def9b42d7 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006, 2007 Free Software Foundation +// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,12 +18,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=200000" { target simulator } } + // 21.3.7.9 inserters and extractors #include <ostream> #include <sstream> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 20000000 +#endif + // libstdc++/28277 void test01() { @@ -33,7 +39,7 @@ void test01() ostringstream oss_01; const string str_01(50, 'a'); - oss_01.width(20000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << str_01; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc index 653f4de36db..35cae2e27d2 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006, 2007 Free Software Foundation +// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,12 +18,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=500000" { target simulator } } + // 21.3.7.9 inserters and extractors #include <ostream> #include <sstream> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 50000000 +#endif + // libstdc++/28277 void test01() { @@ -33,7 +39,7 @@ void test01() wostringstream oss_01; const wstring str_01(50, L'a'); - oss_01.width(5000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << str_01; diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc index ee04793e66e..b2c3cb566b6 100644 --- a/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc +++ b/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2005, 2007 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008, 2009 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 @@ -18,6 +18,8 @@ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, // USA. +// { dg-options "-std=gnu++0x -DITERATIONS=5" { target simulator } } + // 25.3.6 Heap operations [lib.alg.heap.operations] #undef _GLIBCXX_CONCEPT_CHECKS @@ -28,6 +30,10 @@ #include <testsuite_iterators.h> #include <testsuite_rvalref.h> +#ifndef ITERATIONS +#define ITERATIONS 9 +#endif + using __gnu_test::test_container; using __gnu_test::random_access_iterator_wrapper; using __gnu_test::rvalstruct; @@ -115,7 +121,7 @@ void test01() { int array[9]; - for (int i = 1; i < 9; ++i) + for (int i = 1; i < ITERATIONS; ++i) { for(int z = 0; z < i; ++z) array[z] = z; diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc index 2a9b0f42a09..f03daacd494 100644 --- a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc +++ b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// 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 @@ -16,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DTEST_DEPTH=10" { target simulator } } + // 25 algorithms, search_n #include <algorithm> @@ -23,7 +26,10 @@ #include <testsuite_hooks.h> #include <testsuite_iterators.h> +#ifndef TEST_DEPTH #define TEST_DEPTH 14 +#endif + int array1[11] = {0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0}; int array2[TEST_DEPTH]; diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/5.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/5.cc new file mode 100644 index 00000000000..dddd2f16ff6 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/5.cc @@ -0,0 +1,31 @@ +// Copyright (C) 2009 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <fstream> + +// Test member functions. +void test01() +{ + std::filebuf fb; + + const std::string name = "filebuf_name.txt"; + fb.open(name, std::ios_base::in | std::ios_base::ate); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/3.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/1.cc index 4b01bd10ef4..4b01bd10ef4 100644 --- a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/1.cc diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/1.cc new file mode 100644 index 00000000000..5b0047aa19d --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/1.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2009 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <fstream> + +void test01() +{ + const std::string name = "fstream_name.txt"; + std::fstream fs(name); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/open/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/open/char/1.cc new file mode 100644 index 00000000000..9277339e980 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_fstream/open/char/1.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2009 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <fstream> + +void test01() +{ + std::fstream fs; + + const std::string name = "fstream_name.txt"; + fs.open(name); + + fs.close(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/2.cc new file mode 100644 index 00000000000..44d3b9d0d79 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/2.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2009 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <fstream> + +void test01() +{ + const std::string name = "ifstream_name.txt"; + std::ifstream ifs(name); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/2.cc new file mode 100644 index 00000000000..21b34fb907c --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/open/char/2.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2009 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <fstream> + +void test01() +{ + std::ifstream ifs; + + const std::string name = "ifstream_name.txt"; + ifs.open(name); + + ifs.close(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/1.cc new file mode 100644 index 00000000000..106639c16de --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/1.cc @@ -0,0 +1,51 @@ +// Copyright (C) 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 27.8.1.10 ofstream member functions +// @require@ %-*.tst +// @diff@ %-*.tst %-*.txt + +// { dg-require-fileio "" } + +#include <ostream> +#include <fstream> +#include <testsuite_hooks.h> + +const char name_02[] = "ofstream_members-1.txt"; + +// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00004.html +void test02() +{ + bool test __attribute__((unused)) = true; + const int more_than_max_open_files = 8200; + + for(int i = 0; ++i < more_than_max_open_files;) + { + std::ofstream ifs(name_02); + VERIFY( static_cast<bool>(ifs) ); + } +} + +int main() +{ + test02(); + return 0; +} + + + diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc index 106639c16de..dc47541eb03 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/cons/char/2.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. +// Copyright (C) 2009 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 @@ -16,36 +16,13 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// 27.8.1.10 ofstream member functions -// @require@ %-*.tst -// @diff@ %-*.tst %-*.txt +// { dg-do compile } +// { dg-options "-std=gnu++0x" } -// { dg-require-fileio "" } - -#include <ostream> #include <fstream> -#include <testsuite_hooks.h> - -const char name_02[] = "ofstream_members-1.txt"; - -// http://gcc.gnu.org/ml/libstdc++/2000-07/msg00004.html -void test02() -{ - bool test __attribute__((unused)) = true; - const int more_than_max_open_files = 8200; - - for(int i = 0; ++i < more_than_max_open_files;) - { - std::ofstream ifs(name_02); - VERIFY( static_cast<bool>(ifs) ); - } -} -int main() +void test01() { - test02(); - return 0; + const std::string name = "ofstream_name.txt"; + std::ofstream ofs(name); } - - - diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/2.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/2.cc new file mode 100644 index 00000000000..f457c96ff5f --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/2.cc @@ -0,0 +1,32 @@ +// Copyright (C) 2009 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +#include <fstream> + +void test01() +{ + std::ofstream ofs; + + const std::string name = "ofstream_name.txt"; + ofs.open(name); + + ofs.close(); +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc index 9c68320bf17..caa851cf9d2 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006, 2006 Free Software Foundation +// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,12 +18,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=200000" { target simulator } } + // 27.6.2.5.4 basic_ostream character inserters #include <ostream> #include <sstream> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 20000000 +#endif + // libstdc++/28277 void test01() { @@ -32,7 +38,7 @@ void test01() ostringstream oss_01; - oss_01.width(20000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << 'a'; diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc index 3ef1f8c4362..381ac6930bd 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006, 2007 Free Software Foundation +// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,12 +18,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=200000" { target simulator } } + // 27.6.2.5.4 basic_ostream character inserters #include <ostream> #include <sstream> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 20000000 +#endif + // libstdc++/28277 void test01() { @@ -33,7 +39,7 @@ void test01() ostringstream oss_01; const string str_01(50, 'a'); - oss_01.width(20000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << str_01.c_str(); diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc index dc5ffe5dff2..54cdf33f96a 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc @@ -18,12 +18,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=500000" { target simulator } } + // 27.6.2.5.4 basic_ostream character inserters #include <ostream> #include <sstream> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 50000000 +#endif + // libstdc++/28277 void test01() { @@ -32,7 +38,7 @@ void test01() wostringstream oss_01; - oss_01.width(5000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << L'a'; diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc index e80242cf0a7..aff7d9c0b97 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006, 2007 Free Software Foundation +// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,12 +18,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=500000" { target simulator } } + // 27.6.2.5.4 basic_ostream character inserters #include <ostream> #include <sstream> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 50000000 +#endif + // libstdc++/28277 void test01() { @@ -33,7 +39,7 @@ void test01() wostringstream oss_01; const wstring str_01(50, L'a'); - oss_01.width(5000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << str_01.c_str(); diff --git a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc index eb506b0c81d..5b096b753c4 100644 --- a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc +++ b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc @@ -1,6 +1,6 @@ // 2007-04-09 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,11 +18,17 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=200000" { target simulator } } + #include <ostream> #include <sstream> #include <ext/vstring.h> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 20000000 +#endif + // libstdc++/28277 void test01() { @@ -32,7 +38,7 @@ void test01() ostringstream oss_01; const __gnu_cxx::__vstring str_01(50, 'a'); - oss_01.width(20000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << str_01; diff --git a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc index 205a99525f6..6358de586b6 100644 --- a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc +++ b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc @@ -1,6 +1,6 @@ // 2007-04-09 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008, 2009 Free Software Foundation // // 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 @@ -18,11 +18,17 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-options "-DWIDTH=500000" { target simulator } } + #include <ostream> #include <sstream> #include <ext/vstring.h> #include <testsuite_hooks.h> +#ifndef WIDTH +#define WIDTH 50000000 +#endif + // libstdc++/28277 void test01() { @@ -32,7 +38,7 @@ void test01() wostringstream oss_01; const __gnu_cxx::__wvstring str_01(50, L'a'); - oss_01.width(5000000); + oss_01.width(WIDTH); const streamsize width = oss_01.width(); oss_01 << str_01; |