Hi, We had setup logging in Krita as follows:
kis_debug.h: extern const KRITAGLOBAL_EXPORT QLoggingCategory &_30009(); extern const KRITAGLOBAL_EXPORT QLoggingCategory &_41000(); extern const KRITAGLOBAL_EXPORT QLoggingCategory &_41001(); ... #define dbgResources qCDebug(_30009) #define dbgKrita qCDebug(_41000) #define dbgImage qCDebug(_41001) ... #define infoResources qCInfo(_30009) #define infoKrita qCInfo(_41000) #define infoImage qCInfo(_41001) kis_debug.cpp Q_LOGGING_CATEGORY(_30009, "krita.lib.resources", QtInfoMsg) Q_LOGGING_CATEGORY(_41000, "krita.general", QtInfoMsg) Q_LOGGING_CATEGORY(_41001, "krita.core", QtInfoMsg) And we'd use this like: dbgResources << "Skipping saving tag " << tag->name(false) << filename << tag->resourceType(); This works fine with Qt5, but with Q6 we get errors: n file included from /usr/include/x86_64-linux-gnu/qt6/QtCore/QLoggingCategory:1, from /home/halla/dev/krita/libs/global/kis_debug.h:10, from /home/halla/dev/krita/libs/global/kis_algebra_2d.cpp:11: /usr/include/x86_64-linux-gnu/qt6/QtGui/qvectornd.h: In function ‘constexpr QVector2D operator/(QVector2D, float)’: /home/halla/dev/krita/libs/global/kis_debug.h:102:18: error: variable ‘qt_category’ of non-literal type ‘{anonymous}::QLoggingCategoryMacroHolder<QtCriticalMsg>’ in ‘constexpr’ function 102 | #define errKrita qCCritical(_41000) | ^~~~~~~~~~ /usr/include/x86_64-linux-gnu/qt6/QtCore/qloggingcategory.h:60:35: note: ‘{anonymous}::QLoggingCategoryMacroHolder<QtCriticalMsg>’ is not literal because: 60 | template <QtMsgType Which> struct QLoggingCategoryMacroHolder | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ The Qt code changed from #if !defined(QT_NO_DEBUG_OUTPUT) # define qCDebug(category, ...) \ for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \ QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).debug(__VA_ARGS__) #else # define qCDebug(category, ...) QT_NO_QDEBUG_MACRO() #endif in Qt5 to #define QT_MESSAGE_LOGGER_COMMON(category, level) \ 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__) And I cannot figure out how to avoid that error other than replacing all our defines with literal calls to qCDebug(), which is going to be a huge diff. Does anyone have any idea? Halla #define QT_MESSAGE_LOGGER_COMMON(category, level) \ 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__)