Make Q_ASSERT_X also check its argument for validity
Commitebef2ad136
did it for Q_ASSERT, but I somehow forgot to do it for Q_ASSERT_X. Do it now. This includes the fix from9a3d7adaad
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:
parent
e5e1e056e8
commit
6025c36d01
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user