From 34d1d7a85888c87b736fe545f4cb8c088b7320df Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Jan 2024 15:39:06 -0800 Subject: [PATCH] QT_C_STYLE_CAST: move the parentheses to the macro, in C mode Amends 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335. Right now it's no problem for the only two places we use it, but it could be a problem if someone accidentally forgot when using the macro. Pick-to: 6.6 Change-Id: I5dd50a1a7ca5424d9e7afffd17ae0a09dc7dd8c1 Reviewed-by: Marc Mutz Reviewed-by: Giuseppe D'Angelo (cherry picked from commit c1266c36353629e2253aa897dfc96d4fbbc8c5a3) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/global/qtypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qtypes.h b/src/corelib/global/qtypes.h index 705de1a0883..db9ba38e4cf 100644 --- a/src/corelib/global/qtypes.h +++ b/src/corelib/global/qtypes.h @@ -77,12 +77,12 @@ __extension__ typedef __uint128_t quint128; # ifdef __cplusplus /* need to avoid c-style-casts in C++ mode */ # define QT_C_STYLE_CAST(type, x) static_cast(x) # else /* but C doesn't have constructor-style casts */ -# define QT_C_STYLE_CAST(type, x) ((type)x) +# define QT_C_STYLE_CAST(type, x) ((type)(x)) # endif # ifndef Q_UINT128_MAX /* allow qcompilerdetection.h/user override */ # define Q_UINT128_MAX QT_C_STYLE_CAST(quint128, -1) # endif -# define Q_INT128_MAX QT_C_STYLE_CAST(qint128, (Q_UINT128_MAX / 2)) +# define Q_INT128_MAX QT_C_STYLE_CAST(qint128, Q_UINT128_MAX / 2) # define Q_INT128_MIN (-Q_INT128_MAX - 1) # ifdef __cplusplus