From 6e3424ca1131fe371f63e456267de476b5eb0eae Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 2 Jan 2021 11:03:12 +0100 Subject: Fix some warnings for Raspberry pi 4 (part2) Fix these kinds: /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:103:10: error: externally available entity 'is_complex_struct' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external] bool is_complex_struct(const typelib_TypeDescription * type) ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:129:10: error: externally available entity 'is_float_only_struct' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external] bool is_float_only_struct(const typelib_TypeDescription * type) ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:168:6: error: externally available entity 'MapReturn' is not previously declared in an included file (if it is only used in this translation unit, make it static; otherwise, provide a declaration of it in an included file) [loplugin:external] void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * pReturnType, sal_uInt32* pRegisterReturn) /home/pi/lo/libreoffice/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx:446:32: error: static_cast from 'void **' to 'sal_Int32 *' (aka 'long *') is not allowed sal_Int32 * pTempIndices = static_cast(pCppArgs + nParams); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ or some of these: In file included from /home/pi/lo/libreoffice/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c:26: /usr/lib/jvm/java-11-openjdk-armhf/include/jni.h:1945:1: error: unknown attribute 'externally_visible' ignored [-Werror,-Wunknown-attributes] _JNI_IMPORT_OR_EXPORT_ jint JNICALL ^ /usr/lib/jvm/java-11-openjdk-armhf/include/jni.h:1943:32: note: expanded from macro '_JNI_IMPORT_OR_EXPORT_' define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT ^ /usr/lib/jvm/java-11-openjdk-armhf/include/linux/jni_md.h:35:42: note: expanded from macro 'JNIIMPORT' define JNIIMPORT __attribute__((externally_visible,visibility("default"))) Change-Id: I7cae1c52ee10306da666c9c234b9af7248efd04e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108567 Tested-by: Julien Nabet Reviewed-by: Julien Nabet --- bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx | 2 +- bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx | 40 +++++++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) (limited to 'bridges') diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx index 9a59044ba8b3..7abaed395488 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx @@ -28,7 +28,7 @@ #include #include -#include "cppinterfaceproxy.hxx" +#include #include #include diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index 8a455ad2d072..bed9d7a0af96 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -100,7 +100,7 @@ using namespace ::com::sun::star::uno; namespace arm { - bool is_complex_struct(const typelib_TypeDescription * type) + static bool is_complex_struct(const typelib_TypeDescription * type) { const typelib_CompoundTypeDescription * p = reinterpret_cast< const typelib_CompoundTypeDescription * >(type); @@ -126,7 +126,7 @@ namespace arm } #ifdef __ARM_PCS_VFP - bool is_float_only_struct(const typelib_TypeDescription * type) + static bool is_float_only_struct(const typelib_TypeDescription * type) { const typelib_CompoundTypeDescription * p = reinterpret_cast< const typelib_CompoundTypeDescription * >(type); @@ -165,7 +165,7 @@ namespace arm } } -void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * pReturnType, sal_uInt32* pRegisterReturn) +static void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * pReturnType, sal_uInt32* pRegisterReturn) { switch( pReturnType->eTypeClass ) { @@ -187,8 +187,11 @@ void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * #if !defined(__ARM_PCS_VFP) && (defined(__ARM_EABI__) || defined(__SOFTFP__)) pRegisterReturn[0] = r0; #else - register float fret asm = "s0"; - *(float*)pRegisterReturn = fret; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wuninitialized" + register float fret asm("s0"); + *reinterpret_cast(pRegisterReturn) = fret; +#pragma clang diagnostic pop #endif break; case typelib_TypeClass_DOUBLE: @@ -196,8 +199,11 @@ void MapReturn(sal_uInt32 r0, sal_uInt32 r1, typelib_TypeDescriptionReference * pRegisterReturn[1] = r1; pRegisterReturn[0] = r0; #else - register double dret asm= "d0"; - *(double*)pRegisterReturn = dret; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wuninitialized" + register double dret asm("d0"); + *reinterpret_cast(pRegisterReturn) = dret; +#pragma clang diagnostic pop #endif break; case typelib_TypeClass_STRUCT: @@ -245,7 +251,7 @@ void callVirtualMethod( { // 8-bytes aligned sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 8; - sal_uInt32 *stack = (sal_uInt32 *) __builtin_alloca( nStackBytes ); + sal_uInt32 *stack = static_cast(__builtin_alloca( nStackBytes * sizeof(sal_uInt32))); memcpy( stack, pStack, nStackBytes ); } @@ -253,9 +259,9 @@ void callVirtualMethod( if ( nGPR > arm::MAX_GPR_REGS ) nGPR = arm::MAX_GPR_REGS; - sal_uInt32 pMethod = *((sal_uInt32*)pThis); + sal_uInt32 pMethod = *static_cast(pThis); pMethod += 4 * nVtableIndex; - pMethod = *((sal_uInt32 *)pMethod); + pMethod = *reinterpret_cast(pMethod); //Return registers sal_uInt32 r0; @@ -286,7 +292,7 @@ void callVirtualMethod( : [pmethod]"m" (pMethod), [pgpr]"m" (pGPR), [pfpr]"m" (pFPR) : "r0", "r1", "r2", "r3", "r4", "r5"); - MapReturn(r0, r1, pReturnType, (sal_uInt32*)pRegisterReturn); + MapReturn(r0, r1, pReturnType, static_cast(pRegisterReturn)); } } @@ -381,7 +387,7 @@ void callVirtualMethod( namespace { -static void cpp_call( +void cpp_call( bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, bridges::cpp_uno::shared::VtableSlot aVtableSlot, typelib_TypeDescriptionReference * pReturnTypeRef, @@ -389,8 +395,8 @@ static void cpp_call( void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc ) { // max space for: [complex ret ptr], values|ptr ... - sal_uInt32 * pStack = (sal_uInt32 *)__builtin_alloca( - sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) ); + sal_uInt32 * pStack = static_cast(__builtin_alloca( + sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) )); sal_uInt32 * pStackStart = pStack; sal_uInt32 pGPR[arm::MAX_GPR_REGS]; @@ -435,11 +441,11 @@ static void cpp_call( // stack space static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args - void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); + void ** pCppArgs = static_cast(alloca( 3 * sizeof(void *) * nParams )); // indices of values this have to be converted (interface conversion cpp<=>uno) - sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams); + sal_Int32 * pTempIndices = reinterpret_cast(pCppArgs + nParams); // type descriptions for reconversions - typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams)); + typelib_TypeDescription ** ppTempParamTypeDescr = reinterpret_cast(pCppArgs + (2 * nParams)); sal_Int32 nTempIndices = 0; -- cgit