This is an automated email from the ASF dual-hosted git repository. jim pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit a3aaa3158e09f64f0267f18c91a7408b3967df1c Author: Jim Jagielski <jim...@gmail.com> AuthorDate: Tue Feb 2 16:47:53 2021 -0500 some macOS improvements, mostly around Xcode issues --- .../source/cpp_uno/s5abi_macosx_x86-64/except.cxx | 25 +++++++++++++++------- .../source/cpp_uno/s5abi_macosx_x86-64/share.hxx | 25 ++++++---------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx index d26186b..1a424ed 100644 --- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx +++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx @@ -179,6 +179,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR const OString aCUnoName = OUStringToOString( unoName, RTL_TEXTENCODING_UTF8); OSL_TRACE( "TypeInfo for \"%s\" not found and cannot be generated.\n", aCUnoName.getStr()); #endif +#ifndef AOO_BYPASS_RTTI if (pTypeDescr->pBaseTypeDescription) { // ensure availability of base @@ -192,7 +193,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR // this class has no base class rtti = new __class_type_info( strdup( rttiName ) ); } - +#else + rtti = NULL; +#endif bool bOK = m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti )).second; OSL_ENSURE( bOK, "### inserting new generated rtti failed?!" ); } @@ -214,6 +217,15 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR static void deleteException( void * pExc ) { __cxa_exception const * header = static_cast<__cxa_exception const *>(pExc) - 1; + /* More __cxa_exception mumbo-jumbo. See share.hxx and fillUnoException() below */ + if (header->exceptionDestructor != &deleteException) + { + header = reinterpret_cast<__cxa_exception const *>(reinterpret_cast<char const *>(header) - 8); + } + if( !header->exceptionType) + { + return; // NOTE: leak for now + } typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); @@ -308,15 +320,12 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * on an earlier version (eg, community builds). In this situation the * reserved ptr doesn't exist in the struct returned and so the offsets * that header uses are wrong. This assumes that reserved isn't used - * and that referenceCount is always >0 in the cases we handle + * and that referenceCount is always >0 in the cases we handle. + * See share.hxx for the definition of __cxa_exception */ + if (*reinterpret_cast<void **>(header) == 0) { - // Does this look like the newer struct __cxa_exception? - // That is, is the 1st element NULL (*reserved)? - if (*reinterpret_cast<void **>(header) == 0) { - // Yes. So we move up a slot to offset - header = reinterpret_cast<__cxa_exception *>(reinterpret_cast<void **>(header) + 1); - } + header = reinterpret_cast<__cxa_exception *>(reinterpret_cast<char *>(header) + 8); } typelib_TypeDescription * pExcTypeDescr = 0; diff --git a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx index bed8a31..7d4361d 100644 --- a/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx +++ b/main/bridges/source/cpp_uno/s5abi_macosx_x86-64/share.hxx @@ -47,36 +47,25 @@ struct _Unwind_Exception struct __cxa_exception { -#if __LP64__ - // From LLVM 10 - Added reserved member at top of struct. Who the hell does that? - // https://reviews.llvm.org/rG674ec1eb16678b8addc02a4b0534ab383d22fa77 - // Sure would be nice to be able to test for CCNUMVER >= 1000000000 - // and COM == CLANG here. - // void *reserved; - // ----- from libcxxabi/src/cxa_exception.hpp - // This is a new field to support C++ 0x exception_ptr. - // For binary compatibility it is at the start of this - // struct which is prepended to the object thrown in - // __cxa_allocate_exception. - size_t referenceCount; + /* From LLVM 10 - Added reserved member at top of struct. Who the hell does that? + https://reviews.llvm.org/rG674ec1eb16678b8addc02a4b0534ab383d22fa77 + NOTE: Apple clang version != real LLVM version. Don't be fooled! + */ +#if 0 + void *reserved; #endif - + size_t referenceCount; ::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; - _Unwind_Exception unwindHeader; };