Mark qFuzzy* and qIsNull as Q_REQUIRED_RESULT
Calling them and not using the return value makes no sense. And it's even worse -- in autotests people might call those functions without wrapping them in QVERIFY(), effectively not testing anything. Change-Id: I2c90d1c85963ff1f35f00653d536a9252c2fcc48 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>bb10
parent
2e9345b627
commit
4fbe3eb2a8
|
|
@ -681,11 +681,13 @@ typedef void (*QFunctionPointer)();
|
|||
# define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO)
|
||||
#endif
|
||||
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT;
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
|
||||
{
|
||||
return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
|
||||
}
|
||||
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT;
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
|
||||
{
|
||||
return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
|
||||
|
|
@ -694,6 +696,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
|
|||
/*!
|
||||
\internal
|
||||
*/
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT;
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
|
||||
{
|
||||
return qAbs(d) <= 0.000000000001;
|
||||
|
|
@ -702,6 +705,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
|
|||
/*!
|
||||
\internal
|
||||
*/
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT;
|
||||
Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
|
||||
{
|
||||
return qAbs(f) <= 0.00001f;
|
||||
|
|
@ -712,6 +716,7 @@ Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
|
|||
check whether the actual value is 0 or close to 0, but whether
|
||||
it is binary 0, disregarding sign.
|
||||
*/
|
||||
static inline bool qIsNull(double d) Q_REQUIRED_RESULT;
|
||||
static inline bool qIsNull(double d)
|
||||
{
|
||||
union U {
|
||||
|
|
@ -728,6 +733,7 @@ static inline bool qIsNull(double d)
|
|||
check whether the actual value is 0 or close to 0, but whether
|
||||
it is binary 0, disregarding sign.
|
||||
*/
|
||||
static inline bool qIsNull(float f) Q_REQUIRED_RESULT;
|
||||
static inline bool qIsNull(float f)
|
||||
{
|
||||
union U {
|
||||
|
|
|
|||
Loading…
Reference in New Issue