summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-01-26 15:39:06 -0800
committerMarc Mutz <marc.mutz@qt.io>2024-01-28 23:39:44 +0000
commitc1266c36353629e2253aa897dfc96d4fbbc8c5a3 (patch)
treeb9f59100c492d2276073ddec28b571c8dbcd3e09
parent8ed75d3a75a377bf7575c7af479bca68390fb4a5 (diff)
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.7 6.6 Change-Id: I5dd50a1a7ca5424d9e7afffd17ae0a09dc7dd8c1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/corelib/global/qtypes.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/global/qtypes.h b/src/corelib/global/qtypes.h
index 705de1a088..db9ba38e4c 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<type>(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