From b44d17e80b59696fa993616736ea9b84efa91fa7 Mon Sep 17 00:00:00 2001 From: bkoz Date: Thu, 19 Nov 2009 19:21:05 +0000 Subject: [PATCH] 2009-11-19 Benjamin Kosnik * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154341 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 16 +++++++++++++++ libstdc++-v3/libsupc++/cxxabi-forced.h | 8 +++++++- libstdc++-v3/src/bitmap_allocator.cc | 2 +- libstdc++-v3/src/ios.cc | 4 ++-- libstdc++-v3/src/localename.cc | 2 +- libstdc++-v3/src/pool_allocator.cc | 2 +- .../testsuite/23_containers/list/modifiers/1.h | 21 +++++++++++--------- .../testsuite/23_containers/list/modifiers/2.h | 23 ++++++++++++---------- .../testsuite/23_containers/list/modifiers/3.h | 15 ++++++++------ libstdc++-v3/testsuite/util/testsuite_hooks.h | 17 ++-------------- 10 files changed, 64 insertions(+), 46 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 380b6d58db9..83e740d18cb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2009-11-19 Benjamin Kosnik + + * 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 PR libstdc++/41622 diff --git a/libstdc++-v3/libsupc++/cxxabi-forced.h b/libstdc++-v3/libsupc++/cxxabi-forced.h index e0cf1d05edd..845d8094da0 100644 --- a/libstdc++-v3/libsupc++/cxxabi-forced.h +++ b/libstdc++-v3/libsupc++/cxxabi-forced.h @@ -23,6 +23,10 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . +/** @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 diff --git a/libstdc++-v3/src/bitmap_allocator.cc b/libstdc++-v3/src/bitmap_allocator.cc index 686a5ef02d1..55b308de25b 100644 --- a/libstdc++-v3/src/bitmap_allocator.cc +++ b/libstdc++-v3/src/bitmap_allocator.cc @@ -76,7 +76,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __ret = reinterpret_cast (::operator new(__sz + sizeof(size_t))); } - __catch(...) + __catch(const std::bad_alloc&) { this->_M_clear(); } diff --git a/libstdc++-v3/src/ios.cc b/libstdc++-v3/src/ios.cc index 25184d04df9..9d2ff8eeb59 100644 --- a/libstdc++-v3/src/ios.cc +++ b/libstdc++-v3/src/ios.cc @@ -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 diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index 98f6020533c..5ee8258ccb8 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -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; diff --git a/libstdc++-v3/src/pool_allocator.cc b/libstdc++-v3/src/pool_allocator.cc index ebaa394900b..80f07ba863b 100644 --- a/libstdc++-v3/src/pool_allocator.cc +++ b/libstdc++-v3/src/pool_allocator.cc @@ -94,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { _S_start_free = static_cast(::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 diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h index f26fd885485..2d7e45bb1ed 100644 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h @@ -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()); } diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h index 64a348769e2..e95f797cb51 100644 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h @@ -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); } diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h index 43e5c58ec60..64602ac4c1b 100644 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h @@ -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); } diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h index d28a986b853..da51d37ae62 100644 --- a/libstdc++-v3/testsuite/util/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h @@ -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_; }; -- 2.11.0