[Libreoffice-commits] core.git: include/tools sfx2/source svl/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 30 09:31:22 PDT 2014


 include/tools/link.hxx            |   20 ++++++++++++++++++--
 sfx2/source/appl/shutdownicon.hxx |    4 +++-
 svl/source/numbers/zforlist.cxx   |    2 +-
 3 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 6bb92c5eaf1ff2f5292442870c65bfe2771752ec
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 30 18:24:30 2014 +0200

    Make sure IMPL_STATIC_LINK's type matches Link::pFunc's type
    
    ...to avoid -fsanitize=function warnings in Link::Call.
    
    Change-Id: I837b35bd3052716fbb41bf4f893961257d1f9b2c

diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index 9514222..c603c0e 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -31,6 +31,7 @@ typedef long (*PSTUB)( void*, void* );
     static long LinkStub##Method( void* pThis, void* )
 
 #define DECL_STATIC_LINK( Class, Method, ArgType ) \
+    static long LinkStub##Method( void* pThis, void* ); \
     static long Method( Class*, ArgType )
 
 #define DECL_DLLPRIVATE_LINK(Method, ArgType) \
@@ -38,6 +39,7 @@ typedef long (*PSTUB)( void*, void* );
     SAL_DLLPRIVATE static long LinkStub##Method(void * pThis, void *)
 
 #define DECL_DLLPRIVATE_STATIC_LINK(Class, Method, ArgType) \
+    SAL_DLLPRIVATE static long LinkStub##Method( void* pThis, void* ); \
     SAL_DLLPRIVATE static long Method(Class *, ArgType)
 
 #define IMPL_STUB(Class, Method, ArgType) \
@@ -47,16 +49,30 @@ typedef long (*PSTUB)( void*, void* );
     }
 
 #define IMPL_STATIC_LINK( Class, Method, ArgType, ArgName ) \
+    long Class::LinkStub##Method( void* pThis, void* pCaller) \
+    { \
+        return Method( (Class*)pThis, (ArgType)pCaller ); \
+    } \
     long Class::Method( Class* pThis, ArgType ArgName )
 
 #define IMPL_STATIC_LINK_NOINSTANCE( Class, Method, ArgType, ArgName ) \
+    long Class::LinkStub##Method( void* pThis, void* pCaller) \
+    { \
+        return Method( (Class*)pThis, (ArgType)pCaller ); \
+    } \
     long Class::Method( SAL_UNUSED_PARAMETER Class*, ArgType ArgName )
 
+#define IMPL_STATIC_LINK_NOINSTANCE_NOARG( Class, Method ) \
+    long Class::LinkStub##Method( void* pThis, void* pCaller) \
+    { \
+        return Method( (Class*)pThis, pCaller ); \
+    } \
+    long Class::Method( SAL_UNUSED_PARAMETER Class*, SAL_UNUSED_PARAMETER void* )
+
 #define LINK( Inst, Class, Member ) \
     Link( (Class*)Inst, (PSTUB)&Class::LinkStub##Member )
 
-#define STATIC_LINK( Inst, Class, Member ) \
-    Link( (Class*)Inst, (PSTUB)&Class::Member )
+#define STATIC_LINK( Inst, Class, Member ) LINK(Inst, Class, Member)
 
 #define IMPL_LINK( Class, Method, ArgType, ArgName ) \
     IMPL_STUB( Class, Method, ArgType ) \
diff --git a/sfx2/source/appl/shutdownicon.hxx b/sfx2/source/appl/shutdownicon.hxx
index d91ded5..7483b71 100644
--- a/sfx2/source/appl/shutdownicon.hxx
+++ b/sfx2/source/appl/shutdownicon.hxx
@@ -33,6 +33,7 @@
 #include <sfx2/sfxuno.hxx>
 #include <cppuhelper/compbase4.hxx>
 #include <sfx2/dllapi.h>
+#include <tools/link.hxx>
 
 class ResMgr;
 namespace sfx2
@@ -125,7 +126,8 @@ class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase
 
         void                    StartFileDialog();
         sfx2::FileDialogHelper* GetFileDialog() const { return m_pFileDlg; }
-        static long DialogClosedHdl_Impl( ShutdownIcon*, sfx2::FileDialogHelper* );
+        DECL_STATIC_LINK(
+            ShutdownIcon, DialogClosedHdl_Impl, sfx2::FileDialogHelper*);
 
         static bool IsQuickstarterInstalled();
 
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 9dfe613..020d845 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3262,7 +3262,7 @@ const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry( const OUSt
 
 
 // static
-IMPL_STATIC_LINK_NOINSTANCE( SvNumberFormatter, CurrencyChangeLink, SAL_UNUSED_PARAMETER void*, EMPTYARG )
+IMPL_STATIC_LINK_NOINSTANCE_NOARG( SvNumberFormatter, CurrencyChangeLink )
 {
     ::osl::MutexGuard aGuard( GetMutex() );
     OUString aAbbrev;


More information about the Libreoffice-commits mailing list