+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
// 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
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
__ret = reinterpret_cast<size_t*>
(::operator new(__sz + sizeof(size_t)));
}
- __catch(...)
+ __catch(const std::bad_alloc&)
{
this->_M_clear();
}
__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
__try
{ _M_impl->_M_replace_categories(__add._M_impl, __cat); }
- __catch (...)
+ __catch(...)
{
_M_impl->_M_remove_reference();
__throw_exception_again;
{
_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
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();
// 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();
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);
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);
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);
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
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);
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());
}
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;
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;
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);
}
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;
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;
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
catch (...)
{
VERIFY(list0101.size() == 3);
- VERIFY(value_type::copyCount() == 4);
+ VERIFY(copy_constructor::count() == 4);
}
i = list0101.begin();
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);
}
int
id() const { return id_; }
- private:
- int id_;
- const bool throw_on_copy_;
-
- public:
static void
reset()
{
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_;
};