summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorAriya Hidayat <ariya.hidayat@nokia.com>2009-05-19 08:42:46 (GMT)
committerAriya Hidayat <ariya.hidayat@nokia.com>2009-05-19 10:03:55 (GMT)
commit30f7edc0aab629499b74263391ae529ad31b2ff8 (patch)
treecd2f8f7f3cac7d5c96d76fa412f54eae9f53653d /src/gui/painting
parentba5fb9f05c891feac8ab69006189de1aaafebc18 (diff)
downloadQt-30f7edc0aab629499b74263391ae529ad31b2ff8.zip
Qt-30f7edc0aab629499b74263391ae529ad31b2ff8.tar.gz
Qt-30f7edc0aab629499b74263391ae529ad31b2ff8.tar.bz2
Ignore GCC warning of unsafe floating point comparisons.
Due to optimizations, there are few cases where comparing with a constant is needed, e.g. in operator*=. G++ will give us a warning for this. Since we know what we are doing, surpress the warning. The only drawback for this workaround is if somebody includes qtransform.h in his code and disable the float-equal warning since the warning will be activated again. Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qtransform.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index c76409b..4ea1be3 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -255,6 +255,13 @@ inline qreal QTransform::dy() const
return affine._dy;
}
+#if defined(Q_CC_GNU)
+# define Q_CC_GNU_VERSION (((__GNUC__)<<16)|((__GNUC_MINOR__)<<8)|(__GNUC_PATCHLEVEL__))
+# if Q_CC_GNU_VERSION >= 0x040201
+# pragma GCC diagnostic ignored "-Wfloat-equal"
+# endif
+#endif
+
inline QTransform &QTransform::operator*=(qreal num)
{
if (num == 1.)
@@ -311,6 +318,13 @@ inline QTransform &QTransform::operator-=(qreal num)
return *this;
}
+#if defined(Q_CC_GNU_VERSION)
+# if Q_CC_GNU_VERSION >= 0x040201
+# pragma GCC diagnostic warning "-Wfloat-equal"
+# endif
+# undef Q_GCC_GNU_VERSION
+#endif
+
/****** stream functions *******************/
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &);