[m-rev.] diff: avoid GCC warnings on 64-bit Windows
Julien Fischer
jfischer at opturion.com
Thu Mar 21 17:50:27 AEDT 2013
Avoid GCC warnings in runtime on 64-bit Windows.
runtime/mercury_debug.c:
runtime/mercury_memory_zones.c:
runtime/mercury_wrapper.c:
Fix some spots that assumed the machine word size is
<= sizeof(long). This is not true on 64-bit Windows.
Julien.
diff --git a/runtime/mercury_debug.c b/runtime/mercury_debug.c
index 1a2f77e..e9301b3 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 %ld", (long) s);
+ fprintf(fp, "heap %" MR_INTEGER_LENGTH_MODIFIER "d", (MR_WORD_TYPE) 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 9d80221..c53870d 100644
--- a/runtime/mercury_memory_zones.c
+++ b/runtime/mercury_memory_zones.c
@@ -1334,8 +1334,8 @@ MR_debug_memory(FILE *fp)
(unsigned long) MR_unit, (unsigned long) MR_unit);
fprintf(fp, "\n");
- fprintf(fp, "fake_reg = %p (offset %ld)\n",
- (void *) MR_fake_reg, (long) MR_fake_reg & (MR_unit-1));
+ 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));
fprintf(fp, "\n");
MR_LOCK(&memory_zones_lock, "MR_debug_memory");
diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
index 89d7c4f..96df408 100644
--- a/runtime/mercury_wrapper.c
+++ b/runtime/mercury_wrapper.c
@@ -2223,14 +2223,14 @@ 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') {
- long addr;
+ MR_WORD_TYPE addr;
if (MR_optarg[1] == '0' && MR_optarg[2] == 'x') {
- if (sscanf(MR_optarg+3, "%lx", &addr) != 1) {
+ if (sscanf(MR_optarg+3, "%"
MR_INTEGER_LENGTH_MODIFIER "x", &addr) != 1) {
MR_usage();
}
} else {
- if (sscanf(MR_optarg+1, "%lu", &addr) != 1) {
+ if (sscanf(MR_optarg+1, "%"
MR_INTEGER_LENGTH_MODIFIER "u", &addr) != 1) {
MR_usage();
}
}
More information about the reviews
mailing list