[glib: 2/3] gtester: Explicitly convert arguments of g_assert_cmpfloat()



commit 9e46b2ef113dc6e667a51b10042795f3036fdd86
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Jun 21 00:20:55 2018 -0700

    gtester: Explicitly convert arguments of g_assert_cmpfloat()
    
    Using g_assert_cmpfloat() with a float or double causes warnings on the
    newest Clang version, because the macro internally promotes all values to
    a long double, which Clang warns about. Casting explicitly removes the
    warning.
    
    Closes: #1377

 glib/gtestutils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gtestutils.h b/glib/gtestutils.h
index 02ab397b3..b247f2f3a 100644
--- a/glib/gtestutils.h
+++ b/glib/gtestutils.h
@@ -64,7 +64,7 @@ typedef void (*GTestFixtureFunc) (gpointer      fixture,
                                                  #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long 
double) __n2, 'x'); \
                                         } G_STMT_END
 #define g_assert_cmpfloat(n1,cmp,n2)    G_STMT_START { \
-                                             long double __n1 = (n1), __n2 = (n2); \
+                                             long double __n1 = (long double) (n1), __n2 = (long double) 
(n2); \
                                              if (__n1 cmp __n2) ; else \
                                                g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, 
G_STRFUNC, \
                                                  #n1 " " #cmp " " #n2, (long double) __n1, #cmp, (long 
double) __n2, 'f'); \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]