From 868645fd3be039e37c96315059ab0b851d022bf4 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 3 Feb 2025 19:03:01 +0100 Subject: [PATCH] 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 --- src/corelib/global/qassert.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qassert.h b/src/corelib/global/qassert.h index 388932a8f7f..bfdd69815a3 100644 --- a/src/corelib/global/qassert.h +++ b/src/corelib/global/qassert.h @@ -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(false && (cond)) +# define Q_ASSERT_X(cond, where, what) static_cast(false && (cond) && (where) && (what)) # else # define Q_ASSERT_X(cond, where, what) ((cond) ? static_cast(0) : qt_assert_x(where, what, __FILE__, __LINE__)) # endif