summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-02-25 20:52:31 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-02-26 08:57:08 +0100
commit069506bcb0ee4005b01c22095ed427b96b553c98 (patch)
tree96e05c9acb45071dbde1fff19bbef4c587487994 /bridges
parent128deeae81a6f802bfb79b8f0fa8c4b10729f7db (diff)
Use config_cxxabi.h to check for __cxa_eh_globals, __cxa_exception
Change-Id: I467341da4bccb3afb82518b444cd101b3cdaacc9
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx65
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx10
3 files changed, 27 insertions, 52 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
index 5efd7cb752e8..04d13e80c748 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
@@ -81,7 +81,7 @@ static OUString toUNOname( char const * p )
extern "C" {
static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
{
- __cxa_exception const * header = (static_cast<__cxa_exception const *>(pExc) - 1);
+ __cxxabiv1::__cxa_exception const * header = (static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1);
typelib_TypeDescription * pTD = nullptr;
OUString unoName( toUNOname( header->exceptionType->name() ) );
::typelib_typedescription_getByName( &pTD, unoName.pData );
@@ -138,7 +138,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
__cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
}
-void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
+void fillUnoException( __cxxabiv1::__cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
{
if (! header)
{
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
index 19399f35be0a..4112114b7566 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
@@ -59,53 +59,40 @@ extern "C" _LIBCPP_NORETURN void __cxa_throw(
#else
-namespace CPPU_CURRENT_NAMESPACE
-{
-
-// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h
-
-struct __cxa_exception
-{
- ::std::type_info *exceptionType;
- void (*exceptionDestructor)(void *);
-
- ::std::unexpected_handler unexpectedHandler;
- ::std::terminate_handler terminateHandler;
-
- __cxa_exception *nextException;
-
+#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
+// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
+namespace __cxxabiv1 {
+struct __cxa_exception {
+ std::type_info * exceptionType;
+ void (* exceptionDestructor)(void *);
+ std::unexpected_handler unexpectedHandler;
+ std::terminate_handler terminateHandler;
+ __cxa_exception * nextException;
int handlerCount;
-
int handlerSwitchValue;
- const unsigned char *actionRecord;
- const unsigned char *languageSpecificData;
- void *catchTemp;
- void *adjustedPtr;
-
+ char const * actionRecord;
+ char const * languageSpecificData;
+ void * catchTemp;
+ void * adjustedPtr;
_Unwind_Exception unwindHeader;
};
+}
+#endif
-struct __cxa_eh_globals
-{
- __cxa_exception *caughtExceptions;
+#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
+// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
+namespace __cxxabiv1 {
+struct __cxa_eh_globals {
+ __cxa_exception * caughtExceptions;
unsigned int uncaughtExceptions;
};
-
}
-
-// __cxa_get_globals is exported from libstdc++ since GCC 3.4.0 (CXXABI_1.3),
-// but it is only declared in cxxabi.h (in namespace __cxxabiv1) since
-// GCC 4.7.0. It returns a pointer to a struct __cxa_eh_globals, but that
-// struct is only incompletely declared even in the GCC 4.7.0 cxxabi.h.
-// Therefore, provide a declaration here for old GCC (libstdc++, really) version
-// that returns a void pointer, and in the code calling it always cast to the
-// above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which
-// hopefully keeps matching the real definition in libstdc++); similarly for
-// __cxa_allocate_exception and __cxa_throw, though they do not have the
-// additional problem of an incompletely declared return type:
+#endif
#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
-namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
+namespace __cxxabiv1 {
+extern "C" __cxa_eh_globals * __cxa_get_globals() throw();
+}
#endif
#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
@@ -133,11 +120,7 @@ void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
void fillUnoException(
-#ifdef _LIBCPP_VERSION
__cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
-#else
- __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
-#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index a4686916ca1e..1f85882d2db2 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -294,17 +294,9 @@ static void cpp_call(
catch (...)
{
// fill uno exception
-#ifdef _LIBCPP_VERSION
CPPU_CURRENT_NAMESPACE::fillUnoException(
- reinterpret_cast< __cxxabiv1::__cxa_eh_globals * >(
- __cxxabiv1::__cxa_get_globals())->caughtExceptions,
+ __cxxabiv1::__cxa_get_globals()->caughtExceptions,
*ppUnoExc, pThis->getBridge()->getCpp2Uno());
-#else
- fillUnoException(
- reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >(
- __cxxabiv1::__cxa_get_globals())->caughtExceptions,
- *ppUnoExc, pThis->getBridge()->getCpp2Uno());
-#endif
// temporary params
for ( ; nTempIndices--; )