[m-rev.] diff: avoid more GCC warnings in the runtime on 64-bit Windows

Julien Fischer jfischer at opturion.com
Thu Mar 21 18:26:56 AEDT 2013


Avoid more GCC warnings in the runtime on 64-bit Windows.

runtime/mercury_ml_expand_body.h:
	Fix another spot where we are incorrectly assuming that
	the machine word size is <= sizeof(long).

runtime/mercury_debug.c:
runtime/mercury_memory_zones.c:
runtime/mercury_wrapper.c:
	s/MR_WORD_TYPE/MR_Integer/ in my last change.

Julien.

diff --git a/runtime/mercury_debug.c b/runtime/mercury_debug.c
index e9301b3..e076f01 100644
--- a/runtime/mercury_debug.c
+++ b/runtime/mercury_debug.c
@@ -949,7 +949,7 @@ void
 MR_print_heapptr(FILE *fp, const MR_Word *s)
 {
 #ifdef  MR_CONSERVATIVE_GC
-    fprintf(fp, "heap %" MR_INTEGER_LENGTH_MODIFIER "d", (MR_WORD_TYPE) s);
+    fprintf(fp, "heap %" MR_INTEGER_LENGTH_MODIFIER "d", (MR_Integer) s);
 #else
     fprintf(fp, "heap %3ld",
         (long) (MR_Integer) (s - MR_ENGINE(MR_eng_heap_zone)->MR_zone_min));
diff --git a/runtime/mercury_memory_zones.c b/runtime/mercury_memory_zones.c
index c53870d..207aaa4 100644
--- a/runtime/mercury_memory_zones.c
+++ b/runtime/mercury_memory_zones.c
@@ -1335,7 +1335,7 @@ MR_debug_memory(FILE *fp)

     fprintf(fp, "\n");
     fprintf(fp, "fake_reg       = %p (offset %"
MR_INTEGER_LENGTH_MODIFIER "d)\n",
-        (void *) MR_fake_reg, (MR_WORD_TYPE) MR_fake_reg & (MR_unit-1));
+        (void *) MR_fake_reg, (MR_Integer) MR_fake_reg & (MR_unit-1));
     fprintf(fp, "\n");

     MR_LOCK(&memory_zones_lock, "MR_debug_memory");
diff --git a/runtime/mercury_ml_expand_body.h b/runtime/mercury_ml_expand_body.h
index 8d2db13..853180d 100644
--- a/runtime/mercury_ml_expand_body.h
+++ b/runtime/mercury_ml_expand_body.h
@@ -1240,7 +1240,8 @@ EXPAND_FUNCTION_NAME(MR_TypeInfo type_info,
MR_Word *data_word_ptr,
                         char    buf[500];
                         char    *str;

-                        sprintf(buf, "tvar%ld", (long) data_pseudo_type_info);
+                        sprintf(buf, "tvar%" MR_INTEGER_LENGTH_MODIFIER "d",
+                            (MR_Integer) data_pseudo_type_info);
                         MR_make_aligned_string_copy_saved_hp(str, buf, NULL);
                         expand_info->EXPAND_FUNCTOR_FIELD = str;
                     }
diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
index 96df408..d33ebcd 100644
--- a/runtime/mercury_wrapper.c
+++ b/runtime/mercury_wrapper.c
@@ -2223,7 +2223,7 @@ MR_process_options(int argc, char **argv)
                 } else if (MR_streq(MR_optarg, "u")) {
                     MR_unbufdebug   = MR_TRUE;
                 } else if (MR_optarg[0] == 'w' || MR_optarg[0] == 'W') {
-                    MR_WORD_TYPE    addr;
+                    MR_Integer    addr;

                     if (MR_optarg[1] == '0' && MR_optarg[2] == 'x') {
                         if (sscanf(MR_optarg+3, "%"
MR_INTEGER_LENGTH_MODIFIER "x", &addr) != 1) {



More information about the reviews mailing list