summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-06-16 10:51:41 +0200
committerLars Knoll <lars.knoll@qt.io>2020-06-17 22:05:21 +0200
commita42dd2ffe0565d827d1e06f79c4d0973fa5a71c7 (patch)
tree57660fa2300368731d9975612e2a5da79bb25dd1 /src/gui/math3d
parent4d90725e77a2a5d8171f84697031deb227f72917 (diff)
Cleanup float-equal warnings
Consistently use the macro from qcompilerdetection.h instead of manually disabling the warning for three different compilers. Change-Id: Id59d30047c8a504e1082d7e47c02f4746fddf9d6 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/gui/math3d')
-rw-r--r--src/gui/math3d/qmatrix4x4.h5
-rw-r--r--src/gui/math3d/qquaternion.h5
-rw-r--r--src/gui/math3d/qvector2d.h5
-rw-r--r--src/gui/math3d/qvector3d.h5
-rw-r--r--src/gui/math3d/qvector4d.h5
5 files changed, 10 insertions, 15 deletions
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 64bf9c607e..4f1a74a834 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -214,9 +214,8 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QMatrix4x4::Flags)
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
Q_DECLARE_TYPEINFO(QMatrix4x4, Q_MOVABLE_TYPE);
inline QMatrix4x4::QMatrix4x4
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index f01fab679e..f862e6174c 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -169,9 +169,8 @@ inline QQuaternion::QQuaternion() : wp(1.0f), xp(0.0f), yp(0.0f), zp(0.0f) {}
inline QQuaternion::QQuaternion(float aScalar, float xpos, float ypos, float zpos) : wp(aScalar), xp(xpos), yp(ypos), zp(zpos) {}
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
inline bool QQuaternion::isNull() const
{
return wp == 0.0f && xp == 0.0f && yp == 0.0f && zp == 0.0f;
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index cbce94c199..65ad2a3afd 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -205,9 +205,8 @@ inline QVector2D &QVector2D::operator/=(const QVector2D &vector)
}
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
Q_DECL_CONSTEXPR inline bool operator==(const QVector2D &v1, const QVector2D &v2)
{
return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1];
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index d7ffb0bcc4..9eb2e7e7e6 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -230,9 +230,8 @@ inline QVector3D &QVector3D::operator/=(const QVector3D &vector)
}
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
Q_DECL_CONSTEXPR inline bool operator==(const QVector3D &v1, const QVector3D &v2)
{
return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2];
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index afcc71fa88..495a0b7e23 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -230,9 +230,8 @@ inline QVector4D &QVector4D::operator/=(const QVector4D &vector)
}
QT_WARNING_PUSH
-QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
-QT_WARNING_DISABLE_GCC("-Wfloat-equal")
-QT_WARNING_DISABLE_INTEL(1572)
+QT_WARNING_DISABLE_FLOAT_COMPARE
+
Q_DECL_CONSTEXPR inline bool operator==(const QVector4D &v1, const QVector4D &v2)
{
return v1.v[0] == v2.v[0] && v1.v[1] == v2.v[1] && v1.v[2] == v2.v[2] && v1.v[3] == v2.v[3];