From 034c514c3afca55f42863b1fd60563fda676ec7d Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 5 Jan 2019 22:29:40 +0200 Subject: [PATCH] QTC_ASSERT: Enclose conditions with Q_LIKELY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I330f87c7a28747a7430c45a59ff010c891d071f0 Reviewed-by: André Hartmann Reviewed-by: Eike Ziller --- src/libs/utils/qtcassert.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/utils/qtcassert.h b/src/libs/utils/qtcassert.h index bf4b28ba4d5..8fa9d4de11d 100644 --- a/src/libs/utils/qtcassert.h +++ b/src/libs/utils/qtcassert.h @@ -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 // 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_CHECK(cond) if (cond) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0) -#define QTC_GUARD(cond) ((cond) ? true : (QTC_ASSERT_STRING(#cond), false)) +#define QTC_ASSERT(cond, action) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0) +#define QTC_CHECK(cond) if (Q_LIKELY(cond)) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0) +#define QTC_GUARD(cond) ((Q_LIKELY(cond)) ? true : (QTC_ASSERT_STRING(#cond), false))