summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez@inria.fr>2016-01-30 10:55:07 +0100
committerDamien Doligez <damien.doligez@inria.fr>2016-01-30 11:20:25 +0100
commit0390a40593347fad6de33373b37d49a15ec73e77 (patch)
treeade3745fa07994fc17c081093305cd2f2e63e4a6
parentf9b8bc6d7caef46f249bada32099854d87b3e644 (diff)
downloadocaml-fix-32bit-warning.tar.gz
fix commit a80d536fix-32bit-warning
We cannot use ARCH_INTNAT_PRINTF_FORMAT because it isn't guaranteed to match values of type size_t. Since this is debugging code, we go for the simple solution and cast to long.
-rw-r--r--byterun/instrtrace.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/byterun/instrtrace.c b/byterun/instrtrace.c
index 694edaff74..9e354f5555 100644
--- a/byterun/instrtrace.c
+++ b/byterun/instrtrace.c
@@ -183,21 +183,20 @@ caml_trace_value_file (value v, code_t prog, int proglen, FILE * f)
if (prog && v % sizeof (int) == 0
&& (code_t) v >= prog
&& (code_t) v < (code_t) ((char *) prog + proglen))
- fprintf (f, "=code@%" ARCH_INTNAT_PRINTF_FORMAT "d", (code_t) v - prog);
+ fprintf (f, "=code@%ld", (long) ((code_t) v - prog));
else if (Is_long (v))
fprintf (f, "=long%" ARCH_INTNAT_PRINTF_FORMAT "d", Long_val (v));
else if ((void*)v >= (void*)caml_stack_low
&& (void*)v < (void*)caml_stack_high)
- fprintf (f, "=stack_%" ARCH_INTNAT_PRINTF_FORMAT "d",
- (intnat*)caml_stack_high - (intnat*)v);
+ fprintf (f, "=stack_%ld", (long) ((intnat*)caml_stack_high - (intnat*)v));
else if (Is_block (v)) {
int s = Wosize_val (v);
int tg = Tag_val (v);
int l = 0;
switch (tg) {
case Closure_tag:
- fprintf (f, "=closure[s%d,cod%" ARCH_INTNAT_PRINTF_FORMAT "d]",
- s, (code_t) (Code_val (v)) - prog);
+ fprintf (f, "=closure[s%d,cod%ld]",
+ s, (long) ((code_t) (Code_val (v)) - prog));
goto displayfields;
case String_tag:
l = caml_string_length (v);
@@ -252,12 +251,11 @@ caml_trace_accu_sp_file (value accu, value * sp, code_t prog, int proglen,
value *p;
fprintf (f, "accu=");
caml_trace_value_file (accu, prog, proglen, f);
- fprintf (f, "\n sp=%#" ARCH_INTNAT_PRINTF_FORMAT "x "
- "@%" ARCH_INTNAT_PRINTF_FORMAT "d:",
- (intnat) sp, caml_stack_high - sp);
+ fprintf (f, "\n sp=%#" ARCH_INTNAT_PRINTF_FORMAT "x @%ld:",
+ (intnat) sp, (long) (caml_stack_high - sp));
for (p = sp, i = 0; i < 12 + (1 << caml_trace_level) && p < caml_stack_high;
p++, i++) {
- fprintf (f, "\n[%ld] ", caml_stack_high - p);
+ fprintf (f, "\n[%ld] ", (long) (caml_stack_high - p));
caml_trace_value_file (*p, prog, proglen, f);
};
putc ('\n', f);