[glib: 7/15] Fix signedness warnings in glib/tests/markup-subparser.c




commit 7ea05283acf5def437a576983c5920d34e9cbeb8
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Sun Nov 8 21:40:43 2020 +0100

    Fix signedness warnings in glib/tests/markup-subparser.c
    
    glib/tests/markup-subparser.c: In function ‘main’:
    glib/tests/markup-subparser.c:362:24: error: comparison of integer expressions of different signedness: 
‘int’ and ‘long unsigned int’
      362 |          __add_tests_i < G_N_ELEMENTS (array);                          \
          |                        ^
    glib/tests/markup-subparser.c:378:3: note: in expansion of macro ‘add_tests’
      378 |   add_tests (test, "/glib/markup/subparser/success", test_cases);
          |   ^~~~~~~~~
    glib/tests/markup-subparser.c:362:24: error: comparison of integer expressions of different signedness: 
‘int’ and ‘long unsigned int’
      362 |          __add_tests_i < G_N_ELEMENTS (array);                          \
          |                        ^
    glib/tests/markup-subparser.c:379:3: note: in expansion of macro ‘add_tests’
      379 |   add_tests (test, "/glib/markup/subparser/failure", error_cases);
          |   ^~~~~~~~~

 glib/tests/markup-subparser.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/glib/tests/markup-subparser.c b/glib/tests/markup-subparser.c
index d1ceffb00..41eb06c14 100644
--- a/glib/tests/markup-subparser.c
+++ b/glib/tests/markup-subparser.c
@@ -356,7 +356,7 @@ TestCase error_cases[] = /* error cases */
 
 #define add_tests(func, basename, array) \
   G_STMT_START { \
-    int __add_tests_i;                                                  \
+    gsize __add_tests_i;                                                \
                                                                         \
     for (__add_tests_i  = 0;                                            \
          __add_tests_i < G_N_ELEMENTS (array);                          \
@@ -364,7 +364,8 @@ TestCase error_cases[] = /* error cases */
       {                                                                 \
         char *testname;                                                 \
                                                                         \
-        testname = g_strdup_printf ("%s/%d", basename, __add_tests_i);  \
+        testname = g_strdup_printf ("%s/%" G_GSIZE_FORMAT,              \
+                                    basename, __add_tests_i);           \
         g_test_add_data_func (testname, &array[__add_tests_i], func);   \
         g_free (testname);                                              \
       }                                                                 \


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