Commit d05f74f1 by Jason Merrill Committed by Jason Merrill

re PR other/28145 (C++ (throw() and catch(...) {/* fall through */ } ) and…

re PR other/28145 (C++ (throw() and catch(...) {/*  fall through */ } ) and pthread cancellation are incompatible (at least with NPTL))

        PR c++/28145
        * libsupc++/cxxabi.h (__forced_unwind, __foreign_exception):
        New classes.
        * libsupc++/eh_exception.cc: Define their destructors.
        * config/abi/pre/gnu.ver: Export their type_infos.
        * config/abi/pre/gnu-versioned-namespace.ver: Likewise.
        * libsupc++/eh_personality.cc: A handler for abi::__forced_unwind
        matches a forced unwind, and a handler for abi::__foreign_exception
        matches a foreign exception.

        * include/bits/istream.tcc: Rethrow forced unwind.
        * include/bits/ostream.tcc: Likewise.
        * include/bits/ostream_insert.h: Likewise.
        * include/bits/basic_string.tcc (operator>>, getline): Likewise.
        * include/bits/fstream.tcc (basic_filebuf::close): Likewise.
        * include/ext/vstring.cc (operator>>, getline): Likewise.
        * src/istream.cc: Likewise.
        * src/compatibility.cc (basic_istream::ignore): Likewise.
        * include/std/bitset (operator>>): Likewise.
        * include/std/fstream (basic_filebuf::close): Remove throw() spec.
        * libsupc++/cxxabi-internal.h: Split out from...
        * libsupc++/cxxabi.h: ...here.

From-SVN: r124517
parent 1e7c1ba8
// This test only applies to glibc (NPTL) targets.
// { dg-do run { target *-*-linux* } }
// { dg-options "-pthread" }
#include <pthread.h>
#include <cxxabi.h>
extern "C" int printf (const char *, ...);
int main()
{
try
{
pthread_exit (0);
}
catch (abi::__forced_unwind &)
{
printf ("caught forced unwind\n");
throw;
}
catch (...)
{
printf ("caught ...\n");
return 1;
}
}
2007-05-07 Jason Merrill <jason@redhat.com>
PR c++/28145
* libsupc++/cxxabi.h (__forced_unwind, __foreign_exception):
New classes.
* libsupc++/eh_exception.cc: Define their destructors.
* config/abi/pre/gnu.ver: Export their type_infos.
* config/abi/pre/gnu-versioned-namespace.ver: Likewise.
* libsupc++/eh_personality.cc: A handler for abi::__forced_unwind
matches a forced unwind, and a handler for abi::__foreign_exception
matches a foreign exception.
* include/bits/istream.tcc: Rethrow forced unwind.
* include/bits/ostream.tcc: Likewise.
* include/bits/ostream_insert.h: Likewise.
* include/bits/basic_string.tcc (operator>>, getline): Likewise.
* include/bits/fstream.tcc (basic_filebuf::close): Likewise.
* include/ext/vstring.cc (operator>>, getline): Likewise.
* src/istream.cc: Likewise.
* src/compatibility.cc (basic_istream::ignore): Likewise.
* include/std/bitset (operator>>): Likewise.
* include/std/fstream (basic_filebuf::close): Remove throw() spec.
* libsupc++/cxxabi-internal.h: Split out from...
* libsupc++/cxxabi.h: ...here.
2007-05-07 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h: Do not include <cstring>.
......
......@@ -178,6 +178,8 @@ CXXABI_1.7 {
_ZTIN10__cxxabiv119__pointer_type_infoE;
_ZTIN10__cxxabiv120__si_class_type_infoE;
_ZTIN10__cxxabiv121__vmi_class_type_infoE;
_ZTIN10__cxxabiv115__forced_unwindE;
_ZTIN10__cxxabiv119__foreign_exceptionE;
# typeinfo name
_ZTS[a-z];
......
......@@ -793,6 +793,8 @@ CXXABI_1.3 {
_ZTIN10__cxxabiv119__pointer_type_infoE;
_ZTIN10__cxxabiv120__si_class_type_infoE;
_ZTIN10__cxxabiv121__vmi_class_type_infoE;
_ZTIN10__cxxabiv115__forced_unwindE;
_ZTIN10__cxxabiv119__foreign_exceptionE;
# typeinfo name
_ZTS[a-fh-z];
......
......@@ -448,7 +448,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_data->_M_curr_symbol = L"";
_M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
}
catch (...)
catch(...)
{
delete _M_data;
_M_data = 0;
......@@ -591,7 +591,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_data->_M_curr_symbol = L"";
_M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
}
catch (...)
catch(...)
{
delete _M_data;
_M_data = 0;
......
......@@ -46,6 +46,8 @@
#pragma GCC system_header
#include <cxxabi-internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits, typename _Alloc>
......@@ -1015,6 +1017,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= __ios_base::eofbit;
__in.width(0);
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......@@ -1074,6 +1081,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= __ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......
......@@ -42,6 +42,8 @@
#pragma GCC system_header
#include <cxxabi-internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
......@@ -127,36 +129,51 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
basic_filebuf<_CharT, _Traits>::
close() throw()
close()
{
__filebuf_type* __ret = NULL;
if (this->is_open())
if (!this->is_open())
return NULL;
bool __testfail = false;
{
// NB: Do this here so that re-opened filebufs will be cool...
struct __close_sentry
{
bool __testfail = false;
try
{
if (!_M_terminate_output())
__testfail = true;
}
catch(...)
{ __testfail = true; }
// NB: Do this here so that re-opened filebufs will be cool...
_M_mode = ios_base::openmode(0);
_M_pback_init = false;
_M_destroy_internal_buffer();
_M_reading = false;
_M_writing = false;
_M_set_buffer(-1);
_M_state_last = _M_state_cur = _M_state_beg;
if (!_M_file.close())
__testfail = true;
if (!__testfail)
__ret = this;
}
return __ret;
basic_filebuf *__fb;
__close_sentry (basic_filebuf *__fbi): __fb(__fbi) { }
~__close_sentry ()
{
__fb->_M_mode = ios_base::openmode(0);
__fb->_M_pback_init = false;
__fb->_M_destroy_internal_buffer();
__fb->_M_reading = false;
__fb->_M_writing = false;
__fb->_M_set_buffer(-1);
__fb->_M_state_last = __fb->_M_state_cur = __fb->_M_state_beg;
}
} __cs (this);
try
{
if (!_M_terminate_output())
__testfail = true;
}
catch(__cxxabiv1::__forced_unwind&)
{
_M_file.close();
__throw_exception_again;
}
catch(...)
{ __testfail = true; }
}
if (!_M_file.close())
__testfail = true;
if (__testfail)
return NULL;
else
return this;
}
template<typename _CharT, typename _Traits>
......
......@@ -43,6 +43,8 @@
#pragma GCC system_header
#include <cxxabi-internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
......@@ -98,6 +100,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const __num_get_type& __ng = __check_facet(this->_M_num_get);
__ng.get(*this, 0, *this, __err, __v);
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -163,6 +170,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (__ineof)
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::failbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::failbit); }
}
......@@ -194,6 +206,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -226,6 +243,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -264,6 +286,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -307,6 +334,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -355,6 +387,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= ios_base::failbit;
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -392,6 +429,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
_M_gcount = 1;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -449,6 +491,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -509,6 +556,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__sb->sbumpc();
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -534,6 +586,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__c, traits_type::eof()))
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -558,6 +615,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (_M_gcount != __n)
__err |= (ios_base::eofbit | ios_base::failbit);
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -585,6 +647,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else if (__num == -1)
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -613,6 +680,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|| traits_type::eq_int_type(__sb->sputbackc(__c), __eof))
__err |= ios_base::badbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -641,6 +713,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|| traits_type::eq_int_type(__sb->sungetc(), __eof))
__err |= ios_base::badbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -672,6 +749,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__ret = 0;
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -694,6 +776,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__ret = this->rdbuf()->pubseekoff(0, ios_base::cur,
ios_base::in);
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
return __ret;
......@@ -720,6 +807,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= ios_base::failbit;
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -748,6 +840,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= ios_base::failbit;
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -775,6 +872,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= (ios_base::eofbit | ios_base::failbit);
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ __in._M_setstate(ios_base::badbit); }
if (__err)
......@@ -828,6 +930,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*__s = char_type();
__in.width(0);
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ __in._M_setstate(ios_base::badbit); }
}
......
......@@ -409,7 +409,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
try
{ delete this; }
catch (...)
catch(...)
{ }
}
}
......
......@@ -43,6 +43,8 @@
#pragma GCC system_header
#include <cxxabi-internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _CharT, typename _Traits>
......@@ -76,6 +78,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (__np.put(*this, *this, this->fill(), __v).failed())
__err |= ios_base::badbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -126,6 +133,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (!__copy_streambufs(__sbin, this->rdbuf()))
__err |= ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::failbit); }
}
......@@ -157,7 +169,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__put, traits_type::eof()))
__err |= ios_base::badbit;
}
catch (...)
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
this->setstate(__err);
......@@ -182,7 +199,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
try
{ _M_write(__s, __n); }
catch (...)
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
return *this;
......@@ -202,6 +224,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (this->rdbuf() && this->rdbuf()->pubsync() == -1)
__err |= ios_base::badbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -220,6 +247,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (!this->fail())
__ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
return __ret;
......@@ -245,6 +277,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= ios_base::failbit;
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -272,6 +309,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= ios_base::failbit;
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -289,31 +331,29 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 167. Improper use of traits_type::length()
const size_t __clen = char_traits<char>::length(__s);
_CharT* __ws = 0;
const size_t __clen = char_traits<char>::length(__s);
try
{
__ws = new _CharT[__clen];
for (size_t __i = 0; __i < __clen; ++__i)
__ws[__i] = __out.widen(__s[__i]);
}
catch(...)
{
delete [] __ws;
__out._M_setstate(ios_base::badbit);
return __out;
}
struct __ptr_guard
{
_CharT *p;
__ptr_guard (_CharT *ip): p(ip) { }
~__ptr_guard() { delete[] p; }
_CharT* __get() { return p; }
} __pg (new _CharT[__clen]);
try
{
_CharT *__ws = __pg.__get();
for (size_t __i = 0; __i < __clen; ++__i)
__ws[__i] = __out.widen(__s[__i]);
__ostream_insert(__out, __ws, __clen);
delete [] __ws;
}
catch(...)
catch(__cxxabiv1::__forced_unwind&)
{
delete [] __ws;
__out._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ __out._M_setstate(ios_base::badbit); }
}
return __out;
}
......
......@@ -38,6 +38,7 @@
#pragma GCC system_header
#include <iosfwd>
#include <cxxabi-internal.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
......@@ -103,6 +104,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__ostream_write(__out, __s, __n);
__out.width(0);
}
catch(__cxxabiv1::__forced_unwind&)
{
__out._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ __out._M_setstate(__ios_base::badbit); }
}
......
......@@ -313,7 +313,7 @@ namespace __debug
return iterator(_Base::erase(__first.base(), __last.base()),
this);
}
catch (...)
catch(...)
{
this->_M_revalidate_singular();
__throw_exception_again;
......
......@@ -265,7 +265,7 @@ set_loads(std::pair<float, float> load_pair)
m_load_max = load_pair.second;
do_resize(static_cast<size_type>(size_base::get_size() / ((m_load_min + m_load_max) / 2)));
}
catch (...)
catch(...)
{
m_load_min = old_load_min;
m_load_max = old_load_max;
......
......@@ -38,6 +38,8 @@
#pragma GCC system_header
#include <cxxabi-internal.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
template<typename _CharT, typename _Traits, typename _Alloc,
......@@ -598,6 +600,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= __ios_base::eofbit;
__in.width(0);
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......@@ -669,6 +676,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= __ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......
......@@ -56,6 +56,7 @@
#include <bits/functexcept.h> // For invalid_argument, out_of_range,
// overflow_error
#include <iosfwd>
#include <cxxabi-internal.h>
#define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * sizeof(unsigned long))
#define _GLIBCXX_BITSET_WORDS(__n) \
......@@ -1271,6 +1272,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
}
}
}
catch(__cxxabiv1::__forced_unwind&)
{
__is._M_setstate(__ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ __is._M_setstate(__ios_base::badbit); }
}
......
......@@ -275,7 +275,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* If any operations fail, this function also fails.
*/
__filebuf_type*
close() throw();
close();
protected:
void
......
......@@ -613,7 +613,7 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
__sgn_g1cb = __log_gamma_sign(__c - __b);
__ln_g1cb = __log_gamma(__c - __b);
}
catch (...)
catch(...)
{
__ok1 = false;
}
......@@ -628,7 +628,7 @@ _GLIBCXX_BEGIN_NAMESPACE(_GLIBCXX_TR1)
__sgn_g2b = __log_gamma_sign(__b);
__ln_g2b = __log_gamma(__b);
}
catch (...)
catch(...)
{
__ok2 = false;
}
......
......@@ -31,12 +31,16 @@
#include "typeinfo"
#include "exception"
#include "unwind-cxx.h"
#include <cxxabi.h>
std::exception::~exception() throw() { }
std::bad_exception::~bad_exception() throw() { }
abi::__forced_unwind::~__forced_unwind() throw() { }
abi::__foreign_exception::~__foreign_exception() throw() { }
const char*
std::exception::what() const throw()
{
......
......@@ -30,6 +30,7 @@
#include <bits/c++config.h>
#include <cstdlib>
#include <exception_defines.h>
#include <cxxabi.h>
#include "unwind-cxx.h"
using namespace __cxxabiv1;
......@@ -541,13 +542,19 @@ PERSONALITY_FUNCTION (int version,
bool saw_cleanup = false;
bool saw_handler = false;
// During forced unwinding, we only run cleanups. With a foreign
// exception class, there's no exception type.
// ??? What to do about GNU Java and GNU Ada exceptions.
if ((actions & _UA_FORCE_UNWIND)
|| foreign_exception)
throw_type = 0;
// During forced unwinding, match a magic exception type.
if (actions & _UA_FORCE_UNWIND)
{
throw_type = &typeid(abi::__forced_unwind);
thrown_ptr = 0;
}
// With a foreign exception class, there's no exception type.
// ??? What to do about GNU Java and GNU Ada exceptions?
else if (foreign_exception)
{
throw_type = &typeid(abi::__foreign_exception);
thrown_ptr = 0;
}
else
#ifdef __ARM_EABI_UNWINDER__
throw_type = ue_header;
......@@ -590,7 +597,9 @@ PERSONALITY_FUNCTION (int version,
// object to stuff bits in for __cxa_call_unexpected to use.
// Allow them iff the exception spec is non-empty. I.e.
// a throw() specification results in __unexpected.
if (throw_type
if ((throw_type
&& !(actions & _UA_FORCE_UNWIND)
&& !foreign_exception)
? ! check_exception_spec (&info, throw_type, thrown_ptr,
ar_filter)
: empty_exception_spec (&info, ar_filter))
......
......@@ -114,6 +114,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -180,6 +185,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
if (traits_type::eq_int_type(__c, __eof))
__err |= ios_base::eofbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......
......@@ -127,7 +127,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__newsize = __ix + 1;
try
{ __words = new _Words[__newsize]; }
catch (...)
catch(...)
{
_M_streambuf_state |= badbit;
if (_M_streambuf_state & _M_exception)
......@@ -172,7 +172,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
try
{ (*__p->_M_fn) (__e, *this, __p->_M_index); }
catch (...)
catch(...)
{ }
__p = __p->_M_next;
}
......
......@@ -142,7 +142,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
wclog.flush();
#endif
}
catch (...)
catch(...)
{ }
}
}
......
......@@ -91,6 +91,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -177,6 +182,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__sb->sbumpc();
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -251,6 +261,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*__s = __char_type();
__in.width(0);
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ __in._M_setstate(ios_base::badbit); }
}
......@@ -321,6 +336,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__err |= ios_base::eofbit;
__in.width(0);
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......@@ -401,6 +421,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......@@ -473,6 +498,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
}
......@@ -559,6 +589,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__sb->sbumpc();
}
}
catch(__cxxabiv1::__forced_unwind&)
{
this->_M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{ this->_M_setstate(ios_base::badbit); }
if (__err)
......@@ -632,6 +667,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
else
__err |= ios_base::failbit;
}
catch(__cxxabiv1::__forced_unwind&)
{
__in._M_setstate(ios_base::badbit);
__throw_exception_again;
}
catch(...)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......
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