]> granicus.if.org Git - gc/commitdiff
Remove unnecessary type casts of printf arguments to unsigned long
authorIvan Maidanski <ivmai@mail.ru>
Wed, 30 Aug 2017 07:00:46 +0000 (10:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 30 Aug 2017 07:00:46 +0000 (10:00 +0300)
(code refactoring)

* alloc.c [!NO_DEBUGGING] (GC_print_heap_sects): Remove unnecessary
cast to unsigned long in GC_*_printf call and adjust printf format
specifier to match the argument type.
* checksums.c [CHECKSUMS] (GC_checksum): Likewise.
* mark.c [PARALLEL_MARK] (GC_mark_local): Likewise.
* tests/test.c (typed_test): Likewise.
* checksums.c [CHECKSUMS] (GC_checksum): Change type of GC_n_clean,
GC_n_dirty from int to unsigned long.

alloc.c
checksums.c
mark.c
tests/test.c

diff --git a/alloc.c b/alloc.c
index c492f015a99c12f1f9d51c4adbceb9c98614eb59..619d0f25b94ccd0f82ac5f80f15506646c2f8958 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -1209,9 +1209,9 @@ GC_INNER void GC_add_to_heap(struct hblk *p, size_t bytes)
       for (h = (struct hblk *)start; (word)h < (word)(start + len); h++) {
         if (GC_is_black_listed(h, HBLKSIZE)) nbl++;
       }
-      GC_printf("Section %d from %p to %p %lu/%lu blacklisted\n",
+      GC_printf("Section %d from %p to %p %u/%lu blacklisted\n",
                 i, (void *)start, (void *)&start[len],
-                (unsigned long)nbl, (unsigned long)divHBLKSZ(len));
+                nbl, (unsigned long)divHBLKSZ(len));
     }
   }
 #endif
index 49120c39686c79a2035e046ca570804579dcf265..4847661a11083ae546434f6a875d1b4819cf9dd0 100644 (file)
@@ -93,8 +93,8 @@ STATIC word GC_checksum(struct hblk *h)
 int GC_n_dirty_errors = 0;
 int GC_n_faulted_dirty_errors = 0;
 int GC_n_changed_errors = 0;
-int GC_n_clean = 0;
-int GC_n_dirty = 0;
+unsigned long GC_n_clean = 0;
+unsigned long GC_n_dirty = 0;
 
 STATIC void GC_update_check_page(struct hblk *h, int index)
 {
@@ -199,14 +199,13 @@ void GC_check_dirty(void)
     }
 out:
     GC_COND_LOG_PRINTF("Checked %lu clean and %lu dirty pages\n",
-                       (unsigned long)GC_n_clean, (unsigned long)GC_n_dirty);
+                       GC_n_clean, GC_n_dirty);
     if (GC_n_dirty_errors > 0) {
         GC_err_printf("Found %d dirty bit errors (%d were faulted)\n",
                       GC_n_dirty_errors, GC_n_faulted_dirty_errors);
     }
     if (GC_n_changed_errors > 0) {
-        GC_err_printf("Found %lu changed bit errors\n",
-                      (unsigned long)GC_n_changed_errors);
+        GC_err_printf("Found %d changed bit errors\n", GC_n_changed_errors);
         GC_err_printf(
                 "These may be benign (provoked by nonpointer changes)\n");
 #       ifdef THREADS
diff --git a/mark.c b/mark.c
index b5368025d1c10479545805487cc7bd2875127581..607029c477883174ef3f6497a6291b2acb9e3861 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1114,7 +1114,7 @@ STATIC void GC_mark_local(mse *local_mark_stack, int id)
     GC_ASSERT((word)GC_mark_stack <= (word)my_first_nonempty);
     GC_ASSERT((word)my_first_nonempty
         <= (word)AO_load((volatile AO_t *)&GC_mark_stack_top) + sizeof(mse));
-    GC_VERBOSE_LOG_PRINTF("Starting mark helper %lu\n", (unsigned long)id);
+    GC_VERBOSE_LOG_PRINTF("Starting mark helper %d\n", id);
     GC_release_mark_lock();
     for (;;) {
         size_t n_on_stack;
@@ -1172,8 +1172,7 @@ STATIC void GC_mark_local(mse *local_mark_stack, int id)
                     /* both conditions actually held simultaneously.    */
                     GC_helper_count--;
                     if (0 == GC_helper_count) need_to_notify = TRUE;
-                    GC_VERBOSE_LOG_PRINTF("Finished mark helper %lu\n",
-                                          (unsigned long)id);
+                    GC_VERBOSE_LOG_PRINTF("Finished mark helper %d\n", id);
                     GC_release_mark_lock();
                     if (need_to_notify) GC_notify_all_marker();
                     return;
index 353d82bc05826702375aafa006a510403c843b9b..d002e3f245b5013251a6391294ab28f682797ec3 100644 (file)
@@ -1182,7 +1182,7 @@ void typed_test(void)
     }
     for (i = 0; i < 20000; i++) {
         if (new[0] != 17) {
-            GC_printf("typed alloc failed at %lu\n", (unsigned long)i);
+            GC_printf("Typed alloc failed at %d\n", i);
             FAIL;
         }
         new[0] = 0;