summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-06-30 18:24:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-06-30 18:30:40 +0200
commit6bb92c5eaf1ff2f5292442870c65bfe2771752ec (patch)
tree0e1d73d1f0597e1ada3c860276f0c9dc9cd22349
parent358d6006f1d9652aaf01661ea8dba4d7ec46d508 (diff)
Make sure IMPL_STATIC_LINK's type matches Link::pFunc's type
...to avoid -fsanitize=function warnings in Link::Call. Change-Id: I837b35bd3052716fbb41bf4f893961257d1f9b2c
-rw-r--r--include/tools/link.hxx20
-rw-r--r--sfx2/source/appl/shutdownicon.hxx4
-rw-r--r--svl/source/numbers/zforlist.cxx2
3 files changed, 22 insertions, 4 deletions
diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index 951422203581..c603c0ea707e 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 d91ded524964..7483b71a8fa7 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 9dfe6138b364..020d84542753 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;