summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-02-03 16:30:26 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-04 11:34:42 +0100
commit2edf3ba5a718415e5a9a327156289bed4484cdea (patch)
tree414b4f6ccd1f4850044355d145d229ad65951669 /src/corelib
parent6d48df83ab48e9d2ce4cfd2a2a223951996befbe (diff)
Logging: Don't use for loop in qCDebug macros
The local 'enabled' variable might cause dubious MSVC warnings if a local variable name 'enabled' exists. Just replace the whole loop with the if (...); else idiom, as Thiago once suggested on the mailing list. Task-number: QTBUG-36605 Change-Id: I0b8959a29d4432296961493fe2b7827c5b860d00 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qloggingcategory.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 1e8823e92b..37735908a1 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -97,13 +97,13 @@ private:
#ifdef Q_COMPILER_VARIADIC_MACROS
#define qCDebug(category, ...) \
- for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \
+ if (!category().isDebugEnabled()) {} else \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
#define qCWarning(category, ...) \
- for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \
+ if (!category().isWarningEnabled()) {} else \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
#define qCCritical(category, ...) \
- for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \
+ if (!category().isCriticalEnabled()) {} else \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
#else