Revert "Logging: Don't use for loop in qCDebug macros"
The use of if {} else {} in the macro causes compiler warnings about "ambiguous 'else'" if qCDebug is used in an if / else without brackets. Revert to the for loop, but make the variable name less likely to clash. This reverts commit bab5f5873680aa3c5a22d94da112aafd2b0b53d3. Task-number: QTBUG-36605 Change-Id: Ie4b075b63b83b7f8a2ad61437b7bf3e6a6c0177a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
553c6416bb
commit
7d86eeb9d2
@ -97,13 +97,13 @@ private:
|
||||
#ifdef Q_COMPILER_VARIADIC_MACROS
|
||||
|
||||
#define qCDebug(category, ...) \
|
||||
if (!category().isDebugEnabled()) {} else \
|
||||
for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
|
||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
|
||||
#define qCWarning(category, ...) \
|
||||
if (!category().isWarningEnabled()) {} else \
|
||||
for (bool qt_category_enabled = category().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) \
|
||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
|
||||
#define qCCritical(category, ...) \
|
||||
if (!category().isCriticalEnabled()) {} else \
|
||||
for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \
|
||||
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user