From 903bb7b22ebc90e430f02381dda6c31fdbea47a6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 2 Oct 2023 07:34:39 -0700 Subject: [PATCH] qC{Debug,Info,Warning,Critical}: add parentheses around macro argument Amends ef9fe7a99a9a6779e7133167fe84426bfe9cc371 and fixes some rare cases where the macro argument wasn't a single token, such as what was found in PySide code: qCDebug(*category, "%s", %2); Fixes: QTBUG-117153 Change-Id: I85599ea5ca7a4b79a8bbfffd178a51023648f244 Reviewed-by: Qt CI Bot Reviewed-by: Marc Mutz (cherry picked from commit 964b9d7cd4c344b34d999b4d7f5e8185d02d3dac) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 0088e32f8e6987384ebe0d083277d02c87cc8b63) --- src/corelib/io/qloggingcategory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h index 11d447958f1..7c32beea1aa 100644 --- a/src/corelib/io/qloggingcategory.h +++ b/src/corelib/io/qloggingcategory.h @@ -117,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__)