[glib: 1/2] tests: Fix a -Wbad-function-cast warning in the atomic tests



commit 21d1797a4f72b43ad2c2b71a55aa995978c47d62
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Aug 3 11:08:26 2018 +0100

    tests: Fix a -Wbad-function-cast warning in the atomic tests
    
    Assigning the gpointer return value from g_atomic_pointer_get() to a
    gsize variable was not making -Wbad-function-cast happy. Assign to an
    intermediate gpointer variable and then cast that instead.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://gitlab.gnome.org/GNOME/glib/issues/1475

 glib/tests/atomic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/atomic.c b/glib/tests/atomic.c
index 2aafe869f..84c13fb21 100644
--- a/glib/tests/atomic.c
+++ b/glib/tests/atomic.c
@@ -92,7 +92,8 @@ test_types (void)
   g_assert (ip == 0);
 
   g_atomic_pointer_set (&gs, 0);
-  gs2 = (gsize) g_atomic_pointer_get (&gs);
+  vp2 = g_atomic_pointer_get (&gs);
+  gs2 = (gsize) vp2;
   g_assert (gs2 == 0);
   res = g_atomic_pointer_compare_and_exchange (&gs, 0, 0);
   g_assert (res);


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