Make Q_ASSERT_X also check its argument for validity

Commit ebef2ad136 did it for Q_ASSERT, but
I somehow forgot to do it for Q_ASSERT_X. Do it now.

This includes the fix from 9a3d7adaad to
silence a Clang warning.

Change-Id: Iee8cbc07c4434ce9b560ffff13ca066a5b5ab5d4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2015-03-09 20:48:05 -07:00
parent e5e1e056e8
commit 6025c36d01
2 changed files with 1 additions and 2 deletions

View File

@ -1164,7 +1164,6 @@
const bool valueOfExpression = Expr;\ const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\ Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\ Q_ASSUME_IMPL(valueOfExpression);\
Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\
} while (0) } while (0)

View File

@ -681,7 +681,7 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
#if !defined(Q_ASSERT_X) #if !defined(Q_ASSERT_X)
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) # if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
# define Q_ASSERT_X(cond, where, what) qt_noop() # define Q_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
# else # else
# define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop()) # define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
# endif # endif