[m-rev.] for review: use C99 conversion specifiers in the runtime

Julien Fischer jfischer at opturion.com
Sun Mar 29 02:10:33 AEDT 2026


For review by anyone.

The request for review is for the idea, the implementation itself is trivial.

---------------------------

Use C99 conversion specifiers in the runtime.

C99 introduced additional conversion specifiers for use with the printf and
scanf family of functions. Specifically, the 'z' size specifier for size_t
values and the 't' size specifier for ptrdiff_t values. Historically, we have
not used them because the C99 support in a certain C compiler was lacking.
Since this is no longer the case, use them. This removes the need of a bunch
of casts, some of which were incorrect on 64-bit Windows.

runtime/mercury_accurate_gc.c:
runtime/mercury_memory_zones.c:
runtime/mercury_stacks.c:
runtime/mercury_wrapper.c:
    As above.

Julien.

diff --git a/runtime/mercury_accurate_gc.c b/runtime/mercury_accurate_gc.c
index b5435ee8f..88bb34e58 100644
--- a/runtime/mercury_accurate_gc.c
+++ b/runtime/mercury_accurate_gc.c
@@ -1,7 +1,7 @@
 // vim: ts=4 sw=4 expandtab ft=c

 // Copyright (C) 1998-2007, 2009, 2011 The University of Melbourne.
-// Copyright (C) 2015-2016, 2018 The Mercury team.
+// Copyright (C) 2015-2016, 2018, 2026 The Mercury team.
 // This file is distributed under the terms specified in COPYING.LIB.

 // This module contains the accurate garbage collector.
@@ -293,9 +293,8 @@ MR_schedule_agc(MR_Code *pc_at_signal, MR_Word
*sp_at_signal,
                     "has no stack layout info\n", entry_label->MR_entry_addr);
             }
             fprintf(stderr, "Mercury runtime: PC address = %p\n",
pc_at_signal);
-            fprintf(stderr, "Mercury runtime: PC = label + 0x%lx\n",
-                (long) ((char *) pc_at_signal -
-                    (char *)entry_label->MR_entry_addr));
+            fprintf(stderr, "Mercury runtime: PC = label + 0x%zx\n",
+                ((char *) pc_at_signal - (char *) entry_label->MR_entry_addr));
         } else {
             fprintf(stderr, "Mercury runtime: no entry label ");
             fprintf(stderr, "for PC address %p\n", pc_at_signal);
@@ -893,11 +892,11 @@ notify_gc_end(const MR_MemoryZone *old_heap,
const MR_MemoryZone *new_heap,
         MR_virtual_hp_word = (MR_Word) new_hp;
         fprintf(stderr, "MR_virtual_hp: %lx\n", (long) MR_virtual_hp);

-        fprintf(stderr, "old heap: %ld bytes, new heap: %ld bytes\n",
-            (long) ((char *) old_hp - (char *) old_heap->MR_zone_min),
-            (long) ((char *) MR_virtual_hp - (char *) new_heap->MR_zone_min));
-        fprintf(stderr, "%ld bytes recovered\n",
-            (long) ((char *) old_hp - (char *) old_heap->MR_zone_min) -
+        fprintf(stderr, "old heap: %td bytes, new heap: %td bytes\n",
+            ((char *) old_hp - (char *) old_heap->MR_zone_min),
+            ((char *) MR_virtual_hp - (char *) new_heap->MR_zone_min));
+        fprintf(stderr, "%td bytes recovered\n",
+            ((char *) old_hp - (char *) old_heap->MR_zone_min) -
             ((char *) MR_virtual_hp - (char *) new_heap->MR_zone_min));

         fprintf(stderr, "Garbage collection done.\n\n");
diff --git a/runtime/mercury_memory_zones.c b/runtime/mercury_memory_zones.c
index db7dc3e59..cef12e675 100644
--- a/runtime/mercury_memory_zones.c
+++ b/runtime/mercury_memory_zones.c
@@ -1,7 +1,7 @@
 // vim: ts=4 sw=4 expandtab ft=c

 // Copyright (C) 1998-2000, 2002-2007, 2010-2012 The University of Melbourne.
-// Copyright (C) 2013-2016, 2018, 2022, 2024 The Mercury team.
+// Copyright (C) 2013-2016, 2018, 2022, 2024, 2026 The Mercury team.
 // This file is distributed under the terms specified in COPYING.LIB.

 // This module defines the MR_MemoryZone data structure and operations
@@ -1276,12 +1276,10 @@ MR_debug_memory(FILE *fp)
     MR_MemoryZone   *zone;

     fprintf(fp, "\n");
-    fprintf(fp, "pcache_size  = %lu (0x%lx)\n",
-        (unsigned long) MR_pcache_size, (unsigned long) MR_pcache_size);
-    fprintf(fp, "page_size    = %lu (0x%lx)\n",
-        (unsigned long) MR_page_size, (unsigned long) MR_page_size);
-    fprintf(fp, "unit         = %lu (0x%lx)\n",
-        (unsigned long) MR_unit, (unsigned long) MR_unit);
+    fprintf(fp, "pcache_size  = %zu (0x%zx)\n", MR_pcache_size,
+        MR_pcache_size);
+    fprintf(fp, "page_size    = %zu (0x%zx)\n", MR_page_size, MR_page_size);
+    fprintf(fp, "unit         = %zu (0x%zx)\n", MR_unit, MR_unit);

     fprintf(fp, "\n");
     fprintf(fp, "fake_reg       = %p (offset %"
MR_INTEGER_LENGTH_MODIFIER "d)\n",
@@ -1298,9 +1296,9 @@ MR_debug_memory(FILE *fp)
 void
 MR_debug_memory_zone(FILE *fp, MR_MemoryZone *zone)
 {
-    fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-dessize   = %lu\n",
+    fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-dessize   = %zu\n",
         zone->MR_zone_name, zone->MR_zone_id,
-        (unsigned long) zone->MR_zone_desired_size);
+        zone->MR_zone_desired_size);
     fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-base  = %p\n",
         zone->MR_zone_name, zone->MR_zone_id,
         (void *) zone->MR_zone_bottom);
@@ -1314,9 +1312,9 @@ MR_debug_memory_zone(FILE *fp, MR_MemoryZone *zone)
         zone->MR_zone_name, zone->MR_zone_id,
         (void *) zone->MR_zone_end);
 #ifdef  MR_CHECK_OVERFLOW_VIA_MPROTECT
-    fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-redsize   = %lu\n",
+    fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-redsize   = %zu\n",
         zone->MR_zone_name, zone->MR_zone_id,
-        (unsigned long) zone->MR_zone_redzone_size);
+        zone->MR_zone_redzone_size);
     fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-redzone   = %p\n",
         zone->MR_zone_name, zone->MR_zone_id,
         (void *) zone->MR_zone_redzone);
@@ -1329,9 +1327,9 @@ MR_debug_memory_zone(FILE *fp, MR_MemoryZone *zone)
         zone->MR_zone_name, zone->MR_zone_id,
         (void *) zone->MR_zone_hardmax);
 #endif
-    fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-size      = %lu\n",
+    fprintf(fp, "%-16s#%" MR_INTEGER_LENGTH_MODIFIER "d-size      = %zu\n",
         zone->MR_zone_name, zone->MR_zone_id,
-        (unsigned long) get_zone_alloc_size(zone));
+        get_zone_alloc_size(zone));
     fprintf(fp, "\n");
 }

diff --git a/runtime/mercury_stacks.c b/runtime/mercury_stacks.c
index 70eafbde9..1b93841c6 100644
--- a/runtime/mercury_stacks.c
+++ b/runtime/mercury_stacks.c
@@ -1,7 +1,7 @@
 // vim: ts=4 sw=4 expandtab ft=c

 // Copyright (C) 1998-2001, 2003-2006, 2008, 2010-2011 The University
of Melbourne.
-// Copyright (C) 2014, 2016, 2018 The Mercury team.
+// Copyright (C) 2014, 2016, 2018, 2026 The Mercury team.
 // This file is distributed under the terms specified in COPYING.LIB.

 // This file contains code for printing statistics about stack frame sizes,
@@ -91,8 +91,8 @@ MR_print_stack_frame_stats(void)
         det_frame_total_size);
     fprintf(fp, "average size of a det stack frame:   %.3f\n",
         det_frame_total_size / det_frame_count);
-    fprintf(fp, "max size of det stack:               %ld\n",
-        (long) (MR_det_frame_max - MR_CONTEXT(MR_ctxt_detstack_zone)->min));
+    fprintf(fp, "max size of det stack:               %td\n",
+        (MR_det_frame_max - MR_CONTEXT(MR_ctxt_detstack_zone)->min));
     fprintf(fp, "\n");

     fprintf(fp, "number of non stack frames created:  %.0f\n",
@@ -101,8 +101,8 @@ MR_print_stack_frame_stats(void)
         non_frame_total_size);
     fprintf(fp, "average size of a non stack frame:   %.3f\n",
         non_frame_total_size / non_frame_count);
-    fprintf(fp, "max size of non stack:               %ld\n",
-        (long) (MR_non_frame_max - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min));
+    fprintf(fp, "max size of non stack:               %td\n",
+        (MR_non_frame_max - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min));
     fprintf(fp, "-------------------------------------------\n");

     MR_checked_fclose(fp, MR_STACK_FRAME_STATS);
diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
index e288c5739..dfab7c26f 100644
--- a/runtime/mercury_wrapper.c
+++ b/runtime/mercury_wrapper.c
@@ -771,7 +771,7 @@ mercury_runtime_init(int argc, char **argv)
 #ifdef MR_BOEHM_GC
 static void * GC_CALLBACK MR_oom_func(size_t bytes)
 {
-    MR_fatal_error("Could not allocate %d bytes, exiting.\n", bytes);
+    MR_fatal_error("Could not allocate %zu bytes, exiting.\n", bytes);
 }
 #endif

@@ -1411,7 +1411,7 @@ struct MR_option MR_long_opts[] = {
 static void
 MR_process_options(int argc, char **argv)
 {
-    unsigned long   size;
+    size_t          size;
     int             c;
     int             long_index;

@@ -1421,7 +1421,7 @@ MR_process_options(int argc, char **argv)
         switch (c)
         {
             case MR_HEAP_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1429,7 +1429,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_HEAP_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1437,7 +1437,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_DETSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1445,7 +1445,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_DETSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1453,7 +1453,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_NONDETSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1461,7 +1461,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_NONDETSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1469,7 +1469,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SMALL_DETSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1479,7 +1479,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SMALL_DETSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1489,7 +1489,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SMALL_NONDETSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1499,7 +1499,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SMALL_NONDETSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }
 #ifndef MR_STACK_SEGMENTS
@@ -1508,7 +1508,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SOLUTIONS_HEAP_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1516,7 +1516,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SOLUTIONS_HEAP_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1524,7 +1524,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRAIL_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1534,7 +1534,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRAIL_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1544,7 +1544,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRAIL_SEGMENT_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1554,7 +1554,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRAIL_SEGMENT_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1564,7 +1564,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_HEAP_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1572,7 +1572,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_HEAP_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1580,7 +1580,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_DETSTACK_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1588,7 +1588,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_DETSTACK_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1596,7 +1596,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_NONDETSTACK_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1604,7 +1604,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_NONDETSTACK_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1612,7 +1612,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SOLUTIONS_HEAP_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1620,7 +1620,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_SOLUTIONS_HEAP_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1628,7 +1628,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRAIL_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1636,7 +1636,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRAIL_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1644,7 +1644,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_HEAP_MARGIN_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1652,7 +1652,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_HEAP_MARGIN_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1666,7 +1666,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GENSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1674,7 +1674,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GENSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1682,7 +1682,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_CUTSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1690,7 +1690,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_CUTSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1698,7 +1698,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_PNEGSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1706,7 +1706,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_PNEGSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1714,7 +1714,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_DETSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1722,7 +1722,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_DETSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1730,7 +1730,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_NONDETSTACK_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1738,7 +1738,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_NONDETSTACK_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1746,7 +1746,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_DETSTACK_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1754,7 +1754,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_DETSTACK_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1762,7 +1762,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_NONDETSTACK_REDZONE_SIZE:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1770,7 +1770,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_GEN_NONDETSTACK_REDZONE_SIZE_KWORDS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1779,7 +1779,7 @@ MR_process_options(int argc, char **argv)

             case MR_MAX_ENGINES:
 #ifdef MR_LL_PARALLEL_CONJ
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1791,7 +1791,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_MAX_CONTEXTS_PER_THREAD:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1799,7 +1799,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_NUM_CONTEXTS_PER_LC_PER_THREAD:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1861,7 +1861,7 @@ MR_process_options(int argc, char **argv)

             case 'n':
             case MR_NUM_OUTPUT_ARGS:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -1995,7 +1995,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_TRACE_COUNT_SUMMARY_MAX_OPT:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -2011,7 +2011,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case MR_BOEHM_GC_FREE_SPACE_DIVISOR:
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }

@@ -2107,7 +2107,7 @@ MR_process_options(int argc, char **argv)
                 break;

             case 'C':
-                if (sscanf(MR_optarg, "%lu", &size) != 1) {
+                if (sscanf(MR_optarg, "%zu", &size) != 1) {
                     MR_usage();
                 }


More information about the reviews mailing list