diff options
Diffstat (limited to 'libstdc++-v3/libsupc++')
22 files changed, 345 insertions, 289 deletions
diff --git a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am index d80defd1674..60745660fd6 100644 --- a/libstdc++-v3/libsupc++/Makefile.am +++ b/libstdc++-v3/libsupc++/Makefile.am @@ -68,7 +68,7 @@ INCLUDES = \ $(LIBSUPCXX_INCLUDES) headers = \ - cxxabi.h exception new typeinfo + exception new typeinfo cxxabi.h exception_defines.h sources = \ del_op.cc \ diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in index 5b8d2f28c9e..54e78103bd5 100644 --- a/libstdc++-v3/libsupc++/Makefile.in +++ b/libstdc++-v3/libsupc++/Makefile.in @@ -150,7 +150,7 @@ TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@ INCLUDES = -I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include -I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include $(LIBSUPCXX_INCLUDES) -headers = cxxabi.h exception new typeinfo +headers = exception new typeinfo cxxabi.h exception_defines.h sources = del_op.cc del_opnt.cc del_opv.cc del_opvnt.cc exception_support.cc new_handler.cc new_op.cc new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc vec.cc diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index 908d7c467fe..28ab2f73285 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -1,8 +1,7 @@ -/* new abi support -*- C++ -*- - Copyright (C) 2000 - Free Software Foundation, Inc. - Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com> */ - +// new abi support -*- C++ -*- + +// Copyright (C) 2000 Free Software Foundation, Inc. +// // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify @@ -29,6 +28,8 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. +// Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com> + /* This file declares the new abi entry points into the runtime. It is not normally necessary for user programs to include this header, or use the entry points directly. However, this header is available should that be diff --git a/libstdc++-v3/libsupc++/del_op.cc b/libstdc++-v3/libsupc++/del_op.cc index c009a1637c6..f43302496d5 100644 --- a/libstdc++-v3/libsupc++/del_op.cc +++ b/libstdc++-v3/libsupc++/del_op.cc @@ -1,4 +1,5 @@ // Boilerplate support routines for -*- C++ -*- dynamic memory management. + // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/del_opnt.cc b/libstdc++-v3/libsupc++/del_opnt.cc index d5d619e803d..032ea680cb3 100644 --- a/libstdc++-v3/libsupc++/del_opnt.cc +++ b/libstdc++-v3/libsupc++/del_opnt.cc @@ -1,4 +1,5 @@ // Boilerplate support routines for -*- C++ -*- dynamic memory management. + // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/del_opv.cc b/libstdc++-v3/libsupc++/del_opv.cc index b43d45a35a1..47d78428dfd 100644 --- a/libstdc++-v3/libsupc++/del_opv.cc +++ b/libstdc++-v3/libsupc++/del_opv.cc @@ -1,4 +1,5 @@ // Boilerplate support routines for -*- C++ -*- dynamic memory management. + // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/del_opvnt.cc b/libstdc++-v3/libsupc++/del_opvnt.cc index e91096c4af6..3504d99a0b3 100644 --- a/libstdc++-v3/libsupc++/del_opvnt.cc +++ b/libstdc++-v3/libsupc++/del_opvnt.cc @@ -1,4 +1,5 @@ // Boilerplate support routines for -*- C++ -*- dynamic memory management. + // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index e48d2160a60..fac73fb0566 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -1,7 +1,7 @@ // Exception Handling support header for -*- C++ -*- // Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation - +// // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify diff --git a/libstdc++-v3/libsupc++/exception_defines.h b/libstdc++-v3/libsupc++/exception_defines.h new file mode 100644 index 00000000000..fca2d835f41 --- /dev/null +++ b/libstdc++-v3/libsupc++/exception_defines.h @@ -0,0 +1,42 @@ +// -fno-exceptions Support -*- C++ -*- + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 19.1 Exception classes +// + +#ifndef __EXCEPTIONS +// Iff -fno-exceptions, transform error handling code to work without it. +# define try if (true) +# define catch(X) if (false) +# define __throw_exception_again +#else +// Else proceed normally. +# define __throw_exception_again throw +#endif diff --git a/libstdc++-v3/libsupc++/exception_support.cc b/libstdc++-v3/libsupc++/exception_support.cc index 3f82a1a3d92..d84ee6821da 100644 --- a/libstdc++-v3/libsupc++/exception_support.cc +++ b/libstdc++-v3/libsupc++/exception_support.cc @@ -1,10 +1,10 @@ // Functions for Exception Support for -*- C++ -*- -// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, -// 2001 Free Software Foundation - +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +// Free Software Foundation +// // This file is part of GNU CC. - +// // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) @@ -35,6 +35,7 @@ #include "exception" #include <cstddef> #include "exception_support.h" +#include "exception_defines.h" /* Define terminate, unexpected, set_terminate, set_unexpected as well as the default terminate func and default unexpected func. */ @@ -83,18 +84,18 @@ std::unexpected () } /* Language-specific EH info pointer, defined in libgcc2. */ - extern "C" cp_eh_info **__get_eh_info (); // actually void ** +#define CP_EH_INFO ((cp_eh_info *) *__get_eh_info ()) /* Exception allocate and free, defined in libgcc2. */ extern "C" void *__eh_alloc(std::size_t); extern "C" void __eh_free(void *); /* Is P the type_info node for a pointer of some kind? */ - extern bool __is_pointer (void *); +#ifdef __EXCEPTIONS /* OLD Compiler hook to return a pointer to the info for the current exception. Used by get_eh_info (). This fudges the actualy returned value to point to the beginning of what USE to be the cp_eh_info structure. @@ -106,8 +107,6 @@ __cp_exception_info (void) return &((*__get_eh_info ())->value); } -#define CP_EH_INFO ((cp_eh_info *) *__get_eh_info ()) - /* Old Compiler hook to return a pointer to the info for the current exception. Used by get_eh_info (). */ @@ -348,44 +347,40 @@ __check_null_eh_spec (void) { __check_eh_spec (0, 0); } +#endif //__EXCEPTIONS // Helpers for rtti. Although these don't return, we give them return types so // that the type system is not broken. - -#if !defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100 -#define THROW_BAD_CAST __throw_bad_cast -#define THROW_BAD_TYPEID __throw_bad_typeid -#else -#define THROW_BAD_CAST __cxa_bad_cast -#define THROW_BAD_TYPEID __cxa_bad_typeid -#endif - extern "C" void * -THROW_BAD_CAST () +__cxa_bad_cast() { - throw std::bad_cast (); +#ifdef __EXCEPTIONS + throw std::bad_cast(); +#else + std::abort(); +#endif return 0; } extern "C" std::type_info const & -THROW_BAD_TYPEID () +__cxa_bad_typeid() { - throw std::bad_typeid (); +#ifdef __EXCEPTIONS + throw std::bad_typeid(); +#else + std::abort(); +#endif return typeid (void); } /* Has the current exception been caught? */ - bool -std::uncaught_exception () throw() +std::uncaught_exception() throw() { cp_eh_info *p = CP_EH_INFO; return p && ! p->caught; } -const char * -std::exception:: -what () const throw() -{ - return typeid (*this).name (); -} +const char* +std::exception::what() const throw() +{ return typeid (*this).name (); } diff --git a/libstdc++-v3/libsupc++/exception_support.h b/libstdc++-v3/libsupc++/exception_support.h index 2b08388490b..cc781192ddb 100644 --- a/libstdc++-v3/libsupc++/exception_support.h +++ b/libstdc++-v3/libsupc++/exception_support.h @@ -1,5 +1,4 @@ -// Copyright (C) 2000 -// Free Software Foundation, Inc. +// Copyright (C) 2000 Free Software Foundation, Inc. // // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/libstdc++-v3/libsupc++/new_handler.cc b/libstdc++-v3/libsupc++/new_handler.cc index 183d1b29882..a6cf2a2a3fb 100644 --- a/libstdc++-v3/libsupc++/new_handler.cc +++ b/libstdc++-v3/libsupc++/new_handler.cc @@ -1,4 +1,5 @@ // Implementation file for the -*- C++ -*- dynamic memory management header. + // Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/new_op.cc b/libstdc++-v3/libsupc++/new_op.cc index 26be6ddb2e3..6b52df7f5ad 100644 --- a/libstdc++-v3/libsupc++/new_op.cc +++ b/libstdc++-v3/libsupc++/new_op.cc @@ -1,5 +1,5 @@ // Support routines for the -*- C++ -*- dynamic memory management. -// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation +// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation // // This file is part of GNU CC. // @@ -28,6 +28,8 @@ // the GNU General Public License. #include "new" +#include <exception_defines.h> + using std::new_handler; using std::bad_alloc; @@ -47,7 +49,11 @@ operator new (std::size_t sz) throw (std::bad_alloc) { new_handler handler = __new_handler; if (! handler) - throw bad_alloc (); +#ifdef __EXCEPTIONS + throw bad_alloc(); +#else + std::abort(); +#endif handler (); p = (void *) malloc (sz); } diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc index d7aa91d8545..e97ac986ab0 100644 --- a/libstdc++-v3/libsupc++/new_opnt.cc +++ b/libstdc++-v3/libsupc++/new_opnt.cc @@ -1,5 +1,5 @@ // Support routines for the -*- C++ -*- dynamic memory management. -// Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation +// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation // // This file is part of GNU CC. // @@ -28,6 +28,8 @@ // the GNU General Public License. #include "new" +#include <exception_defines.h> + using std::new_handler; using std::bad_alloc; diff --git a/libstdc++-v3/libsupc++/new_opv.cc b/libstdc++-v3/libsupc++/new_opv.cc index 98df6c9d8ea..7b1b1ca768e 100644 --- a/libstdc++-v3/libsupc++/new_opv.cc +++ b/libstdc++-v3/libsupc++/new_opv.cc @@ -1,4 +1,5 @@ // Boilerplate support routines for -*- C++ -*- dynamic memory management. + // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/new_opvnt.cc b/libstdc++-v3/libsupc++/new_opvnt.cc index 12a3c2fc22e..ad5fbf48b92 100644 --- a/libstdc++-v3/libsupc++/new_opvnt.cc +++ b/libstdc++-v3/libsupc++/new_opvnt.cc @@ -1,4 +1,5 @@ // Boilerplate support routines for -*- C++ -*- dynamic memory management. + // Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/pure.cc b/libstdc++-v3/libsupc++/pure.cc index 7ada0666856..4e6d0fb558c 100644 --- a/libstdc++-v3/libsupc++/pure.cc +++ b/libstdc++-v3/libsupc++/pure.cc @@ -1,4 +1,5 @@ // -*- C++ -*- + // Copyright (C) 2000 Free Software Foundation // // This file is part of GNU CC. diff --git a/libstdc++-v3/libsupc++/tinfo.cc b/libstdc++-v3/libsupc++/tinfo.cc index fefc815e759..dbb164b2380 100644 --- a/libstdc++-v3/libsupc++/tinfo.cc +++ b/libstdc++-v3/libsupc++/tinfo.cc @@ -1,8 +1,9 @@ // Methods for type_info for -*- C++ -*- Run Time Type Identification. -// Copyright (C) 1994, 1996, 1998, 1999, 2000 Free Software Foundation +// Copyright (C) 1994, 1996, 1998, 1999, 2000 Free Software Foundation +// // This file is part of GNU CC. - +// // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) diff --git a/libstdc++-v3/libsupc++/tinfo.h b/libstdc++-v3/libsupc++/tinfo.h index 456f715eeb3..e5395836179 100644 --- a/libstdc++-v3/libsupc++/tinfo.h +++ b/libstdc++-v3/libsupc++/tinfo.h @@ -1,4 +1,5 @@ // RTTI support internals for -*- C++ -*- + // Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000 Free Software Foundation #include "typeinfo" diff --git a/libstdc++-v3/libsupc++/tinfo2.cc b/libstdc++-v3/libsupc++/tinfo2.cc index 53e0fdf2784..1f33b438c40 100644 --- a/libstdc++-v3/libsupc++/tinfo2.cc +++ b/libstdc++-v3/libsupc++/tinfo2.cc @@ -1,8 +1,10 @@ // Methods for type_info for -*- C++ -*- Run Time Type Identification. -// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation +// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001 +// Free Software Foundation +// // This file is part of GNU CC. - +// // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo index 949c6d81e2f..436d220c7a4 100644 --- a/libstdc++-v3/libsupc++/typeinfo +++ b/libstdc++-v3/libsupc++/typeinfo @@ -1,6 +1,7 @@ // RTTI support for -*- C++ -*- -// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 Free Software Foundation +// // This file is part of GNU CC. // // GNU CC is free software; you can redistribute it and/or modify diff --git a/libstdc++-v3/libsupc++/vec.cc b/libstdc++-v3/libsupc++/vec.cc index f00d3c11b23..ac636f19870 100644 --- a/libstdc++-v3/libsupc++/vec.cc +++ b/libstdc++-v3/libsupc++/vec.cc @@ -1,8 +1,9 @@ -// new abi support -*- C++ -*- -// Copyright (C) 2000 -// Free Software Foundation, Inc. -// Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com> -// +// New abi Support -*- C++ -*- + +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// +// This file is part of GNU CC. +// // GNU CC is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) @@ -27,276 +28,273 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 +// Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com> + #include <cxxabi.h> #include <new> #include <exception> +#include <exception_defines.h> #include "exception_support.h" namespace __cxxabiv1 { + namespace + { + struct uncatch_exception + { + uncatch_exception () { p = __uncatch_exception (); } + ~uncatch_exception () { __recatch_exception (p); } + + cp_eh_info *p; + }; + } -namespace -{ -struct uncatch_exception { - uncatch_exception () { p = __uncatch_exception (); } - ~uncatch_exception () { __recatch_exception (p); } - - cp_eh_info *p; -}; -} - -/* allocate and construct array */ -extern "C" void * -__cxa_vec_new (std::size_t element_count, - std::size_t element_size, - std::size_t padding_size, - void (*constructor) (void *), - void (*destructor) (void *)) -{ - return __cxa_vec_new2 (element_count, element_size, padding_size, - constructor, destructor, - &operator new[], &operator delete []); -} + // Allocate and construct array. + extern "C" void * + __cxa_vec_new(std::size_t element_count, + std::size_t element_size, + std::size_t padding_size, + void (*constructor) (void *), + void (*destructor) (void *)) + { + return __cxa_vec_new2(element_count, element_size, padding_size, + constructor, destructor, + &operator new[], &operator delete []); + } -extern "C" void * -__cxa_vec_new2 (std::size_t element_count, - std::size_t element_size, - std::size_t padding_size, - void (*constructor) (void *), - void (*destructor) (void *), - void *(*alloc) (size_t), - void (*dealloc) (void *)) -{ - std::size_t size = element_count * element_size + padding_size; - char *base = static_cast <char *> (alloc (size)); + extern "C" void * + __cxa_vec_new2(std::size_t element_count, + std::size_t element_size, + std::size_t padding_size, + void (*constructor) (void *), + void (*destructor) (void *), + void *(*alloc) (size_t), + void (*dealloc) (void *)) + { + std::size_t size = element_count * element_size + padding_size; + char *base = static_cast <char *> (alloc (size)); + + if (padding_size) + { + base += padding_size; + reinterpret_cast <std::size_t *> (base)[-1] = element_count; + } + try + { + __cxa_vec_ctor(base, element_count, element_size, + constructor, destructor); + } + catch (...) + { + { + uncatch_exception ue; + dealloc(base - padding_size); + } + __throw_exception_again; + } + return base; + } - if (padding_size) - { - base += padding_size; - reinterpret_cast <std::size_t *> (base)[-1] = element_count; - } - try - { - __cxa_vec_ctor (base, element_count, element_size, - constructor, destructor); - } - catch (...) - { + extern "C" void * + __cxa_vec_new3(std::size_t element_count, + std::size_t element_size, + std::size_t padding_size, + void (*constructor) (void *), + void (*destructor) (void *), + void *(*alloc) (std::size_t), + void (*dealloc) (void *, std::size_t)) + { + std::size_t size = element_count * element_size + padding_size; + char *base = static_cast<char *>(alloc (size)); + + if (padding_size) { - uncatch_exception ue; - dealloc (base - padding_size); + base += padding_size; + reinterpret_cast<std::size_t *>(base)[-1] = element_count; } - throw; - } - return base; -} - -extern "C" void * -__cxa_vec_new3 (std::size_t element_count, - std::size_t element_size, - std::size_t padding_size, - void (*constructor) (void *), - void (*destructor) (void *), - void *(*alloc) (std::size_t), - void (*dealloc) (void *, std::size_t)) -{ - std::size_t size = element_count * element_size + padding_size; - char *base = static_cast <char *> (alloc (size)); + try + { + __cxa_vec_ctor(base, element_count, element_size, + constructor, destructor); + } + catch (...) + { + { + uncatch_exception ue; + dealloc(base - padding_size, size); + } + __throw_exception_again; + } + return base; + } - if (padding_size) - { - base += padding_size; - reinterpret_cast <std::size_t *> (base)[-1] = element_count; - } - try - { - __cxa_vec_ctor (base, element_count, element_size, - constructor, destructor); - } - catch (...) - { + // Construct array. + extern "C" void + __cxa_vec_ctor(void *array_address, + std::size_t element_count, + std::size_t element_size, + void (*constructor) (void *), + void (*destructor) (void *)) + { + std::size_t ix = 0; + char *ptr = static_cast<char *>(array_address); + + try { - uncatch_exception ue; - dealloc (base - padding_size, size); + if (constructor) + for (; ix != element_count; ix++, ptr += element_size) + constructor(ptr); } - throw; - } - return base; -} - -/* construct array */ -extern "C" void -__cxa_vec_ctor (void *array_address, - std::size_t element_count, - std::size_t element_size, - void (*constructor) (void *), - void (*destructor) (void *)) -{ - std::size_t ix = 0; - char *ptr = static_cast <char *> (array_address); + catch (...) + { + { + uncatch_exception ue; + __cxa_vec_dtor(array_address, ix, element_size, destructor); + } + __throw_exception_again; + } + } - try - { - if (constructor) - for (; ix != element_count; ix++, ptr += element_size) - constructor (ptr); - } - catch (...) - { + // Construct an array by copying. + extern "C" void + __cxa_vec_cctor(void *dest_array, + void *src_array, + std::size_t element_count, + std::size_t element_size, + void (*constructor) (void *, void *), + void (*destructor) (void *)) + { + std::size_t ix = 0; + char *dest_ptr = static_cast<char *>(dest_array); + char *src_ptr = static_cast<char *>(src_array); + + try { - uncatch_exception ue; - __cxa_vec_dtor (array_address, ix, element_size, destructor); + if (constructor) + for (; ix != element_count; + ix++, src_ptr += element_size, dest_ptr += element_size) + constructor(dest_ptr, src_ptr); } - throw; - } -} - -/* construct an array by copying */ - -extern "C" void -__cxa_vec_cctor (void *dest_array, - void *src_array, + catch (...) + { + { + uncatch_exception ue; + __cxa_vec_dtor (dest_array, ix, element_size, destructor); + } + __throw_exception_again; + } + } + + // Destruct array. + extern "C" void + __cxa_vec_dtor(void *array_address, std::size_t element_count, std::size_t element_size, - void (*constructor) (void *, void *), void (*destructor) (void *)) -{ - std::size_t ix = 0; - char *dest_ptr = static_cast <char *> (dest_array); - char *src_ptr = static_cast <char *> (src_array); - - try - { - if (constructor) - for (; ix != element_count; - ix++, src_ptr += element_size, dest_ptr += element_size) - constructor (dest_ptr, src_ptr); - } - catch (...) - { + { + if (destructor) { - uncatch_exception ue; - __cxa_vec_dtor (dest_array, ix, element_size, destructor); - } - throw; - } -} - -/* destruct array */ -extern "C" void -__cxa_vec_dtor (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; - bool unwinding = std::uncaught_exception (); + char *ptr = static_cast<char *>(array_address); + std::size_t ix = element_count; + bool unwinding = std::uncaught_exception(); - ptr += element_count * element_size; + ptr += element_count * element_size; - try - { - while (ix--) - { - ptr -= element_size; - destructor (ptr); - } - } - catch (...) - { - if (unwinding) - // [except.ctor]/3 If a destructor called during stack unwinding - // exits with an exception, terminate is called. - std::terminate (); + try + { + while (ix--) + { + ptr -= element_size; + destructor(ptr); + } + } + catch (...) { - uncatch_exception ue; - __cxa_vec_dtor (array_address, ix, element_size, - destructor); + 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); + } + __throw_exception_again; } - throw; - } - } -} + } + } -/* destruct and release array */ -extern "C" void -__cxa_vec_delete (void *array_address, - std::size_t element_size, - std::size_t padding_size, - void (*destructor) (void *)) -{ - __cxa_vec_delete2 (array_address, element_size, padding_size, - destructor, - &operator delete []); -} + // Destruct and release array. + extern "C" void + __cxa_vec_delete(void *array_address, + std::size_t element_size, + std::size_t padding_size, + void (*destructor) (void *)) + { + __cxa_vec_delete2(array_address, element_size, padding_size, + destructor, + &operator delete []); + } -extern "C" void -__cxa_vec_delete2 (void *array_address, - std::size_t element_size, - std::size_t padding_size, - void (*destructor) (void *), - void (*dealloc) (void *)) -{ - char *base = static_cast <char *> (array_address); + extern "C" void + __cxa_vec_delete2(void *array_address, + std::size_t element_size, + std::size_t padding_size, + void (*destructor) (void *), + void (*dealloc) (void *)) + { + char *base = static_cast<char *>(array_address); - if (padding_size) - { - std::size_t element_count = reinterpret_cast <std::size_t *> (base)[-1]; - base -= padding_size; - try - { - __cxa_vec_dtor (array_address, element_count, element_size, - destructor); - } - catch (...) - { + if (padding_size) + { + std::size_t element_count = reinterpret_cast<std::size_t *>(base)[-1]; + base -= padding_size; + try { - uncatch_exception ue; - dealloc (base); + __cxa_vec_dtor(array_address, element_count, element_size, + destructor); } - throw; - } - } - dealloc (base); -} - -extern "C" void -__cxa_vec_delete3 (void *array_address, - std::size_t element_size, - std::size_t padding_size, - void (*destructor) (void *), - void (*dealloc) (void *, std::size_t)) -{ - char *base = static_cast <char *> (array_address); - std::size_t size = 0; - - if (padding_size) - { - std::size_t element_count = reinterpret_cast <std::size_t *> (base)[-1]; - base -= padding_size; - size = element_count * element_size + padding_size; - try - { - __cxa_vec_dtor (array_address, element_count, element_size, - destructor); - } - catch (...) - { + catch (...) { - uncatch_exception ue; - dealloc (base, size); + { + uncatch_exception ue; + dealloc(base); + } + __throw_exception_again; } - throw; - } - } - dealloc (base, size); -} + } + dealloc(base); + } + extern "C" void + __cxa_vec_delete3(void *array_address, + std::size_t element_size, + std::size_t padding_size, + void (*destructor) (void *), + void (*dealloc) (void *, std::size_t)) + { + char *base = static_cast <char *> (array_address); + std::size_t size = 0; + + if (padding_size) + { + std::size_t element_count = reinterpret_cast<std::size_t *> (base)[-1]; + base -= padding_size; + size = element_count * element_size + padding_size; + try + { + __cxa_vec_dtor(array_address, element_count, element_size, + destructor); + } + catch (...) + { + { + uncatch_exception ue; + dealloc(base, size); + } + __throw_exception_again; + } + } + dealloc(base, size); + } } // namespace __cxxabiv1 - -#endif // defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 |