From 7511a8eeca171575e878528a1fa434197f1c1f22 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Tue, 10 Jun 2014 18:35:36 +0200 Subject: [PATCH] Fix build on FreeBSD with libc++ Change-Id: Ib51b05eb3f7c5d1288bee0f9f738ab1f37251c3e --- bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx | 32 ++++++++++++++++++++ .../source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx | 7 +++++ 2 files changed, 39 insertions(+) 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 e476119..624d543 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx @@ -31,6 +31,32 @@ #include "config_gcc.h" #include "uno/mapping.h" +#ifdef _LIBCPP_VERSION + +namespace __cxxabiv1 +{ + struct __class_type_info : public std::type_info + { + explicit __class_type_info( const char *__n ) : type_info( __n ) { } + virtual ~__class_type_info(); + }; + + struct __si_class_type_info : public __class_type_info + { + explicit __si_class_type_info( const char *__n, const __class_type_info *__b ) : + __class_type_info( __n ), __base_type( __b ) { } + virtual ~__si_class_type_info(); + const __class_type_info *__base_type; + }; + +extern "C" void *__cxa_allocate_exception( std::size_t thrown_size ) _NOEXCEPT; + +extern "C" _LIBCPP_NORETURN void __cxa_throw( + void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ); +} + +#else + namespace CPPU_CURRENT_NAMESPACE { @@ -101,6 +127,8 @@ extern "C" void __cxa_throw( __attribute__((noreturn)); } #endif +} +#endif namespace CPPU_CURRENT_NAMESPACE { @@ -109,7 +137,11 @@ 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 b520054..f4c70a1 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx @@ -285,10 +285,17 @@ 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, + *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--; ) -- 1.7.9.5