+2001-03-20 Jason Merrill <jason@redhat.com>
+
+ * libsupc++/vec.cc (__cxa_vec_cleanup): New fn.
+ (__cxa_vec_ctor, __cxa_vec_cctor, __cxa_vec_dtor): Call it.
+ * libsupc++/cxxabi.h: Declare it.
+
2001-03-16 Alexandre Oliva <aoliva@redhat.com>
* src/gen-num-limits.cc (signal_adapter): Overloaded to match
__SIZE_TYPE__ __element_size,
void (*__destructor) (void *));
+/* destruct array */
+extern "C"
+void __cxa_vec_cleanup (void *__array_address,
+ __SIZE_TYPE__ __element_count,
+ __SIZE_TYPE__ __element_size,
+ void (*__destructor) (void *));
+
/* destruct and release array */
extern "C"
void __cxa_vec_delete (void *__array_address,
{
{
uncatch_exception ue;
- __cxa_vec_dtor(array_address, ix, element_size, destructor);
+ __cxa_vec_cleanup(array_address, ix, element_size, destructor);
}
__throw_exception_again;
}
{
{
uncatch_exception ue;
- __cxa_vec_dtor (dest_array, ix, element_size, destructor);
+ __cxa_vec_cleanup(dest_array, ix, element_size, destructor);
}
__throw_exception_again;
}
{
char *ptr = static_cast<char *>(array_address);
std::size_t ix = element_count;
- bool unwinding = std::uncaught_exception();
-
+
ptr += element_count * element_size;
-
+
try
{
while (ix--)
}
catch (...)
{
- if (unwinding)
- // [except.ctor]/3 If a destructor called during stack unwinding
- // exits with an exception, terminate is called.
- std::terminate ();
{
uncatch_exception ue;
- __cxa_vec_dtor(array_address, ix, element_size, destructor);
+ __cxa_vec_cleanup(array_address, ix, element_size, destructor);
}
__throw_exception_again;
}
}
}
+ // Destruct array as a result of throwing an exception.
+ // [except.ctor]/3 If a destructor called during stack unwinding
+ // exits with an exception, terminate is called.
+ extern "C" void
+ __cxa_vec_cleanup(void *array_address,
+ std::size_t element_count,
+ std::size_t element_size,
+ void (*destructor) (void *))
+ {
+ if (destructor)
+ {
+ char *ptr = static_cast <char *> (array_address);
+ std::size_t ix = element_count;
+
+ ptr += element_count * element_size;
+
+ try
+ {
+ while (ix--)
+ {
+ ptr -= element_size;
+ destructor(ptr);
+ }
+ }
+ catch (...)
+ {
+ std::terminate();
+ }
+ }
+ }
+
// Destruct and release array.
extern "C" void
__cxa_vec_delete(void *array_address,