pool_allocator.cc: Adjust catch blocks.
2009-11-19 Benjamin Kosnik <bkoz@redhat.com> * src/pool_allocator.cc: Adjust catch blocks. * src/bitmap_allocator.cc: Same. * src/localename.cc: Same. * src/ios.cc: Same. * libsupc++/cxxabi-forced.h: Adjust comments, markup. * testsuite/util/testsuite_hooks.h (copy_constructor::copyCount): Remove. (copy_constructor::dtorCount): Remove. * testsuite/23_containers/list/modifiers/1.h: Adjust. * testsuite/23_containers/list/modifiers/2.h: Same. * testsuite/23_containers/list/modifiers/3.h: Same. From-SVN: r154341
This commit is contained in:
parent
fdabb520f2
commit
bf4967a1bd
|
@ -1,3 +1,19 @@
|
|||
2009-11-19 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* src/pool_allocator.cc: Adjust catch blocks.
|
||||
* src/bitmap_allocator.cc: Same.
|
||||
* src/localename.cc: Same.
|
||||
* src/ios.cc: Same.
|
||||
|
||||
* libsupc++/cxxabi-forced.h: Adjust comments, markup.
|
||||
|
||||
* testsuite/util/testsuite_hooks.h (copy_constructor::copyCount):
|
||||
Remove.
|
||||
(copy_constructor::dtorCount): Remove.
|
||||
* testsuite/23_containers/list/modifiers/1.h: Adjust.
|
||||
* testsuite/23_containers/list/modifiers/2.h: Same.
|
||||
* testsuite/23_containers/list/modifiers/3.h: Same.
|
||||
|
||||
2009-11-19 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR libstdc++/41622
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file cxxabi-forced.h
|
||||
* The header provides an interface to the C++ ABI.
|
||||
*/
|
||||
|
||||
#ifndef _CXXABI_FORCED_H
|
||||
#define _CXXABI_FORCED_H 1
|
||||
|
||||
|
@ -41,7 +45,9 @@ namespace __cxxabiv1
|
|||
class __forced_unwind
|
||||
{
|
||||
virtual ~__forced_unwind() throw();
|
||||
virtual void __pure_dummy() = 0; // prevent catch by value
|
||||
|
||||
// Prevent catch by value.
|
||||
virtual void __pure_dummy() = 0;
|
||||
};
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
|
|
@ -76,7 +76,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||
__ret = reinterpret_cast<size_t*>
|
||||
(::operator new(__sz + sizeof(size_t)));
|
||||
}
|
||||
__catch(...)
|
||||
__catch(const std::bad_alloc&)
|
||||
{
|
||||
this->_M_clear();
|
||||
}
|
||||
|
|
|
@ -123,12 +123,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
__newsize = __ix + 1;
|
||||
__try
|
||||
{ __words = new _Words[__newsize]; }
|
||||
__catch(...)
|
||||
__catch(const std::bad_alloc&)
|
||||
{
|
||||
_M_streambuf_state |= badbit;
|
||||
if (_M_streambuf_state & _M_exception)
|
||||
__throw_ios_failure(__N("ios_base::_M_grow_words "
|
||||
"allocation failed"));
|
||||
"allocation failed"));
|
||||
if (__iword)
|
||||
_M_word_zero._M_iword = 0;
|
||||
else
|
||||
|
|
|
@ -163,7 +163,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
|
||||
__try
|
||||
{ _M_impl->_M_replace_categories(__add._M_impl, __cat); }
|
||||
__catch (...)
|
||||
__catch(...)
|
||||
{
|
||||
_M_impl->_M_remove_reference();
|
||||
__throw_exception_again;
|
||||
|
|
|
@ -94,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||
{
|
||||
_S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
|
||||
}
|
||||
__catch (...)
|
||||
__catch(const std::bad_alloc&)
|
||||
{
|
||||
// Try to make do with what we have. That can't hurt. We
|
||||
// do not try smaller requests, since that tends to result
|
||||
|
|
|
@ -30,6 +30,9 @@ modifiers1()
|
|||
typedef _Tp list_type;
|
||||
typedef typename list_type::iterator iterator;
|
||||
typedef typename list_type::value_type value_type;
|
||||
|
||||
using __gnu_test::copy_constructor;
|
||||
using __gnu_test::destructor;
|
||||
|
||||
list_type list0301;
|
||||
value_type::reset();
|
||||
|
@ -37,7 +40,7 @@ modifiers1()
|
|||
// fill insert at beginning of list / empty list
|
||||
list0301.insert(list0301.begin(), 3, value_type(11)); // should be [11 11 11]
|
||||
VERIFY(list0301.size() == 3);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
|
||||
// save iterators to verify post-insert validity
|
||||
iterator b = list0301.begin();
|
||||
|
@ -48,7 +51,7 @@ modifiers1()
|
|||
value_type::reset();
|
||||
list0301.insert(list0301.end(), 3, value_type(13)); // should be [11 11 11 13 13 13]
|
||||
VERIFY(list0301.size() == 6);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
VERIFY(b == list0301.begin() && b->id() == 11);
|
||||
VERIFY(e == list0301.end());
|
||||
VERIFY(m->id() == 11);
|
||||
|
@ -58,7 +61,7 @@ modifiers1()
|
|||
value_type::reset();
|
||||
list0301.insert(m, 3, value_type(12)); // should be [11 11 11 12 12 12 13 13 13]
|
||||
VERIFY(list0301.size() == 9);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
VERIFY(b == list0301.begin() && b->id() == 11);
|
||||
VERIFY(e == list0301.end());
|
||||
VERIFY(m->id() == 13);
|
||||
|
@ -67,7 +70,7 @@ modifiers1()
|
|||
value_type::reset();
|
||||
m = list0301.erase(m); // should be [11 11 11 12 12 12 13 13]
|
||||
VERIFY(list0301.size() == 8);
|
||||
VERIFY(value_type::dtorCount() == 1);
|
||||
VERIFY(destructor::count() == 1);
|
||||
VERIFY(b == list0301.begin() && b->id() == 11);
|
||||
VERIFY(e == list0301.end());
|
||||
VERIFY(m->id() == 13);
|
||||
|
@ -76,7 +79,7 @@ modifiers1()
|
|||
value_type::reset();
|
||||
m = list0301.erase(list0301.begin(), m); // should be [13 13]
|
||||
VERIFY(list0301.size() == 2);
|
||||
VERIFY(value_type::dtorCount() == 6);
|
||||
VERIFY(destructor::count() == 6);
|
||||
VERIFY(m->id() == 13);
|
||||
|
||||
// range fill at beginning
|
||||
|
@ -86,14 +89,14 @@ modifiers1()
|
|||
b = list0301.begin();
|
||||
list0301.insert(b, A, A + N); // should be [321 322 333 13 13]
|
||||
VERIFY(list0301.size() == 5);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
VERIFY(m->id() == 13);
|
||||
|
||||
// range fill at end
|
||||
value_type::reset();
|
||||
list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333]
|
||||
VERIFY(list0301.size() == 8);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
VERIFY(e == list0301.end());
|
||||
VERIFY(m->id() == 13);
|
||||
|
||||
|
@ -101,13 +104,13 @@ modifiers1()
|
|||
value_type::reset();
|
||||
list0301.insert(m, A, A + N);
|
||||
VERIFY(list0301.size() == 11);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
VERIFY(e == list0301.end());
|
||||
VERIFY(m->id() == 13);
|
||||
|
||||
value_type::reset();
|
||||
list0301.clear();
|
||||
VERIFY(list0301.size() == 0);
|
||||
VERIFY(value_type::dtorCount() == 11);
|
||||
VERIFY(destructor::count() == 11);
|
||||
VERIFY(e == list0301.end());
|
||||
}
|
||||
|
|
|
@ -30,16 +30,19 @@ modifiers2()
|
|||
typedef typename list_type::iterator iterator;
|
||||
typedef typename list_type::const_iterator const_iterator;
|
||||
|
||||
using __gnu_test::copy_constructor;
|
||||
using __gnu_test::destructor;
|
||||
|
||||
list_type list0201;
|
||||
value_type::reset();
|
||||
|
||||
list0201.insert(list0201.begin(), value_type(1)); // list should be [1]
|
||||
VERIFY(list0201.size() == 1);
|
||||
VERIFY(value_type::copyCount() == 1);
|
||||
VERIFY(copy_constructor::count() == 1);
|
||||
|
||||
list0201.insert(list0201.end(), value_type(2)); // list should be [1 2]
|
||||
VERIFY(list0201.size() == 2);
|
||||
VERIFY(value_type::copyCount() == 2);
|
||||
VERIFY(copy_constructor::count() == 2);
|
||||
|
||||
iterator i = list0201.begin();
|
||||
const_iterator j = i;
|
||||
|
@ -48,7 +51,7 @@ modifiers2()
|
|||
|
||||
list0201.insert(i, value_type(3)); // list should be [1 3 2]
|
||||
VERIFY(list0201.size() == 3);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
|
||||
const_iterator k = i;
|
||||
VERIFY(i->id() == 2); --i;
|
||||
|
@ -60,27 +63,27 @@ modifiers2()
|
|||
value_type::reset();
|
||||
list0201.erase(i); // should be [1 2]
|
||||
VERIFY(list0201.size() == 2);
|
||||
VERIFY(value_type::dtorCount() == 1);
|
||||
VERIFY(destructor::count() == 1);
|
||||
VERIFY(k->id() == 2);
|
||||
VERIFY(j->id() == 1);
|
||||
|
||||
list_type list0202;
|
||||
value_type::reset();
|
||||
VERIFY(list0202.size() == 0);
|
||||
VERIFY(value_type::copyCount() == 0);
|
||||
VERIFY(value_type::dtorCount() == 0);
|
||||
VERIFY(copy_constructor::count() == 0);
|
||||
VERIFY(destructor::count() == 0);
|
||||
|
||||
// member swap
|
||||
list0202.swap(list0201);
|
||||
VERIFY(list0201.size() == 0);
|
||||
VERIFY(list0202.size() == 2);
|
||||
VERIFY(value_type::copyCount() == 0);
|
||||
VERIFY(value_type::dtorCount() == 0);
|
||||
VERIFY(copy_constructor::count() == 0);
|
||||
VERIFY(destructor::count() == 0);
|
||||
|
||||
// specialized swap
|
||||
swap(list0201, list0202);
|
||||
VERIFY(list0201.size() == 2);
|
||||
VERIFY(list0202.size() == 0);
|
||||
VERIFY(value_type::copyCount() == 0);
|
||||
VERIFY(value_type::dtorCount() == 0);
|
||||
VERIFY(copy_constructor::count() == 0);
|
||||
VERIFY(destructor::count() == 0);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,9 @@ modifiers3()
|
|||
typedef typename list_type::const_iterator const_iterator;
|
||||
typedef typename list_type::const_reverse_iterator const_reverse_iterator;
|
||||
|
||||
using __gnu_test::copy_constructor;
|
||||
using __gnu_test::destructor;
|
||||
|
||||
list_type list0101;
|
||||
const_iterator i;
|
||||
const_reverse_iterator j;
|
||||
|
@ -59,7 +62,7 @@ modifiers3()
|
|||
|
||||
list0101.push_back(value_type(1)); // list should be [1]
|
||||
VERIFY(list0101.size() == 1);
|
||||
VERIFY(value_type::copyCount() == 1);
|
||||
VERIFY(copy_constructor::count() == 1);
|
||||
|
||||
k = list0101.end();
|
||||
--k;
|
||||
|
@ -69,12 +72,12 @@ modifiers3()
|
|||
|
||||
list0101.push_front(value_type(2)); // list should be [2 1]
|
||||
VERIFY(list0101.size() == 2);
|
||||
VERIFY(value_type::copyCount() == 2);
|
||||
VERIFY(copy_constructor::count() == 2);
|
||||
VERIFY(k->id() == 1);
|
||||
|
||||
list0101.push_back(value_type(3)); // list should be [2 1 3]
|
||||
VERIFY(list0101.size() == 3);
|
||||
VERIFY(value_type::copyCount() == 3);
|
||||
VERIFY(copy_constructor::count() == 3);
|
||||
VERIFY(k->id() == 1);
|
||||
|
||||
try
|
||||
|
@ -85,7 +88,7 @@ modifiers3()
|
|||
catch (...)
|
||||
{
|
||||
VERIFY(list0101.size() == 3);
|
||||
VERIFY(value_type::copyCount() == 4);
|
||||
VERIFY(copy_constructor::count() == 4);
|
||||
}
|
||||
|
||||
i = list0101.begin();
|
||||
|
@ -106,13 +109,13 @@ modifiers3()
|
|||
|
||||
list0101.pop_back(); // list should be [2 1]
|
||||
VERIFY(list0101.size() == 2);
|
||||
VERIFY(value_type::dtorCount() == 1);
|
||||
VERIFY(destructor::count() == 1);
|
||||
VERIFY(i->id() == 1);
|
||||
VERIFY(k->id() == 1);
|
||||
|
||||
list0101.pop_front(); // list should be [1]
|
||||
VERIFY(list0101.size() == 1);
|
||||
VERIFY(value_type::dtorCount() == 2);
|
||||
VERIFY(destructor::count() == 2);
|
||||
VERIFY(i->id() == 1);
|
||||
VERIFY(k->id() == 1);
|
||||
}
|
||||
|
|
|
@ -270,11 +270,6 @@ namespace __gnu_test
|
|||
int
|
||||
id() const { return id_; }
|
||||
|
||||
private:
|
||||
int id_;
|
||||
const bool throw_on_copy_;
|
||||
|
||||
public:
|
||||
static void
|
||||
reset()
|
||||
{
|
||||
|
@ -283,17 +278,9 @@ namespace __gnu_test
|
|||
destructor::reset();
|
||||
}
|
||||
|
||||
// for backwards-compatibility
|
||||
static int
|
||||
copyCount()
|
||||
{ return copy_constructor::count(); }
|
||||
|
||||
// for backwards-compatibility
|
||||
static int
|
||||
dtorCount()
|
||||
{ return destructor::count(); }
|
||||
|
||||
private:
|
||||
int id_;
|
||||
const bool throw_on_copy_;
|
||||
static int next_id_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue