From 0c7bff02710f8ad7915e215f723b6abad0079221 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 23 Nov 2011 15:45:43 +0100 Subject: Changed sal/log.h -> sal/log.hxx, drop _S from C++ streaming log macros. A compile time check ensures the common case of streaming just a plain C-style string literal still produces reasonably compact call-site code. The format-string variants are still available in sal/detail/log.h, but only to be used in obsolete osl/diagnose.h etc., and going to be removed again eventually. --- tools/inc/tools/debug.hxx | 31 +++++++++++++++++-------------- tools/source/debug/debug.cxx | 16 ++++++++-------- tools/source/rc/resmgr.cxx | 4 ++-- 3 files changed, 27 insertions(+), 24 deletions(-) (limited to 'tools') diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx index 95b320979913..ecbfa3b07e8d 100644 --- a/tools/inc/tools/debug.hxx +++ b/tools/inc/tools/debug.hxx @@ -31,7 +31,7 @@ #include "tools/toolsdllapi.h" -#include +#include #include #include @@ -40,7 +40,7 @@ if an assertion fails, and is controlled by the standard NDEBUG macro). Logging of warnings (e.g., about malformed input) and traces (e.g., about steps taken while executing some protocol) should use the facilities - provided by sal/log.h. + provided by sal/log.hxx. Because the assertion macros (DBG_ASSERTWARNING, DBG_ASSERT, DBG_BF_ASSERT) have been used for true assertions as well as for logged warnings, they map @@ -467,33 +467,36 @@ public: (const void*)pObj, (DbgUsr)fTest ) #define DBG_ASSERTWARNING( sCon, aWarning ) \ - SAL_WARN_IF(!(sCon), "legacy.tools", aWarning) + SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", aWarning) #define DBG_ASSERT( sCon, aError ) \ - SAL_WARN_IF(!(sCon), "legacy.tools", aError) + SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", aError) #ifdef DBG_BINFILTER #define DBG_BF_ASSERT( sCon, aError ) \ - SAL_WARN_IF(!(sCon), "legacy.binfilter", aError) + SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.binfilter", aError) #else #define DBG_BF_ASSERT( sCon, aError ) ((void)0) #endif -#define DBG_WARNING( aWarning ) SAL_WARN("legacy.tools", aWarning) -#define DBG_WARNING1( aWarning, x1 ) SAL_WARN("legacy.tools", aWarning, x1) +#define DBG_WARNING( aWarning ) \ + SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning) +#define DBG_WARNING1( aWarning, x1 ) \ + SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1) #define DBG_WARNING2( aWarning, x1, x2 ) \ - SAL_WARN("legacy.tools", aWarning, x1, x2) + SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2) #define DBG_WARNING3( aWarning, x1, x2, x3 ) \ - SAL_WARN("legacy.tools", aWarning, x1, x2, x3) + SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2, x3) #define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) \ - SAL_WARN("legacy.tools", aWarning, x1, x2, x3, x4) + SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2, x3, x4) #define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) \ - SAL_WARN("legacy.tools", aWarning, x1, x2, x3, x4, x5) -#define DBG_WARNINGFILE( aWarning ) \ - SAL_WARN("legacy.tools", aWarning, __FILE__, __LINE__) + SAL_DETAIL_WARN_IF_FORMAT( \ + true, "legacy.tools", aWarning, x1, x2, x3, x4, x5) +#define DBG_WARNINGFILE( aWarning ) SAL_DETAIL_WARN_IF_FORMAT( \ + true, "legacy.tools", aWarning, __FILE__, __LINE__) #define DBG_ERRORFILE( aError ) \ - SAL_WARN("legacy.tools", aError, __FILE__, __LINE__) + SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aError, __FILE__, __LINE__) #define DBG_TESTSOLARMUTEX() \ do \ diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index d3f2c088b897..091f459b2319 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -50,7 +50,7 @@ #include #include -#include +#include #include #include @@ -1334,7 +1334,7 @@ void DbgProf( sal_uInt16 nAction, DbgDataType* pDbgData ) sal_uIntPtr nTime; if ( (nAction != DBG_PROF_START) && !pProfData ) { - SAL_WARN_S( + SAL_WARN( "tools.debug", "DBG_PROF...() without DBG_PROFSTART(): " << pDbgData->pName); return; @@ -1454,7 +1454,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, sal_uInt16 nAct = nAction & ~DBG_XTOR_DTOROBJ; - SAL_INFO_IF_S( + SAL_INFO_IF( ((pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE) && !(nAction & DBG_XTOR_DTOROBJ) && nAct != DBG_XTOR_CHKOBJ), "tools.debug", @@ -1468,7 +1468,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, // DBG_CTOR-Aufruf vor allen anderen DBG_XTOR-Aufrufen if ( ((nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR) && !pDbgData->pData ) { - SAL_WARN_S( + SAL_WARN( "tools.debug", "DBG_DTOR() or DBG_CHKTHIS() without DBG_CTOR(): " << pDbgData->pName); @@ -1484,7 +1484,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, // This-Pointer == NULL if ( !pThis ) { - SAL_WARN_S( + SAL_WARN( "tools.debug", "this == NULL in class " << pDbgData->pName); return; @@ -1492,7 +1492,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, if ( (nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR ) { - SAL_WARN_IF_S( + SAL_WARN_IF( !pXtorData->aThisList.IsIn(pThis), "tools.debug", "invalid this-Pointer %p in class " << pDbgData->pName); } @@ -1558,13 +1558,13 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, } // Gegebenenfalls Fehlermeldung ausgeben - SAL_WARN_IF_S( + SAL_WARN_IF( pMsg, "tools.debug", "Error-Msg from Object " << pThis << " in class " << pDbgData->pName << ": " << pMsg); } - SAL_INFO_IF_S( + SAL_INFO_IF( ((pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE) && (nAction & DBG_XTOR_DTOROBJ) && nAct != DBG_XTOR_CHKOBJ), "tools.debug", diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 2ea66b2dce7d..93b8ea133aaf 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include @@ -949,7 +949,7 @@ void ResMgr::Init( const OUString& rFileName ) InternalResMgr::FreeGlobalRes( aResHandle, pVoid ); else { - SAL_WARN_S("tools", "Wrong version: " << pImpRes->aFileName); + SAL_WARN("tools", "Wrong version: " << pImpRes->aFileName); } } #endif -- cgit