]> granicus.if.org Git - gc/commitdiff
Adjust GC_log_printf format specifiers (regarding signed/unsigned long)
authorIvan Maidanski <ivmai@mail.ru>
Sat, 28 Jan 2012 18:33:58 +0000 (22:33 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 28 Jan 2012 18:33:58 +0000 (22:33 +0400)
* alloc.c (GC_maybe_gc, GC_expand_hp_inner): Change printf "%ld"
format specifier to "%lu" one according to printed value.
* backgraph.c (GC_print_back_graph_stats): Likewise.
* blacklst.c (GC_default_print_heap_obj_proc,
GC_promote_black_lists): Likewise.
* gcj_mlc.c (GC_debug_gcj_malloc): Likewise.
* mark_rts.c (GC_print_static_roots): Likewise.
* alloc.c (GC_stopped_mark): Correct logged GC number.
* dbg_mlc.c (GC_print_backtrace): Cast printed value to proper type.
* mark.c (GC_mark_from): Likewise.
* dbg_mlc.c (GC_debug_malloc, GC_debug_malloc_ignore_off_page,
GC_debug_malloc_atomic_ignore_off_page, GC_debug_malloc_stubborn,
GC_debug_malloc_atomic, GC_debug_malloc_uncollectable): Change printf
"%ld" format specifier for line number to "%d" one.
* malloc.c (GC_free): Improve logged message (if LOG_ALLOCS).
* thread_local_alloc.c (GC_malloc): Likewise.
* os_dep.c (GC_dirty_init): Improve logged message (for VERBOSE level).

alloc.c
backgraph.c
blacklst.c
dbg_mlc.c
gcj_mlc.c
malloc.c
mark.c
mark_rts.c
os_dep.c
thread_local_alloc.c

diff --git a/alloc.c b/alloc.c
index 360463af487e77c2629716166ebac76d08ea94d5..2d6d6bf6059e1d3c3bd21c347b2684d862539ce6 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -365,8 +365,8 @@ STATIC void GC_maybe_gc(void)
           if (GC_need_full_gc || n_partial_gcs >= GC_full_freq) {
             if (GC_print_stats) {
               GC_log_printf(
-                  "***>Full mark for collection %lu after %ld allocd bytes\n",
-                  (unsigned long)GC_gc_no + 1, (long)GC_bytes_allocd);
+                "***>Full mark for collection %lu after %lu allocd bytes\n",
+                (unsigned long)GC_gc_no + 1, (unsigned long)GC_bytes_allocd);
             }
             GC_promote_black_lists();
             (void)GC_reclaim_all((GC_stop_func)0, TRUE);
@@ -646,7 +646,7 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
     if (GC_print_stats) {
       GC_log_printf("Collection %lu reclaimed %ld bytes ---> heapsize = %lu"
                     " bytes" IF_USE_MUNMAP(" (%lu unmapped)") "\n",
-                    (unsigned long)(GC_gc_no - 1), (long)GC_bytes_found,
+                    (unsigned long)GC_gc_no, (long)GC_bytes_found,
                     (unsigned long)GC_heapsize /*, */
                     COMMA_IF_USE_MUNMAP((unsigned long)GC_unmapped_bytes));
     }
@@ -1135,7 +1135,7 @@ GC_INNER GC_bool GC_expand_hp_inner(word n)
     GC_add_to_our_memory((ptr_t)space, bytes);
     if (space == 0) {
         if (GC_print_stats) {
-            GC_log_printf("Failed to expand heap by %ld bytes\n",
+            GC_log_printf("Failed to expand heap by %lu bytes\n",
                           (unsigned long)bytes);
         }
         return(FALSE);
index cd2fdcd27204af2634649ca09a7f07260013af1a..6090f8d2269638deb6f25c866f372fa852618921 100644 (file)
@@ -458,7 +458,7 @@ GC_INNER void GC_traverse_back_graph(void)
 
 void GC_print_back_graph_stats(void)
 {
-  GC_printf("Maximum backwards height of reachable objects at GC %lu is %ld\n",
+  GC_printf("Maximum backwards height of reachable objects at GC %lu is %lu\n",
             (unsigned long) GC_gc_no, (unsigned long)GC_max_height);
   if (GC_max_height > GC_max_max_height) {
     GC_max_max_height = GC_max_height;
index 9fd00167f206fec15af2c9f51ef9eaf39d1fdfd3..234aae75943e8ab870a703ef057914f44e2ee9f9 100644 (file)
@@ -57,8 +57,8 @@ STATIC void GC_clear_bl(word *);
 GC_INNER void GC_default_print_heap_obj_proc(ptr_t p)
 {
     ptr_t base = GC_base(p);
-    GC_err_printf("start: %p, appr. length: %ld", base,
-                  (unsigned long)GC_size(base));
+    GC_err_printf("start: %p, appr. length: %lu",
+                  base, (unsigned long)GC_size(base));
 }
 
 GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc;
@@ -142,7 +142,7 @@ GC_INNER void GC_promote_black_lists(void)
     GC_incomplete_stack_bl = very_old_stack_bl;
     GC_total_stack_black_listed = total_stack_black_listed();
     if (GC_print_stats == VERBOSE)
-        GC_log_printf("%ld bytes in heap blacklisted for interior pointers\n",
+        GC_log_printf("%lu bytes in heap blacklisted for interior pointers\n",
                       (unsigned long)GC_total_stack_black_listed);
     if (GC_total_stack_black_listed != 0) {
         GC_black_list_spacing =
index f061236dbae20432c214710a4d3f44f085b816af..daf8d23baf95bee114c284e95fc83188cfcb727a 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
           GC_err_printf("list of finalizable objects\n\n");
           goto out;
         case GC_REFD_FROM_HEAP:
-          GC_err_printf("offset %ld in object:\n", (unsigned long)offset);
+          GC_err_printf("offset %ld in object:\n", (long)offset);
           /* Take GC_base(base) to get real base, i.e. header. */
           GC_print_heap_obj(GC_base(base));
           GC_err_printf("\n");
@@ -470,7 +470,7 @@ GC_API void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
         GC_err_printf("GC_debug_malloc(%lu) returning NULL (",
                       (unsigned long) lb);
         GC_err_puts(s);
-        GC_err_printf(":%ld)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
@@ -489,7 +489,7 @@ GC_API void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb,
         GC_err_printf("GC_debug_malloc_ignore_off_page(%lu) returning NULL (",
                        (unsigned long) lb);
         GC_err_puts(s);
-        GC_err_printf(":%lu)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
@@ -508,7 +508,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb,
         GC_err_printf("GC_debug_malloc_atomic_ignore_off_page(%lu)"
                       " returning NULL (", (unsigned long)lb);
         GC_err_puts(s);
-        GC_err_printf(":%lu)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
@@ -562,7 +562,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb,
         GC_err_printf("GC_debug_malloc(%lu) returning NULL (",
                       (unsigned long) lb);
         GC_err_puts(s);
-        GC_err_printf(":%lu)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
@@ -628,7 +628,7 @@ GC_API void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
         GC_err_printf("GC_debug_malloc_atomic(%lu) returning NULL (",
                       (unsigned long) lb);
         GC_err_puts(s);
-        GC_err_printf(":%lu)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
@@ -711,7 +711,7 @@ GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb,
         GC_err_printf("GC_debug_malloc_uncollectable(%lu) returning NULL (",
                       (unsigned long) lb);
         GC_err_puts(s);
-        GC_err_printf(":%lu)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
@@ -733,7 +733,7 @@ GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb,
                 "GC_debug_malloc_atomic_uncollectable(%lu) returning NULL (",
                 (unsigned long) lb);
         GC_err_puts(s);
-        GC_err_printf(":%lu)\n", (unsigned long)i);
+        GC_err_printf(":%d)\n", i);
         return(0);
     }
     if (!GC_debugging_started) {
index 5bbcbc690500fa336b1850fff7b4e23b7f5cdbcb..a749c622a5fde3af828f609489becd2b3fa44513 100644 (file)
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -219,7 +219,7 @@ GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb,
     if (result == 0) {
         GC_oom_func oom_fn = GC_oom_fn;
         UNLOCK();
-        GC_err_printf("GC_debug_gcj_malloc(%ld, %p) returning NULL (",
+        GC_err_printf("GC_debug_gcj_malloc(%lu, %p) returning NULL (",
                       (unsigned long)lb, ptr_to_struct_containing_descr);
         GC_err_puts(s);
         GC_err_printf(":%d)\n", i);
index 1400fc32ec6892c3d446b7ddd75afd88e7bd9065..28ad8a93bf0486ca316a67d8567906e3919e3d26 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -451,7 +451,7 @@ GC_API void GC_CALL GC_free(void * p)
     if (p == 0) return;
         /* Required by ANSI.  It's not my fault ...     */
 #   ifdef LOG_ALLOCS
-      GC_err_printf("GC_free(%p): %lu\n", p, (unsigned long)GC_gc_no);
+      GC_err_printf("GC_free(%p), GC: %lu\n", p, (unsigned long)GC_gc_no);
 #   endif
     h = HBLKPTR(p);
     hhdr = HDR(h);
diff --git a/mark.c b/mark.c
index 2d4f8dec74b375a98cbb991879c706c9c2162626..87e2b4a981816dd2e87856deb8a5ee685b3b2b3c 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -795,8 +795,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
 #   ifdef ENABLE_TRACE
         if (GC_trace_addr >= current_p
             && GC_trace_addr < limit) {
-          GC_log_printf("GC:%u Tracing from %p len %lu\n",
-                        (int)GC_gc_no, current_p, (unsigned long)descr);
+          GC_log_printf("GC:%u Tracing from %p, length is %lu\n",
+                        (unsigned)GC_gc_no, current_p, (unsigned long)descr);
         }
 #   endif /* ENABLE_TRACE */
     /* The simple case in which we're scanning a range. */
index e95067ef80f0162e44906a2d113878d21bdb72ba..348d61431e7218c5878dd260bbb9cf29a3bccfb3 100644 (file)
@@ -53,10 +53,10 @@ static int n_root_sets = 0;
                   GC_static_roots[i].r_tmp ? " (temporary)" : "");
         total += GC_static_roots[i].r_end - GC_static_roots[i].r_start;
     }
-    GC_printf("Total size: %ld\n", (unsigned long) total);
+    GC_printf("Total size: %lu\n", (unsigned long) total);
     if (GC_root_size != total) {
-        GC_err_printf("GC_root_size incorrect: %ld!!\n",
-                      (long) GC_root_size);
+        GC_err_printf("GC_root_size incorrect: %lu!!\n",
+                      (unsigned long) GC_root_size);
     }
   }
 #endif /* !NO_DEBUGGING */
index 5f44f722e2e275f95120f5bff02c88e30490adeb..7cdd3bb5c5ee944746bdc573d55d912ac260fb60 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3634,7 +3634,7 @@ GC_INNER void GC_dirty_init(void)
     if (GC_bytes_allocd != 0 || GC_bytes_allocd_before_gc != 0) {
       memset(GC_written_pages, 0xff, sizeof(page_hash_table));
       if (GC_print_stats == VERBOSE)
-        GC_log_printf("Allocated bytes:%lu:all pages may have been written\n",
+        GC_log_printf("Allocated %lu bytes: all pages may have been written\n",
                       (unsigned long)(GC_bytes_allocd
                                       + GC_bytes_allocd_before_gc));
     }
index 82523cd67eea2e49dfa3fe2072025f02e88f4f2e..72d09c835c29f2525dda9c75fbac8cf0b4fda6d8 100644 (file)
@@ -177,8 +177,8 @@ GC_API void * GC_CALL GC_malloc(size_t bytes)
     GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES,
                          NORMAL, GC_core_malloc(bytes), obj_link(result)=0);
 #   ifdef LOG_ALLOCS
-      GC_err_printf("GC_malloc(%u) = %p : %u\n",
-                        (unsigned)bytes, result, (unsigned)GC_gc_no);
+      GC_err_printf("GC_malloc(%lu) = %p, GC: %lu\n",
+                    (unsigned long)bytes, result, (unsigned long)GC_gc_no);
 #   endif
     return result;
 }