Commit bbcfe54a by Benjamin Kosnik

eh_terminate.cc: Fixes for -fno-exceptions.

2009-09-28  Benjamin Kosnik  <bkoz@redhat.com>

	*  libsupc++/eh_terminate.cc: Fixes for -fno-exceptions.
	*  libsupc++/vec.cc: Same.
	*  libsupc++/vterminate.cc: Same.
	*  libsupc++/new_opnt.cc: Same.

From-SVN: r152258
parent b80b0fd9
2009-09-28 Benjamin Kosnik <bkoz@redhat.com>
* libsupc++/eh_terminate.cc: Fixes for -fno-exceptions.
* libsupc++/vec.cc: Same.
* libsupc++/vterminate.cc: Same.
* libsupc++/new_opnt.cc: Same.
2009-09-28 Johannes Singler <singler@ira.uka.de> 2009-09-28 Johannes Singler <singler@ira.uka.de>
* include/parallel/for_each_selectors.h: Remove obsolete comment. * include/parallel/for_each_selectors.h: Remove obsolete comment.
......
...@@ -34,12 +34,13 @@ using namespace __cxxabiv1; ...@@ -34,12 +34,13 @@ using namespace __cxxabiv1;
void void
__cxxabiv1::__terminate (std::terminate_handler handler) throw () __cxxabiv1::__terminate (std::terminate_handler handler) throw ()
{ {
try { __try
{
handler (); handler ();
std::abort (); std::abort ();
} catch (...) {
std::abort ();
} }
__catch(...)
{ std::abort (); }
} }
void void
......
...@@ -47,11 +47,11 @@ operator new (std::size_t sz, const std::nothrow_t&) throw() ...@@ -47,11 +47,11 @@ operator new (std::size_t sz, const std::nothrow_t&) throw()
new_handler handler = __new_handler; new_handler handler = __new_handler;
if (! handler) if (! handler)
return 0; return 0;
try __try
{ {
handler (); handler ();
} }
catch (bad_alloc &) __catch(const bad_alloc&)
{ {
return 0; return 0;
} }
......
...@@ -95,12 +95,12 @@ namespace __cxxabiv1 ...@@ -95,12 +95,12 @@ namespace __cxxabiv1
reinterpret_cast <std::size_t *> (base)[-2] = element_size; reinterpret_cast <std::size_t *> (base)[-2] = element_size;
#endif #endif
} }
try __try
{ {
__cxa_vec_ctor(base, element_count, element_size, __cxa_vec_ctor(base, element_count, element_size,
constructor, destructor); constructor, destructor);
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
...@@ -136,12 +136,12 @@ namespace __cxxabiv1 ...@@ -136,12 +136,12 @@ namespace __cxxabiv1
reinterpret_cast <std::size_t *> (base)[-2] = element_size; reinterpret_cast <std::size_t *> (base)[-2] = element_size;
#endif #endif
} }
try __try
{ {
__cxa_vec_ctor(base, element_count, element_size, __cxa_vec_ctor(base, element_count, element_size,
constructor, destructor); constructor, destructor);
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
...@@ -164,13 +164,13 @@ namespace __cxxabiv1 ...@@ -164,13 +164,13 @@ namespace __cxxabiv1
std::size_t ix = 0; std::size_t ix = 0;
char *ptr = static_cast<char *>(array_address); char *ptr = static_cast<char *>(array_address);
try __try
{ {
if (constructor) if (constructor)
for (; ix != element_count; ix++, ptr += element_size) for (; ix != element_count; ix++, ptr += element_size)
constructor(ptr); constructor(ptr);
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
...@@ -194,14 +194,14 @@ namespace __cxxabiv1 ...@@ -194,14 +194,14 @@ namespace __cxxabiv1
char *dest_ptr = static_cast<char *>(dest_array); char *dest_ptr = static_cast<char *>(dest_array);
char *src_ptr = static_cast<char *>(src_array); char *src_ptr = static_cast<char *>(src_array);
try __try
{ {
if (constructor) if (constructor)
for (; ix != element_count; for (; ix != element_count;
ix++, src_ptr += element_size, dest_ptr += element_size) ix++, src_ptr += element_size, dest_ptr += element_size)
constructor(dest_ptr, src_ptr); constructor(dest_ptr, src_ptr);
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
...@@ -226,7 +226,7 @@ namespace __cxxabiv1 ...@@ -226,7 +226,7 @@ namespace __cxxabiv1
ptr += element_count * element_size; ptr += element_count * element_size;
try __try
{ {
while (ix--) while (ix--)
{ {
...@@ -234,7 +234,7 @@ namespace __cxxabiv1 ...@@ -234,7 +234,7 @@ namespace __cxxabiv1
destructor(ptr); destructor(ptr);
} }
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
...@@ -261,7 +261,7 @@ namespace __cxxabiv1 ...@@ -261,7 +261,7 @@ namespace __cxxabiv1
ptr += element_count * element_size; ptr += element_count * element_size;
try __try
{ {
while (ix--) while (ix--)
{ {
...@@ -269,7 +269,7 @@ namespace __cxxabiv1 ...@@ -269,7 +269,7 @@ namespace __cxxabiv1
destructor(ptr); destructor(ptr);
} }
} }
catch (...) __catch(...)
{ {
std::terminate(); std::terminate();
} }
...@@ -304,12 +304,12 @@ namespace __cxxabiv1 ...@@ -304,12 +304,12 @@ namespace __cxxabiv1
{ {
std::size_t element_count = reinterpret_cast<std::size_t *>(base)[-1]; std::size_t element_count = reinterpret_cast<std::size_t *>(base)[-1];
base -= padding_size; base -= padding_size;
try __try
{ {
__cxa_vec_dtor(array_address, element_count, element_size, __cxa_vec_dtor(array_address, element_count, element_size,
destructor); destructor);
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
...@@ -339,12 +339,12 @@ namespace __cxxabiv1 ...@@ -339,12 +339,12 @@ namespace __cxxabiv1
std::size_t element_count = reinterpret_cast<std::size_t *> (base)[-1]; std::size_t element_count = reinterpret_cast<std::size_t *> (base)[-1];
base -= padding_size; base -= padding_size;
size = element_count * element_size + padding_size; size = element_count * element_size + padding_size;
try __try
{ {
__cxa_vec_dtor(array_address, element_count, element_size, __cxa_vec_dtor(array_address, element_count, element_size,
destructor); destructor);
} }
catch (...) __catch(...)
{ {
{ {
uncatch_exception ue; uncatch_exception ue;
......
...@@ -75,9 +75,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -75,9 +75,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// If the exception is derived from std::exception, we can // If the exception is derived from std::exception, we can
// give more information. // give more information.
try { __throw_exception_again; } __try { __throw_exception_again; }
#ifdef __EXCEPTIONS #ifdef __EXCEPTIONS
catch (exception &exc) __catch(const exception& exc)
{ {
char const *w = exc.what(); char const *w = exc.what();
fputs(" what(): ", stderr); fputs(" what(): ", stderr);
...@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
fputs("\n", stderr); fputs("\n", stderr);
} }
#endif #endif
catch (...) { } __catch(...) { }
} }
else else
fputs("terminate called without an active exception\n", stderr); fputs("terminate called without an active exception\n", stderr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment