From fb5976038162d93d60c7f76376bbb4df38e83ba9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Sep 2017 00:02:16 -0700 Subject: Fix GCC -Wfloat-conversion warnings (available since GCC 4.9) This warning used to be part of -Wconversion, but that generates too more noise than we're willing to fix now (like conversion from qint64 to int). The float conversion does trigger for conversion from double to float, as shown in all the QVectorND uses of float, but more importantly, it triggers on passing floats to ints. Change-Id: I69f37f9304f24709a823fffd14e69cfd33f75988 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qfloat16.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/global/qfloat16.h') diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h index 89a62a93db..10598adb1d 100644 --- a/src/corelib/global/qfloat16.h +++ b/src/corelib/global/qfloat16.h @@ -167,7 +167,8 @@ inline qfloat16 operator/(qfloat16 a, qfloat16 b) Q_DECL_NOTHROW { return qfloat inline FP operator OP(qfloat16 lhs, FP rhs) Q_DECL_NOTHROW { return static_cast(lhs) OP rhs; } \ inline FP operator OP(FP lhs, qfloat16 rhs) Q_DECL_NOTHROW { return lhs OP static_cast(rhs); } #define QF16_MAKE_ARITH_OP_EQ_FP(FP, OP_EQ, OP) \ - inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) Q_DECL_NOTHROW { lhs = qfloat16(static_cast(lhs) OP rhs); return lhs; } + inline qfloat16& operator OP_EQ(qfloat16& lhs, FP rhs) Q_DECL_NOTHROW \ + { lhs = qfloat16(float(static_cast(lhs) OP rhs)); return lhs; } #define QF16_MAKE_ARITH_OP(FP) \ QF16_MAKE_ARITH_OP_FP(FP, +) \ QF16_MAKE_ARITH_OP_FP(FP, -) \ -- cgit v1.2.3