vec.cc (__cxa_vec_cleanup): New fn.

* libsupc++/vec.cc (__cxa_vec_cleanup): New fn.
        (__cxa_vec_ctor, __cxa_vec_cctor, __cxa_vec_dtor): Call it.
        * libsupc++/cxxabi.h: Declare it.

From-SVN: r40657
This commit is contained in:
Jason Merrill 2001-03-20 11:59:44 -05:00 committed by Jason Merrill
parent e03a61f143
commit f8c02bc55a
3 changed files with 49 additions and 10 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -473,6 +473,13 @@ void __cxa_vec_dtor (void *__array_address,
__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,

View File

@ -150,7 +150,7 @@ namespace __cxxabiv1
{
{
uncatch_exception ue;
__cxa_vec_dtor(array_address, ix, element_size, destructor);
__cxa_vec_cleanup(array_address, ix, element_size, destructor);
}
__throw_exception_again;
}
@ -180,7 +180,7 @@ namespace __cxxabiv1
{
{
uncatch_exception ue;
__cxa_vec_dtor (dest_array, ix, element_size, destructor);
__cxa_vec_cleanup(dest_array, ix, element_size, destructor);
}
__throw_exception_again;
}
@ -197,10 +197,9 @@ namespace __cxxabiv1
{
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--)
@ -211,19 +210,46 @@ namespace __cxxabiv1
}
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,