[Libreoffice-commits] .: oox/source sal/inc
Stephan Bergmann
sbergmann at kemper.freedesktop.org
Tue Nov 22 04:27:53 PST 2011
oox/source/core/xmlfilterbase.cxx | 1
sal/inc/osl/diagnose.h | 5 +-
sal/inc/sal/log.h | 81 +++++++++++++++++---------------------
3 files changed, 41 insertions(+), 46 deletions(-)
New commits:
commit 981470b2404a80ed87f237a0e8a62cdef7cea9a5
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 22 13:24:27 2011 +0100
Base SAL_INFO/WARN inclusion on if instead of #if.
So that variables only used within SAL_INFO/WARN do not lead to
unused variable warnings in product builds. Also for OSL_TRACE
(which used to work that way before already); allowing to revert
a recent warning fix.
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 1ffe56a..b0486f6 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -665,7 +665,6 @@ XmlFilterBase& XmlFilterBase::exportDocumentProperties( Reference< XDocumentProp
? OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr()
: "<unconvertable>",
OUStringToOString( aValue.getValueTypeName(), RTL_TEXTENCODING_UTF8 ).getStr());
- (void) bHaveString; // avoid warnings
}
}
return *this;
diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
index 8e889ac..0e1fc44 100644
--- a/sal/inc/osl/diagnose.h
+++ b/sal/inc/osl/diagnose.h
@@ -145,13 +145,14 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf
#define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s)
+#define OSL_TRACE(...) \
+ SAL_INFO_IF(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
+
#if OSL_DEBUG_LEVEL > 0
-#define OSL_TRACE(...) SAL_INFO("legacy.osl", __VA_ARGS__)
#define OSL_ASSERT(c) SAL_WARN_IF(!(c), "legacy.osl", "OSL_ASSERT")
#define OSL_ENSURE(c, m) SAL_WARN_IF(!(c), "legacy.osl", "%s", m)
#define OSL_FAIL(m) SAL_WARN_IF(sal_True, "legacy.osl", "%s", m)
#else
-#define OSL_TRACE(...) ((void) 0)
#define OSL_ASSERT(c) ((void) 0)
#define OSL_ENSURE(c, m) ((void) 0)
#define OSL_FAIL(m) ((void) 0)
diff --git a/sal/inc/sal/log.h b/sal/inc/sal/log.h
index 9e15560..d63ed6b 100644
--- a/sal/inc/sal/log.h
+++ b/sal/inc/sal/log.h
@@ -121,6 +121,18 @@ inline void SAL_CALL log(
#endif
+/** @internal */
+#if defined SAL_LOG_INFO
+#define SAL_DETAIL_ENABLE_LOG_INFO sal_True
+#else
+#define SAL_DETAIL_ENABLE_LOG_INFO sal_False
+#endif
+#if defined SAL_LOG_WARN
+#define SAL_DETAIL_ENABLE_LOG_WARN sal_True
+#else
+#define SAL_DETAIL_ENABLE_LOG_WARN sal_False
+#endif
+
/** A simple macro to create a "file and line number" string.
Potentially not only useful within the log framework (where it is used
@@ -240,64 +252,47 @@ inline void SAL_CALL log(
@since LibreOffice 3.5
*/
-#if defined SAL_LOG_INFO
-
#define SAL_INFO(area, ...) \
SAL_DETAIL_LOG_FORMAT( \
- sal_True, SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, __VA_ARGS__)
+ SAL_DETAIL_ENABLE_LOG_INFO, SAL_DETAIL_LOG_LEVEL_INFO, area, \
+ SAL_WHERE, __VA_ARGS__)
+
#define SAL_INFO_IF(condition, area, ...) \
SAL_DETAIL_LOG_FORMAT( \
- condition, SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, __VA_ARGS__)
-
-#if defined __cplusplus
-#define SAL_INFO_S(area, stream) \
- SAL_DETAIL_LOG_STREAM( \
- true, ::SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, stream)
-#define SAL_INFO_IF_S(condition, area, stream) \
- SAL_DETAIL_LOG_STREAM( \
- condition, ::SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, stream)
-#endif
-
-#else
-
-#define SAL_INFO(area, format, ...) ((void) 0)
-#define SAL_INFO_IF(condition, area, format, ...) ((void) 0)
-
-#if defined __cplusplus
-#define SAL_INFO_S(area, stream) ((void) 0)
-#define SAL_INFO_IF_S(condition, area, stream) ((void) 0)
-#endif
-
-#endif
-
-#if defined SAL_LOG_WARN
+ SAL_DETAIL_ENABLE_LOG_INFO && (condition), SAL_DETAIL_LOG_LEVEL_INFO, \
+ area, SAL_WHERE, __VA_ARGS__)
#define SAL_WARN(area, ...) \
SAL_DETAIL_LOG_FORMAT( \
- sal_True, SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, __VA_ARGS__)
+ SAL_DETAIL_ENABLE_LOG_WARN, SAL_DETAIL_LOG_LEVEL_WARN, area, \
+ SAL_WHERE, __VA_ARGS__)
+
#define SAL_WARN_IF(condition, area, ...) \
SAL_DETAIL_LOG_FORMAT( \
- condition, SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, __VA_ARGS__)
+ SAL_DETAIL_ENABLE_LOG_WARN && (condition), SAL_DETAIL_LOG_LEVEL_WARN, \
+ area, SAL_WHERE, __VA_ARGS__)
#if defined __cplusplus
-#define SAL_WARN_S(area, stream) \
- SAL_DETAIL_LOG_STREAM( \
- true, ::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
-#define SAL_WARN_IF_S(condition, area, stream) \
- SAL_DETAIL_LOG_STREAM( \
- condition, ::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
-#endif
-#else
+#define SAL_INFO_S(area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_INFO, ::SAL_DETAIL_LOG_LEVEL_INFO, area, \
+ SAL_WHERE, stream)
-#define SAL_WARN(area, format, ...) ((void) 0)
-#define SAL_WARN_IF(condition, area, format, ...) ((void) 0)
+#define SAL_INFO_IF_S(condition, area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_INFO && (condition), \
+ ::SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, stream)
-#if defined __cplusplus
-#define SAL_WARN_S(area, stream) ((void) 0)
-#define SAL_WARN_IF_S(condition, area, stream) ((void) 0)
-#endif
+#define SAL_WARN_S(area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_WARN, ::SAL_DETAIL_LOG_LEVEL_WARN, area, \
+ SAL_WHERE, stream)
+#define SAL_WARN_IF_S(condition, area, stream) \
+ SAL_DETAIL_LOG_STREAM( \
+ SAL_DETAIL_ENABLE_LOG_WARN && (condition), \
+ ::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
#endif
#endif
More information about the Libreoffice-commits
mailing list