[Libreoffice-commits] core.git: bean/native bridges/source include/jvmaccess include/jvmfwk javaunohelper/source jurt/source jvmfwk/plugins

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 2 10:41:23 UTC 2021


 bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c        |   10 ++
 bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx                   |    2 
 bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx                   |   40 +++++-----
 include/jvmaccess/classpath.hxx                                     |    7 +
 include/jvmaccess/virtualmachine.hxx                                |    7 +
 include/jvmfwk/framework.hxx                                        |    7 +
 javaunohelper/source/preload.cxx                                    |    7 +
 jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c |    8 ++
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx                 |    8 ++
 9 files changed, 78 insertions(+), 18 deletions(-)

New commits:
commit 6e3424ca1131fe371f63e456267de476b5eb0eae
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Jan 2 11:03:12 2021 +0100
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Sat Jan 2 11:40:47 2021 +0100

    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<sal_Int32 *>(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 <serval2412 at yahoo.fr>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c b/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c
index 069bb1ee050e..f908d8f63c90 100644
--- a/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c
+++ b/bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c
@@ -23,10 +23,20 @@
 #include <X11/Xutil.h>
 #include <X11/Intrinsic.h>
 
+// to deal with gcc specific attribute "externally_visible" used in
+// /usr/lib/jvm/java-11-openjdk-armhf/include/linux/jni_md.h:35
+// via /usr/lib/jvm/java-11-openjdk-armhf/include/jni.h
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
 
 #include <jawt_md.h>
 #include <jawt.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
 
 #include <sal/types.h>
 
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 <typelib/typedescription.hxx>
 
 #include <bridge.hxx>
-#include "cppinterfaceproxy.hxx"
+#include <cppinterfaceproxy.hxx>
 #include <types.hxx>
 #include <vtablefactory.hxx>
 
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<float *>(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<double *>(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<sal_uInt32 *>(__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<sal_uInt32 *>(pThis);
     pMethod += 4 * nVtableIndex;
-    pMethod = *((sal_uInt32 *)pMethod);
+    pMethod = *reinterpret_cast<sal_uInt32 *>(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<sal_uInt32*>(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<sal_uInt32 *>(__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<void **>(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<sal_Int32 *>(pCppArgs + nParams);
     // type descriptions for reconversions
-    typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
+    typelib_TypeDescription ** ppTempParamTypeDescr = reinterpret_cast<typelib_TypeDescription **>(pCppArgs + (2 * nParams));
 
     sal_Int32 nTempIndices   = 0;
 
diff --git a/include/jvmaccess/classpath.hxx b/include/jvmaccess/classpath.hxx
index d1e1c658a44c..80da5cb3c36a 100644
--- a/include/jvmaccess/classpath.hxx
+++ b/include/jvmaccess/classpath.hxx
@@ -22,7 +22,14 @@
 
 #include <sal/config.h>
 
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
 
 #include <jvmaccess/jvmaccessdllapi.h>
 #include <rtl/ustring.hxx>
diff --git a/include/jvmaccess/virtualmachine.hxx b/include/jvmaccess/virtualmachine.hxx
index a95668cdfa32..22b224e348b6 100644
--- a/include/jvmaccess/virtualmachine.hxx
+++ b/include/jvmaccess/virtualmachine.hxx
@@ -24,7 +24,14 @@
 #include <rtl/ref.hxx>
 #include <salhelper/simplereferenceobject.hxx>
 
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
 
 namespace jvmaccess
 {
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index 8b2e36e935fc..8f7eb8a2ad29 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -30,7 +30,14 @@
 #include <jvmfwk/jvmfwkdllapi.hxx>
 #include <rtl/byteseq.hxx>
 #include <rtl/ustring.hxx>
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
 
 /** @file
     <p>This library can operate in two modes, application mode and direct mode.</p>
diff --git a/javaunohelper/source/preload.cxx b/javaunohelper/source/preload.cxx
index 4868a1e55f5e..f73b44b34647 100644
--- a/javaunohelper/source/preload.cxx
+++ b/javaunohelper/source/preload.cxx
@@ -19,7 +19,14 @@
 
 #include <sal/config.h>
 
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
 
 #include <rtl/ustring.hxx>
 #include <osl/module.hxx>
diff --git a/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c b/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c
index 9b7806b8a07a..58e6185614f2 100644
--- a/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c
+++ b/jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c
@@ -21,7 +21,15 @@
 
 #include <stdlib.h>
 
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
 #include <osl/security.h>
 #include <osl/pipe.h>
 
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index ee0a1ec81fa7..5df7ef298795 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -54,7 +54,15 @@
 #include <setjmp.h>
 #include <signal.h>
 
+#if defined __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-attributes"
+#endif
 #include <jni.h>
+#if defined __clang__
+#pragma clang diagnostic pop
+#endif
+
 #include <rtl/byteseq.hxx>
 #include <fwkbase.hxx>
 #include <elements.hxx>


More information about the Libreoffice-commits mailing list