qC{Debug,Info,Warning,Critical}: move the function call to the macro
The change in commit 04ee5795cc was
source-incompatible if the function in question was a non-static member.
I could add a new, template constructor to catch those, but this is
simpler.
Fixes: QTBUG-115043
Pick-to: 6.5 6.6
Change-Id: I53335f845a1345299031fffd176f1071afbae7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
parent
5a523981f4
commit
ef9fe7a99a
|
|
@ -67,11 +67,6 @@ template <QtMsgType Which> struct QLoggingCategoryMacroHolder
|
|||
if (IsOutputEnabled)
|
||||
init(cat);
|
||||
}
|
||||
explicit QLoggingCategoryMacroHolder(QMessageLogger::CategoryFunction catfunc)
|
||||
{
|
||||
if (IsOutputEnabled)
|
||||
init(catfunc());
|
||||
}
|
||||
void init(const QLoggingCategory &cat) noexcept
|
||||
{
|
||||
category = &cat;
|
||||
|
|
@ -122,7 +117,7 @@ template <> const bool QLoggingCategoryMacroHolder<QtWarningMsg>::IsOutputEnable
|
|||
}
|
||||
|
||||
#define QT_MESSAGE_LOGGER_COMMON(category, level) \
|
||||
for (QLoggingCategoryMacroHolder<level> qt_category(category); qt_category; qt_category.control = false) \
|
||||
for (QLoggingCategoryMacroHolder<level> qt_category(category()); qt_category; qt_category.control = false) \
|
||||
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, qt_category.name())
|
||||
|
||||
#define qCDebug(category, ...) QT_MESSAGE_LOGGER_COMMON(category, QtDebugMsg).debug(__VA_ARGS__)
|
||||
|
|
|
|||
Loading…
Reference in New Issue