[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Tue Jun 9 03:44:57 PDT 2015


 compilerplugins/clang/unreffun.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 623359af236ab8497d4fac34e112a8b9b7b291f2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 9 12:44:12 2015 +0200

    loplugin:unreffun: workaround for visibility-adding redecls
    
    Change-Id: Ic18b44942f4fe02083c0e8167e8c8d4205e66abf

diff --git a/compilerplugins/clang/unreffun.cxx b/compilerplugins/clang/unreffun.cxx
index 3b9c616..5295ca4 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -87,6 +87,17 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) {
     {
         Decl const * prev = getPreviousNonFriendDecl(decl);
         if (prev != nullptr/* && prev != decl->getPrimaryTemplate()*/) {
+            // Workaround for redeclarations that introduce visiblity attributes
+            // (as is done with
+            //
+            //  SAL_DLLPUBLIC_EXPORT GType lok_doc_view_get_type();
+            //
+            // in libreofficekit/source/gtk/lokdocview.cxx):
+            if (decl->getAttr<VisibilityAttr>() != nullptr
+                && prev->getAttr<VisibilityAttr>() == nullptr)
+            {
+                return true;
+            }
             report(
                 DiagnosticsEngine::Warning,
                 "redundant function%0 redeclaration", decl->getLocation())


More information about the Libreoffice-commits mailing list