Kaydet (Commit) 6ab52cbb authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

reduce "no DbgTestSolarMutex function set" warning

Change-Id: I68c67e77a2759c8542dd4a44a78a9fcf8aa7dcc0
Reviewed-on: https://gerrit.libreoffice.org/26056Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 10aaf339
......@@ -39,21 +39,13 @@
typedef void (*DbgTestSolarMutexProc)();
// Dbg prototypes
#define DBG_FUNC_SETTESTSOLARMUTEX 2
#define DBG_FUNC_TESTSOLARMUTEX 3
TOOLS_DLLPUBLIC void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam );
TOOLS_DLLPUBLIC void DbgTestSolarMutex();
TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = nullptr );
inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc )
{
DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, reinterpret_cast<void*>(reinterpret_cast<sal_uIntPtr>(pProc)) );
}
#define DBG_TESTSOLARMUTEX() \
do \
{ \
DbgFunc(DBG_FUNC_TESTSOLARMUTEX); \
#define DBG_TESTSOLARMUTEX() \
do \
{ \
DbgTestSolarMutex(); \
} while(false)
#else
......
......@@ -47,35 +47,31 @@
struct DebugData
{
DbgTestSolarMutexProc pDbgTestSolarMutex;
bool bTestSolarMutexWasSet;
DebugData()
:pDbgTestSolarMutex( nullptr )
:pDbgTestSolarMutex( nullptr ), bTestSolarMutexWasSet(false)
{
}
};
static DebugData aDebugData;
void* DbgFunc( sal_uInt16 nAction, void* pParam )
void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam )
{
DebugData* pDebugData = &aDebugData;
switch ( nAction )
{
case DBG_FUNC_SETTESTSOLARMUTEX:
pDebugData->pDbgTestSolarMutex = reinterpret_cast<DbgTestSolarMutexProc>(reinterpret_cast<sal_uIntPtr>(pParam));
break;
case DBG_FUNC_TESTSOLARMUTEX:
SAL_WARN_IF(
pDebugData->pDbgTestSolarMutex == nullptr, "tools.debug",
"no DbgTestSolarMutex function set");
if ( pDebugData->pDbgTestSolarMutex )
pDebugData->pDbgTestSolarMutex();
break;
}
aDebugData.pDbgTestSolarMutex = pParam;
if (pParam)
aDebugData.bTestSolarMutexWasSet = true;
}
return nullptr;
void DbgTestSolarMutex()
{
// don't warn if it was set at least once, because then we're probably just post-DeInitVCL()
SAL_WARN_IF(
!aDebugData.bTestSolarMutexWasSet && aDebugData.pDbgTestSolarMutex == nullptr, "tools.debug",
"no DbgTestSolarMutex function set");
if ( aDebugData.pDbgTestSolarMutex )
aDebugData.pDbgTestSolarMutex();
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment