[Libreoffice-commits] core.git: compilerplugins/clang include/sal

Stephan Bergmann sbergman at redhat.com
Thu Feb 9 09:37:11 UTC 2017


 compilerplugins/clang/sallogareas.cxx |    2 +-
 include/sal/log.hxx                   |   16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 8458ec8c9c93c8b3a6045c2b45cecadd345bbf4d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Feb 9 10:35:20 2017 +0100

    Fix SAL_DEBUG_BACKTRACE
    
    ...after 56d071c10ca8016848f1f059aa3eb197fe928844 "rename SAL_DEBUG_TRACE to
    SAL_DEBUG_BACKTRACE" (looks like this doesn't get used much...)

diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx
index e0ccf0b..bde3513 100644
--- a/compilerplugins/clang/sallogareas.cxx
+++ b/compilerplugins/clang/sallogareas.cxx
@@ -84,7 +84,7 @@ bool SalLogAreas::VisitCallExpr( const CallExpr* call )
                          loc = source.getImmediateExpansionRange( loc ).first )
                         {
                         StringRef inMacro = Lexer::getImmediateMacroName( loc, source, compiler.getLangOpts());
-                        if( inMacro == "SAL_DEBUG" )
+                        if( inMacro == "SAL_DEBUG" || inMacro == "SAL_DEBUG_BACKTRACE" )
                             return true; // ok
                         }
                     report( DiagnosticsEngine::Warning, "missing log area",
diff --git a/include/sal/log.hxx b/include/sal/log.hxx
index ea070dd..b383fd0 100644
--- a/include/sal/log.hxx
+++ b/include/sal/log.hxx
@@ -54,6 +54,14 @@ inline void SAL_CALL log(
     sal_detail_log(level, area, where, stream.str().c_str());
 }
 
+inline void SAL_CALL log_backtrace(
+    sal_detail_LogLevel level, char const * area, char const * where,
+    std::ostringstream const & stream, int maxNoStackFramesToDisplay)
+{
+    sal_detail_log_backtrace(
+        level, area, where, stream.str().c_str(), maxNoStackFramesToDisplay);
+}
+
 // Special handling of the common case where the message consists of just a
 // string literal, to produce smaller call-site code:
 
@@ -357,12 +365,14 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
             ::sal_detail_log_backtrace( \
                 ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, \
                 ::sal::detail::unwrapStream( \
-                    ::sal::detail::StreamStart() << stream)); \
+                    ::sal::detail::StreamStart() << stream), \
+                maxNoStackFramesToDisplay); \
         } else { \
             ::std::ostringstream sal_detail_stream; \
             sal_detail_stream << stream; \
-            ::sal::detail::log( \
-                ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, sal_detail_stream); \
+            ::sal::detail::log_backtrace( \
+                ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, sal_detail_stream, \
+                maxNoStackFramesToDisplay); \
         } \
     } while (false)
 


More information about the Libreoffice-commits mailing list