You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ji...@apache.org on 2020/12/10 21:46:35 UTC

[openoffice] branch AOO42X updated: Pull in some hints from FreeBSD, clang-wise.

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


The following commit(s) were added to refs/heads/AOO42X by this push:
     new 5212c07  Pull in some hints from FreeBSD, clang-wise.
     new 29e330b  Merge branch 'AOO42X' of https://gitbox.apache.org/repos/asf/openoffice into AOO42X
5212c07 is described below

commit 5212c076c3f52ea325e96b3a3a1ea406af69eb2b
Author: Jim Jagielski <ji...@gmail.com>
AuthorDate: Thu Dec 10 16:45:19 2020 -0500

    Pull in some hints from FreeBSD, clang-wise.
---
 .../source/cpp_uno/gcc3_macosx_x86-64/abi.cxx       |  2 +-
 .../source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx   | 16 ++++++++--------
 .../source/cpp_uno/gcc3_macosx_x86-64/except.cxx    |  6 ++----
 .../source/cpp_uno/gcc3_macosx_x86-64/share.hxx     | 21 +++++++++++++++------
 4 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx
index 201b119..877eac2 100644
--- a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx
+++ b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx
@@ -324,7 +324,7 @@ void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_
 
     n = classify_argument( pTypeRef, classes, 0 );
 
-    sal_uInt64 *pStructAlign = reinterpret_cast<sal_uInt64 *>( pStruct );
+    sal_uInt64 *pStructAlign = static_cast<sal_uInt64 *>( pStruct );
     for ( n--; n >= 0; n-- )
         switch ( classes[n] )
         {
diff --git a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
index 00f7085..5a8dc9a 100644
--- a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
+++ b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
@@ -102,12 +102,12 @@ static typelib_TypeClass cpp2uno_call(
 
 	// stack space
 	// parameters
-	void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
+	void ** pUnoArgs = static_cast<void **>(alloca( 4 * sizeof(void *) * nParams ));
 	void ** pCppArgs = pUnoArgs + nParams;
 	// indizes of values this have to be converted (interface conversion cpp<=>uno)
-	sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams));
+	sal_Int32 * pTempIndizes = reinterpret_cast<sal_Int32 *>(pUnoArgs + (2 * nParams));
 	// type descriptions for reconversions
-	typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
+	typelib_TypeDescription ** ppTempParamTypeDescr = reinterpret_cast<typelib_TypeDescription **>(pUnoArgs + (3 * nParams));
 	
 	sal_Int32 nTempIndizes = 0;
 
@@ -241,7 +241,7 @@ static typelib_TypeClass cpp2uno_call(
 				uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
 			}
 			// complex return ptr is set to return reg
-			*(void **)pRegisterReturn = pCppReturn;
+			*reinterpret_cast<void **>(pRegisterReturn) = pCppReturn;
 		}
 		if ( pReturnTypeDescr )
 		{
@@ -340,19 +340,19 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 				case 0: // queryInterface() opt
 				{
 					typelib_TypeDescription * pTD = 0;
-					TYPELIB_DANGER_GET( &pTD, reinterpret_cast<Type *>( gpreg[2] )->getTypeLibType() );
+					TYPELIB_DANGER_GET( &pTD, static_cast<Type *>( gpreg[2] )->getTypeLibType() );
 					if ( pTD )
 					{
 						XInterface * pInterface = 0;
 						(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
 							( pCppI->getBridge()->getCppEnv(),
-							  (void **)&pInterface,
+							  reinterpret_cast<void **>(&pInterface),
 							  pCppI->getOid().pData,
 							  reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD ) );
 
 						if ( pInterface )
 						{
-							::uno_any_construct( reinterpret_cast<uno_Any *>( gpreg[0] ),
+							::uno_any_construct( static_cast<uno_Any *>( gpreg[0] ),
 												 &pInterface, pTD, cpp_acquire );
 
 							pInterface->release();
@@ -455,7 +455,7 @@ unsigned char * codeSnippet( unsigned char * code,
         sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
         bool bHasHiddenParam ) SAL_THROW( () )
 {
-	sal_uInt64 nOffsetAndIndex = ( ( (sal_uInt64) nVtableOffset ) << 32 ) | ( (sal_uInt64) nFunctionIndex );
+	sal_uInt64 nOffsetAndIndex = ( static_cast<sal_uInt64>( nVtableOffset ) << 32 ) | static_cast<sal_uInt64>( nFunctionIndex );
 
 	if ( bHasHiddenParam )
 		nOffsetAndIndex |= 0x80000000;
diff --git a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
index 317e14a..bf62e2f 100644
--- a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
+++ b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
@@ -156,7 +156,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
         buf.append( 'E' );
         
         OString symName( buf.makeStringAndClear() );
-        rtti = (type_info *)dlsym( m_hApp, symName.getStr() );
+        rtti = static_cast<std::type_info *>(dlsym( m_hApp, symName.getStr() ));
 
         if (rtti)
         {
@@ -214,9 +214,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
 //--------------------------------------------------------------------------------------------------
 static void deleteException( void * pExc )
 {
-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
-    if( !header->exceptionType) // TODO: remove this when getRTTI() always returns non-NULL
-        return; // NOTE: leak for now
+    __cxa_exception const * header = static_cast<__cxa_exception const *>(pExc) - 1;
     typelib_TypeDescription * pTD = 0;
     OUString unoName( toUNOname( header->exceptionType->name() ) );
     ::typelib_typedescription_getByName( &pTD, unoName.pData );
diff --git a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
index 4fe21da..c248532 100644
--- a/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
+++ b/main/bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx
@@ -32,19 +32,28 @@ namespace CPPU_CURRENT_NAMESPACE
 
 void dummy_can_throw_anything( char const * );
 
+typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
+
 // ----- the following structure is compatible with the one declared in libunwind's unwind.h
+// (use forced types)
 
 struct _Unwind_Exception
 {
-    unsigned exception_class __attribute__((__mode__(__DI__)));
+    uint64_t exception_class;
     void * exception_cleanup;
-    unsigned private_1 __attribute__((__mode__(__word__)));
-    unsigned private_2 __attribute__((__mode__(__word__)));
-} __attribute__((__aligned__));
+    uintptr_t private_1;
+    uintptr_t private_2;
+};
 
 struct __cxa_exception
-{ 
-#if __LP64__ // ----- from libcxxabi/src/cxa_exception.hpp
+{
+#if __LP64__
+#if ( COM = CLANG ) && ( CCNUMVER >= 1000000000 )
+    // From LLVM 10 - Added reserved member at top of struct. Who the hell does that?
+    // https://reviews.llvm.org/rG674ec1eb16678b8addc02a4b0534ab383d22fa77
+    void *dummy;
+#endif
+    // ----- 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