From 2e70ca4847552c878fbc8e34e54b67d6baaabb13 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Jul 2023 12:47:45 -0700 Subject: [PATCH] qC{Debug,Info,Warning,Critical}: move the function call to the macro The change in commit 04ee5795cc31ee81fb0c27bf55d9e8f662995753 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 Change-Id: I53335f845a1345299031fffd176f1071afbae7a9 Reviewed-by: Volker Hilsheimer (cherry picked from commit ef9fe7a99a9a6779e7133167fe84426bfe9cc371) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/io/qloggingcategory.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 5e0082e2aaf..11d447958f1 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -67,11 +67,6 @@ template 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::IsOutputEnable } #define QT_MESSAGE_LOGGER_COMMON(category, level) \ - for (QLoggingCategoryMacroHolder qt_category(category); qt_category; qt_category.control = false) \ + for (QLoggingCategoryMacroHolder 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__)