[Libreoffice-commits] core.git: compilerplugins/clang emfio/source vcl/inc vcl/skia

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 5 09:31:06 UTC 2020


 compilerplugins/clang/staticmethods.cxx |    4 ++++
 emfio/source/reader/emfreader.cxx       |    8 ++++----
 vcl/inc/skia/salbmp.hxx                 |    6 ++++--
 vcl/skia/gdiimpl.cxx                    |    7 +++++--
 4 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit 2e12d210cac8d031c21cdda9c37c1551f967ddc4
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Aug 5 09:58:34 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Aug 5 11:30:20 2020 +0200

    Silence loplugin:staticmethods when the definition involves preprocessing
    
    ...to help avoid false positives.  (Another option to silence such warnings is
    to add
    
      (void) this;
    
    to false-positive function bodies, but this new approach may be more natural in
    certain cases.)
    
    Change-Id: Ie6ea908730c596dbfb62ff42ae60dbd0a00a8fc9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100152
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index 9b631c7eb659..86206022496f 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -218,6 +218,10 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl)
         return true;
     }
 
+    if (containsPreprocessingConditionalInclusion((pCXXMethodDecl->getSourceRange()))) {
+        return true;
+    }
+
     report(
         DiagnosticsEngine::Warning,
         "this member function can be declared static",
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 5d2749d16356..8c128d2965c6 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -386,9 +386,11 @@ namespace emfio
     const sal_uInt32 EMR_COMMENT_ENDGROUP = 0x00000003;
     const sal_uInt32 EMR_COMMENT_MULTIFORMATS = 0x40000004;
     const sal_uInt32 EMR_COMMENT_WINDOWS_METAFILE = 0x80000001;
+#endif
 
     void EmfReader::ReadGDIComment(sal_uInt32 nCommentId)
     {
+#if OSL_DEBUG_LEVEL > 0
         sal_uInt32 nPublicCommentIdentifier;
         mpInputStream->ReadUInt32(nPublicCommentIdentifier);
 
@@ -442,12 +444,10 @@ namespace emfio
                 SAL_WARN("emfio", "\t\tEMR_COMMENT_PUBLIC not implemented, id: 0x" << std::hex << nCommentId << std::dec);
                 break;
         }
-    }
 #else
-    void EmfReader::ReadGDIComment(sal_uInt32)
-    {
-    }
+        (void) nCommentId;
 #endif
+    }
 
     void EmfReader::ReadEMFPlusComment(sal_uInt32 length, bool& bHaveDC)
     {
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index 3725c9f9a8ec..6ce94aad1b01 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -101,10 +101,12 @@ private:
     bool ComputeScanlineSize();
     void EraseInternal();
     SkBitmap GetAsSkBitmap() const;
+    void verify() const
 #ifdef DBG_UTIL
-    void verify() const;
+        ;
 #else
-    void verify() const {};
+    {
+    }
 #endif
 
     template <typename charT, typename traits>
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 066311e97c2b..c092bb549a22 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -176,17 +176,20 @@ public:
     }
 #ifndef NDEBUG
     virtual ~SkiaFlushIdle() { free(debugname); }
+#endif
     const char* get_debug_name(SkiaSalGraphicsImpl* pGraphics)
     {
+#ifndef NDEBUG
         // Idle keeps just a pointer, so we need to store the string
         debugname = strdup(
             OString("skia idle 0x" + OString::number(reinterpret_cast<sal_uIntPtr>(pGraphics), 16))
                 .getStr());
         return debugname;
-    }
 #else
-    const char* get_debug_name(SkiaSalGraphicsImpl*) { return "skia idle"; }
+        (void)pGraphics;
+        return "skia idle";
 #endif
+    }
 
     virtual void Invoke() override
     {


More information about the Libreoffice-commits mailing list