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>
This commit is contained in:
Stephan Bergmann
2020-08-05 09:58:34 +02:00
parent ed3ccdbde9
commit 2e12d210ca
4 changed files with 17 additions and 8 deletions

View File

@@ -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",