[glib: 3/6] tests: Add an assertion to avoid a scan-build warning




commit 12f87089284d92c6dc08393fd51219a9f7fff532
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Oct 14 13:06:34 2020 +0100

    tests: Add an assertion to avoid a scan-build warning
    
    This should avoid the warning:
    ```
    ../../../glib/tests/mainloop.c:119:3: warning: Value stored to 'id' is never read
      id = g_source_attach (source, ctx);
      ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ```
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/tests/mainloop.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index 1368e9bc0..ec96bfa8a 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -121,6 +121,7 @@ test_maincontext_basic (void)
   g_source_set_funcs (source, &funcs);
   g_source_set_callback (source, cb, data, NULL);
   id = g_source_attach (source, ctx);
+  g_assert_cmpint (id, >, 0);
   g_source_unref (source);
   g_assert_true (g_source_remove_by_user_data (data));
   g_assert_false (g_source_remove_by_user_data ((gpointer)0x1234));


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