forked from qt-creator/qt-creator
QTC_ASSERT: Enclose conditions with Q_LIKELY
Change-Id: I330f87c7a28747a7430c45a59ff010c891d071f0 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
dbe08fda37
commit
034c514c3a
@@ -37,6 +37,6 @@ namespace Utils { QTCREATOR_UTILS_EXPORT void writeAssertLocation(const char *ms
|
|||||||
// The 'do {...} while (0)' idiom is not used for the main block here to be
|
// The 'do {...} while (0)' idiom is not used for the main block here to be
|
||||||
// able to use 'break' and 'continue' as 'actions'.
|
// able to use 'break' and 'continue' as 'actions'.
|
||||||
|
|
||||||
#define QTC_ASSERT(cond, action) if (cond) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)
|
#define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)
|
||||||
#define QTC_CHECK(cond) if (cond) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0)
|
#define QTC_CHECK(cond) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0)
|
||||||
#define QTC_GUARD(cond) ((cond) ? true : (QTC_ASSERT_STRING(#cond), false))
|
#define QTC_GUARD(cond) ((Q_LIKELY(cond)) ? true : (QTC_ASSERT_STRING(#cond), false))
|
||||||
|
Reference in New Issue
Block a user