summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-02-14 15:04:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-02-14 15:04:50 +0100
commit9dc337e9d073352cd9c9018d30b40bd4dcd5b1cb (patch)
tree169d485d3ba441d9ab06a336216d971ced8b698c /bridges
parent2a0a80a1385544cbb8d9f6b3ffc22f1c0afeb4ed (diff)
Adapt gcc3_linux_intel to Clang 3.4
...same as 5ba3d1740b03efa394b2d2bf34fb8a8d3db2331d "Clean up declaration of __cxa_get_globals" plus c17f01753ce94e9f57d6e4a2763152240fbcd50a "...and similarly for __cxa_allocate_exception and __cxa_throw." Change-Id: I02361cfca260577ce13fb634b5637938daf0283d
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/except.cxx9
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/share.hxx50
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx7
3 files changed, 42 insertions, 24 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index ee26ba03f33e..f9397a918b92 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -22,11 +22,6 @@
#include <dlfcn.h>
#include <boost/unordered_map.hpp>
-#include <cxxabi.h>
-#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
-#define _GLIBCXX_CDTOR_CALLABI
-#endif
-
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
@@ -248,7 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
Reference< XInterface >() );
}
- pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
+ pCppExc = __cxxabiv1::__cxa_allocate_exception( pTypeDescr->nSize );
::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
// destruct uno exception
@@ -280,7 +275,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
}
}
- __cxa_throw( pCppExc, rtti, deleteException );
+ __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
}
//==================================================================================================
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
index e37df2101181..4077d57c9404 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
@@ -17,13 +17,20 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "uno/mapping.h"
+#include "sal/config.h"
#include <typeinfo>
#include <exception>
#include <cstddef>
+#include <cxxabi.h>
+#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
+#define _GLIBCXX_CDTOR_CALLABI
+#endif
+
+#include "config_gcc.h"
#include <uno/any2.h>
+#include "uno/mapping.h"
namespace CPPU_CURRENT_NAMESPACE
{
@@ -69,24 +76,37 @@ struct __cxa_eh_globals
}
-extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
+// __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:
+
+#if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS
+namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
+#endif
-namespace CPPU_CURRENT_NAMESPACE
-{
+#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
+namespace __cxxabiv1 {
+extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
+}
+#endif
-// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
-// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
-// declarations for them, e.g., with or without throw() specification, so would
-// complain about redeclarations of these somewhat implicitly declared
-// functions):
-#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
-extern "C" void *__cxa_allocate_exception(
- std::size_t thrown_size ) throw();
-extern "C" void __cxa_throw (
- void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
+#if !HAVE_GCC_CXXABI_H_CXA_THROW
+namespace __cxxabiv1 {
+extern "C" void __cxa_throw(
+ void * thrown_exception, void * tinfo, void (* dest)(void *))
+ __attribute__((noreturn));
+}
#endif
-// -----
+namespace CPPU_CURRENT_NAMESPACE
+{
//==================================================================================================
void raiseException(
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
index 37605ca88886..ab95916020b7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
@@ -202,8 +202,11 @@ static void cpp_call(
}
catch (...)
{
- // fill uno exception
- fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+ // fill uno exception
+ fillUnoException(
+ reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >(
+ __cxxabiv1::__cxa_get_globals())->caughtExceptions,
+ *ppUnoExc, pThis->getBridge()->getCpp2Uno());
// temporary params
for ( ; nTempIndices--; )