summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-05 09:58:34 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-05 11:30:20 +0200
commit2e12d210cac8d031c21cdda9c37c1551f967ddc4 (patch)
treefc65a051484b7eab2ad5132f18aa88187206cefa
parented3ccdbde9ace7d2e3d67a9cc83a189cfaf1cad9 (diff)
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@redhat.com>
-rw-r--r--compilerplugins/clang/staticmethods.cxx4
-rw-r--r--emfio/source/reader/emfreader.cxx8
-rw-r--r--vcl/inc/skia/salbmp.hxx6
-rw-r--r--vcl/skia/gdiimpl.cxx7
4 files changed, 17 insertions, 8 deletions
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
{