Commit 23dd8889 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Do better output for ENTER_FUNCTION

parent 30a1d0a2
......@@ -103,7 +103,7 @@ Q_LOGGING_CATEGORY(_41014, "krita.tabletlog")
const char* __methodName(const char *_prettyFunction)
QString __methodName(const char *_prettyFunction)
{
std::string prettyFunction(_prettyFunction);
......@@ -111,5 +111,5 @@ const char* __methodName(const char *_prettyFunction)
size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1;
size_t end = prettyFunction.rfind("(") - begin;
return std::string(prettyFunction.substr(begin,end) + "()").c_str();
return QString(std::string(prettyFunction.substr(begin,end) + "()").c_str());
}
......@@ -140,14 +140,6 @@ KRITAGLOBAL_EXPORT QString kisBacktrace();
*/
#define ppVar( var ) #var << "=" << var
#ifdef __GNUC__
#define ENTER_FUNCTION() qDebug() << "Entering" << __func__
#define LEAVE_FUNCTION() qDebug() << "Leaving " << __func__
#else
#define ENTER_FUNCTION() qDebug() << "Entering" << "<unknown>"
#define LEAVE_FUNCTION() qDebug() << "Leaving " << "<unknown>"
#endif
# ifndef QT_NO_DEBUG
# undef Q_ASSERT
# define Q_ASSERT(cond) if(!(cond)) { errKrita << kisBacktrace(); qt_assert(#cond,__FILE__,__LINE__); } qt_noop()
......@@ -155,7 +147,7 @@ KRITAGLOBAL_EXPORT QString kisBacktrace();
#ifdef __GNUC__
KRITAGLOBAL_EXPORT const char* __methodName(const char *prettyFunction);
KRITAGLOBAL_EXPORT QString __methodName(const char *prettyFunction);
#define __METHOD_NAME__ __methodName(__PRETTY_FUNCTION__)
#else
#define __METHOD_NAME__ "<unknown>:<unknown>"
......@@ -163,6 +155,14 @@ KRITAGLOBAL_EXPORT const char* __methodName(const char *prettyFunction);
#define PREPEND_METHOD(msg) QString("%1: %2").arg(__METHOD_NAME__).arg(msg)
#ifdef __GNUC__
#define ENTER_FUNCTION() qDebug() << "Entering" << __METHOD_NAME__
#define LEAVE_FUNCTION() qDebug() << "Leaving " << __METHOD_NAME__
#else
#define ENTER_FUNCTION() qDebug() << "Entering" << "<unknown>"
#define LEAVE_FUNCTION() qDebug() << "Leaving " << "<unknown>"
#endif
#include "kis_assert.h"
#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