[Libreoffice-commits] core.git: 4 commits - compilerplugins/clang cppu/source include/com sfx2/source

Stephan Bergmann sbergman at redhat.com
Mon Jan 5 08:26:33 PST 2015


 compilerplugins/clang/store/revisibility.cxx |   20 +++++++++++++++++++-
 cppu/source/cppu/cppu_opt.cxx                |    9 ++++++---
 cppu/source/threadpool/current.cxx           |    5 +++--
 include/com/sun/star/uno/Any.hxx             |    3 ++-
 include/com/sun/star/uno/Reference.hxx       |    5 +++--
 sfx2/source/appl/shutdownicon.hxx            |    3 ---
 sfx2/source/appl/shutdowniconunx.cxx         |   11 +++++++++--
 7 files changed, 42 insertions(+), 14 deletions(-)

New commits:
commit f569c4197c8e3d63ddd0e8c1f71cc5a6161b2fe5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 5 17:25:10 2015 +0100

    Improve loplugin:revisibility
    
    (for non-Windows--only code, as MSVC would complain about such cases anyway)
    
    Change-Id: Id6daf61b79bd31529bdaeb7c6df4f354731ae7d7

diff --git a/compilerplugins/clang/store/revisibility.cxx b/compilerplugins/clang/store/revisibility.cxx
index 11e3cc8..fec8ff7 100644
--- a/compilerplugins/clang/store/revisibility.cxx
+++ b/compilerplugins/clang/store/revisibility.cxx
@@ -41,11 +41,13 @@ bool ReVisibility::VisitFunctionDecl(FunctionDecl const * decl) {
     if (!ignoreLocation(decl) && hasExplicitVisibilityAttr(decl)
         && !isFriendDecl(decl))
     {
+        Decl const * first = nullptr;
         for (Decl const * p = decl;;) {
             p = p->getPreviousDecl();
             if (p == nullptr) {
                 break;
             }
+            first = p;
             if (hasExplicitVisibilityAttr(p) && !isFriendDecl(p)) {
                 report(
                     DiagnosticsEngine::Warning,
@@ -57,9 +59,25 @@ bool ReVisibility::VisitFunctionDecl(FunctionDecl const * decl) {
                     "Previous visibility declaration is here",
                     p->getAttr<VisibilityAttr>()->getLocation())
                     << p->getAttr<VisibilityAttr>()->getRange();
-                break;
+                return true;
             }
         }
+        if (decl->isThisDeclarationADefinition() && first != nullptr
+            && !(compiler.getSourceManager().getFilename(
+                     compiler.getSourceManager().getSpellingLoc(
+                         decl->getLocation()))
+                 .startswith(SRCDIR "/libreofficekit/")))
+        {
+            report(
+                DiagnosticsEngine::Warning,
+                "Visibility declaration on definition, not first declaration",
+                decl->getAttr<VisibilityAttr>()->getLocation())
+                << decl->getAttr<VisibilityAttr>()->getRange();
+            report(
+                DiagnosticsEngine::Note, "First declaration is here",
+                first->getLocation())
+                << first->getSourceRange();
+        }
     }
     return true;
 }
commit f627c122461de4dd4e75a995145e8838b1d9bf34
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 5 17:23:15 2015 +0100

    No need for declarations in include file
    
    ...of functions only accessed via dlopen
    
    Change-Id: I6b9998298fc6df68fb0d3003cef77a62ecef8976

diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx
index a36547e..6965f42 100644
--- a/sfx2/source/appl/shutdownicon.hxx
+++ b/sfx2/source/appl/shutdownicon.hxx
@@ -170,9 +170,6 @@ extern "C" {
     void aqua_init_systray();
     void aqua_shutdown_systray();
 #  endif
-    // external plugin systray impl.
-    void plugin_init_sys_tray();
-    void plugin_shutdown_sys_tray();
 }
 
 #endif
diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx
index 746819d..199674f 100644
--- a/sfx2/source/appl/shutdowniconunx.cxx
+++ b/sfx2/source/appl/shutdowniconunx.cxx
@@ -55,6 +55,13 @@
 
 using namespace ::osl;
 
+extern "C" {
+
+void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray();
+void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray();
+
+}
+
 static ResMgr *pVCLResMgr;
 static GtkStatusIcon* pTrayIcon;
 static GtkWidget *pExitMenuItem = NULL;
@@ -360,7 +367,7 @@ static void notify_file_changed(GFileMonitor * /*gfilemonitor*/, GFile * /*arg1*
 }
 #endif
 
-void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
+void plugin_init_sys_tray()
 {
     ::SolarMutexGuard aGuard;
 
@@ -411,7 +418,7 @@ void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
 #endif
 }
 
-void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
+void plugin_shutdown_sys_tray()
 {
     ::SolarMutexGuard aGuard;
     if( !pTrayIcon )
commit 64ccf3ff3059f81532c88f974bad7399cddc9898
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 5 17:21:40 2015 +0100

    Include function declarations
    
    Change-Id: Ib1ce66bf9ec71280409335c0a5022ecfe229f494

diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx
index 6c66320..b43de4c 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -24,6 +24,7 @@
 #include "osl/thread.h"
 #include "osl/mutex.hxx"
 
+#include "uno/current_context.hxx"
 #include "uno/environment.hxx"
 #include "uno/mapping.hxx"
 #include "typelib/typedescription.h"
@@ -182,7 +183,7 @@ IdContainer * getIdContainer()
 }
 
 
-extern "C" CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_setCurrentContext(
+extern "C" sal_Bool SAL_CALL uno_setCurrentContext(
     void * pCurrentContext,
     rtl_uString * pEnvTypeName, void * pEnvContext )
     SAL_THROW_EXTERN_C()
@@ -230,7 +231,7 @@ extern "C" CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_setCurrentContext(
     return sal_True;
 }
 
-extern "C" CPPU_DLLPUBLIC sal_Bool SAL_CALL uno_getCurrentContext(
+extern "C" sal_Bool SAL_CALL uno_getCurrentContext(
     void ** ppCurrentContext, rtl_uString * pEnvTypeName, void * pEnvContext )
     SAL_THROW_EXTERN_C()
 {
commit c662bf350f5a8f43daa38f0fbee11464604d1285
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 5 17:18:25 2015 +0100

    Mark function declarations as CPPU_DLLPUBLIC, not only definitions
    
    <http://msdn.microsoft.com/en-us/library/8fskxacy.aspx> "Importing into an
    Application Using __declspec(dllimport)":  "Using __declspec(dllimport) is
    optional on function declarations, but the compiler produces more efficient code
    if you use this keyword."
    
    Change-Id: I149306049987b2406622d7a0dc5dde92d283a5b3

diff --git a/cppu/source/cppu/cppu_opt.cxx b/cppu/source/cppu/cppu_opt.cxx
index 3344143..ac37da6 100644
--- a/cppu/source/cppu/cppu_opt.cxx
+++ b/cppu/source/cppu/cppu_opt.cxx
@@ -17,7 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
 #include "typelib/typedescription.h"
 #include "uno/any2.h"
 #include "rtl/ustrbuf.hxx"
@@ -26,7 +29,7 @@
 using namespace ::rtl;
 
 
-extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
+extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
     typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C()
 {
@@ -40,7 +43,7 @@ extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
 }
 
 
-extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
+extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
     typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C()
 {
@@ -54,7 +57,7 @@ extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
 }
 
 
-extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
+extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
     uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C()
 {
diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx
index 04d1274..9e9e7dc 100644
--- a/include/com/sun/star/uno/Any.hxx
+++ b/include/com/sun/star/uno/Any.hxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/genfunc.hxx>
 #include <com/sun/star/uno/RuntimeException.hpp>
+#include <cppu/cppudllapi.h>
 #include <cppu/unotype.hxx>
 
 namespace com
@@ -576,7 +577,7 @@ inline bool SAL_CALL operator != ( const Any & rAny, const C & value )
     return (! operator == ( rAny, value ));
 }
 
-extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
+extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg(
     uno_Any const * pAny, typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C();
 
diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx
index db489e5..456c35f 100644
--- a/include/com/sun/star/uno/Reference.hxx
+++ b/include/com/sun/star/uno/Reference.hxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/XInterface.hpp>
 #include <com/sun/star/uno/Any.hxx>
+#include <cppu/cppudllapi.h>
 
 namespace com
 {
@@ -56,10 +57,10 @@ inline XInterface * Reference< interface_type >::iquery(
 {
     return BaseReference::iquery(pInterface, interface_type::static_type());
 }
-extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
+extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg(
     typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C();
-extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
+extern "C" CPPU_DLLPUBLIC rtl_uString * SAL_CALL cppu_unsatisfied_iset_msg(
     typelib_TypeDescriptionReference * pType )
     SAL_THROW_EXTERN_C();
 


More information about the Libreoffice-commits mailing list