Use Q_UNLIKELY in qCDebug, qCTrace

By default debug, trace is disabled, so this can be marked as unlikely.

Change-Id: I221a688c953c1ff1fdfda65d2d99457785d3ff47
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Kai Koehne 2013-10-18 14:43:27 +02:00 committed by The Qt Project
parent f18fd0450c
commit f0625d2b88

View File

@ -154,7 +154,7 @@ private:
}
#define qCDebug(category) \
for (bool enabled = category().isDebugEnabled(); enabled; enabled = false) \
for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug()
#define qCWarning(category) \
for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \
@ -163,7 +163,7 @@ private:
for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical()
#define qCTrace(category) \
for (bool enabled = category.isTraceEnabled(); enabled; enabled = false) \
for (bool enabled = category.isTraceEnabled(); Q_UNLIKELY(enabled); enabled = false) \
QTraceGuard(category)