Skip to content

Commit

Permalink
Huge update to the FreeBSD port (i386 part).
Browse files Browse the repository at this point in the history
Starting with FreeBSD 10, the FreeBSD project has moved from using
gcc/libstdc++ to using a complete C++ stack based on clang/llvm
libc++ and libcxxrt. This new stack has better standards compliance
and has huge similarities with MacOSX but it brought subtle low
level problems for our outdated bridges code.

Don Lewis has done a brave effort to update this code and
has done extensive testing within FreeBSD port. Support
for older versions of gcc has been dropped.

Code Review:
https://reviews.freebsd.org/D2108
https://reviews.freebsd.org/D2055

Author:		Don Lewis (truckman at FreeBSD)


git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1669457 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pgiffuni committed Mar 26, 2015
1 parent cda7f8b commit baf6650
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
5 changes: 5 additions & 0 deletions main/bridges/source/cpp_uno/gcc3_freebsd_intel/cpp2uno.cxx
Expand Up @@ -24,6 +24,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"

#include <typeinfo>
#include <exception>
#include <cstddef>
#include <cxxabi.h>

#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <uno/data.h>
Expand Down
12 changes: 10 additions & 2 deletions main/bridges/source/cpp_uno/gcc3_freebsd_intel/except.cxx
Expand Up @@ -24,9 +24,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"

#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
#include <cstddef>
#include <exception>
#endif
#include <typeinfo>

#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -182,7 +182,12 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
char const * rttiName = symName.getStr() +4;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
#ifndef __GLIBCXX__ /* #i124421# */
const OString aCUnoName = OUStringToOString( unoName, RTL_TEXTENCODING_UTF8);
OSL_TRACE( "TypeInfo for \"%s\" not found and cannot be generated.\n", aCUnoName.getStr());
#endif /* __GLIBCXX__ */
#endif
#ifdef __GLIBCXX__ /* #i124421# */
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
Expand All @@ -196,6 +201,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
// this class has no base class
rtti = new __class_type_info( strdup( rttiName ) );
}
#else /* __GLIBCXX__ */
rtti = NULL;
#endif /* __GLIBCXX__ */

pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
Expand Down
12 changes: 8 additions & 4 deletions main/bridges/source/cpp_uno/gcc3_freebsd_intel/share.hxx
Expand Up @@ -23,17 +23,14 @@

#include "uno/mapping.h"

#include <typeinfo>
#include <exception>
#include <cstddef>

namespace CPPU_CURRENT_NAMESPACE
{

void dummy_can_throw_anything( char const * );

// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h

#ifdef __GLIBCXX__
struct _Unwind_Exception
{
unsigned exception_class __attribute__((__mode__(__DI__)));
Expand Down Expand Up @@ -62,25 +59,32 @@ struct __cxa_exception

_Unwind_Exception unwindHeader;
};
#endif /* __GLIBCXX__ */

extern "C" void *__cxa_allocate_exception(
std::size_t thrown_size ) throw();
extern "C" void __cxa_throw (
void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));

#ifdef __GLIBCXX__
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
};
extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
#endif /* __GLIBCXX__ */

// -----

//==================================================================================================
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
//==================================================================================================
#ifndef __GLIBCXX__
using __cxxabiv1:: __cxa_exception;
#endif /* __GLIBCXX__ */

void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
11 changes: 10 additions & 1 deletion main/bridges/source/cpp_uno/gcc3_freebsd_intel/uno2cpp.cxx
Expand Up @@ -24,6 +24,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"

#include <typeinfo>
#include <exception>
#include <cstddef>
#include <cxxabi.h>
#include <stdlib.h>

#include <com/sun/star/uno/genfunc.hxx>
Expand All @@ -39,6 +43,11 @@

using namespace ::rtl;
using namespace ::com::sun::star::uno;
#ifdef __GLIBCXX__
using CPPU_CURRENT_NAMESPACE::__cxa_get_globals;
#else
using __cxxabiv1::__cxa_get_globals;
#endif

namespace
{
Expand Down Expand Up @@ -305,7 +314,7 @@ static void cpp_call(
catch (...)
{
// fill uno exception
fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
CPPU_CURRENT_NAMESPACE::fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );

// temporary params
for ( ; nTempIndizes--; )
Expand Down

0 comments on commit baf6650

Please sign in to comment.