Q_ASSERT_X: always consume where and what

Just like `cond` is always consumed to prevent -Wunused warnings,
do the same with `where` and `what`. They're not required to be
literals, but could be function locals that go unused otherwise.

Change-Id: I6b44108c2c040368319a85ec5f34d98930e0794c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2025-02-03 19:03:01 +01:00
parent 43cb7f93a4
commit 868645fd3b

View File

@ -41,7 +41,7 @@ void qt_assert_x(const char *where, const char *what, const char *file, int line
#if !defined(Q_ASSERT_X)
# if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
# define Q_ASSERT_X(cond, where, what) static_cast<void>(false && (cond))
# define Q_ASSERT_X(cond, where, what) static_cast<void>(false && (cond) && (where) && (what))
# else
# define Q_ASSERT_X(cond, where, what) ((cond) ? static_cast<void>(0) : qt_assert_x(where, what, __FILE__, __LINE__))
# endif