bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx | 65 +++++++++++++++++++- gettext/makefile.mk | 3 2 files changed, 66 insertions(+), 2 deletions(-)
New commits: commit b94aa65357bb7c9e7da8ef3b4dc4ed98ab70ec2f Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Sep 29 17:33:27 2011 +0300 Fix gettext build against MacOSX SDK 10.7 diff --git a/gettext/makefile.mk b/gettext/makefile.mk index b6443f5..50d294f 100644 --- a/gettext/makefile.mk +++ b/gettext/makefile.mk @@ -47,7 +47,8 @@ GETTEXTVERSION=0.18.1.1 TARFILE_NAME=$(PRJNAME)-$(GETTEXTVERSION) TARFILE_MD5=3dd55b952826d2b32f51308f2f91aa89 -PATCH_FILES= +# see <https://savannah.gnu.org/bugs/index.php?33999> +PATCH_FILES=gettext-0.18.1.1.stpncpy.patch .IF "$(OS)"=="MACOSX" commit 229efd7754227277b9b4ec050783b7ca9b17b9a5 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Sep 29 15:51:54 2011 +0300 Make the C++/UNO bridge compile against the MacOSX 10.7 SDK Old work in progress by sberg, committed by tml. diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx index 888e6f8..b5ba92a 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_intel/except.cxx @@ -31,7 +31,11 @@ #include <stdio.h> #include <dlfcn.h> +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 #include <cxxabi.h> +#else +#include <typeinfo> +#endif #include <boost/unordered_map.hpp> #include <rtl/instance.hxx> @@ -52,12 +56,62 @@ using namespace ::std; using namespace ::osl; using namespace ::rtl; using namespace ::com::sun::star::uno; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 using namespace ::__cxxabiv1; - +#endif namespace CPPU_CURRENT_NAMESPACE { +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + +// MacOSX10.4u.sdk/usr/include/c++/4.0.0/cxxabi.h defined +// __cxxabiv1::__class_type_info and __cxxabiv1::__si_class_type_info but +// MacOSX10.7.sdk/usr/include/cxxabi.h no longer does, so instances of those +// classes need to be created manually: + +// std::type_info defined in <typeinfo> offers a protected ctor: +struct FAKE_type_info: public std::type_info { + FAKE_type_info(char const * name): type_info(name) {} +}; + +// Modeled after __cxxabiv1::__si_class_type_info defined in +// MacOSX10.4u.sdk/usr/include/c++/4.0.0/cxxabi.h (i.e., +// abi::__si_class_type_info documented at +// <http://www.codesourcery.com/public/cxx-abi/abi.html#rtti>): +struct FAKE_si_class_type_info: public FAKE_type_info { + FAKE_si_class_type_info(char const * name, std::type_info const * theBase): + FAKE_type_info(name), base(theBase) {} + + std::type_info const * base; + // actually a __cxxabiv1::__class_type_info pointer +}; + +struct Base {}; +struct Derived: Base {}; + +std::type_info * create_FAKE_class_type_info(char const * name) { + std::type_info * p = new FAKE_type_info(name); + // cxxabiv1::__class_type_info has no data members in addition to + // std::type_info + *reinterpret_cast< void ** >(p) = *reinterpret_cast< void * const * >( + &typeid(Base)); + // copy correct __cxxabiv1::__class_type_info vtable into place + return p; +} + +std::type_info * create_FAKE_si_class_type_info( + char const * name, std::type_info const * base) +{ + std::type_info * p = new FAKE_si_class_type_info(name, base); + *reinterpret_cast< void ** >(p) = *reinterpret_cast< void * const * >( + &typeid(Derived)); + // copy correct __cxxabiv1::__si_class_type_info vtable into place + return p; +} + +#endif + void dummy_can_throw_anything( char const * ) { } @@ -180,13 +234,22 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR // ensure availability of base type_info * base_rtti = getRTTI( (typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription ); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 rtti = new __si_class_type_info( strdup( rttiName ), (__class_type_info *)base_rtti ); +#else + rtti = create_FAKE_si_class_type_info( + strdup( rttiName ), base_rtti ); +#endif } else { // this class has no base class +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 rtti = new __class_type_info( strdup( rttiName ) ); +#else + rtti = create_FAKE_class_type_info( strdup( rttiName ) ); +#endif } pair< t_rtti_map::iterator, bool > insertion( _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits