[m-rev.] for review: use MR_Unsigned in trace code

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Oct 3 03:13:28 AEST 2007


On Tue, 2 Oct 2007, Julien Fischer wrote:

> For review by Zoltan or Ian.
>
> Estimated hours taken: 5
> Branches: main
>
> Fix up some places in the trace directory where there were (potential)
> mismatches between the sizes of types used to represent natural numbers.
> Much of the existing code in the trace directory assumed that sizeof(int) == 
> sizeof(MR_Unsigned), which is not true on our 64-bit
> machines.  Zoltan's recent change to MR_trace_is_natural_number() broke
> that assumption in a lot of places.  (I committed a workaround for that
> yesterday.)
>
> This diff addresses the above problem by changing the types of many of
> things that represent natural numbers from int to MR_Unsigned.
> This should make the trace code more robust on 64-bit machines and
> help avoid a recurrence of problems like the above.
>
> NOTE: this change does not change slot numbers into unsigned values since
> they still use negative values as sentinels.  I will address slot numbers
> in as part of a separate change.

This change broke compilation of the runtime (in of all things!) the
hlc grades.  I've committed the following diff which fixes this and
`also fixes some problems with printf statements in the runtime having
the incorrect conversion specifiers due to the above change.

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

Estimated hours taken: 4
Branches: main

Fix a problem introduced in my previous change to the trace directory
which introduced a dependency between the runtime and the trace directory
which broke compilation of the former in high-level C grades.

Fix up conversion specifiers in the printf control strings in the
trace directory.

runtime/mercury_stack_trace.h:
 	Define MR_FrameLimit, MR_SpecLineLimit and MR_AncestorLevel here rather
 	than in the trace directory because the code in the runtime for
 	stack tracing refers to them.  (Some code that was only enabled
 	in high-level C grades and referred to the above types was
 	added as part of my last change; this is what broke compilation
 	in those grades.)

 	Rename MR_AncestorLevel to (the more general) MR_Level in the
 	process.

runtime/mercury_stack_trace.c:
 	Use MR_FrameLimit and friends in place of ints here.

trace/mercury_trace.h:
 	Delete the typedefs for MR_FrameLimit and friends.

trace/mercury_trace_cmd_backward.c:
trace/mercury_trace_external.c:
 	Conform to the above change.

trace/*.c:
 	Change the signedness of conversion specifiers to conform
 	to recent type changes.

Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.79
diff -u -r1.79 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	2 Oct 2007 03:37:25 -0000	1.79
+++ runtime/mercury_stack_trace.c	2 Oct 2007 17:01:27 -0000
@@ -149,7 +149,8 @@
  MR_dump_stack_from_layout(FILE *fp, const MR_LabelLayout *label_layout,
      MR_Word *det_stack_pointer, MR_Word *current_frame,
      MR_bool include_trace_data, MR_bool include_contexts,
-    int frame_limit, int line_limit, MR_PrintStackRecord print_stack_record)
+    MR_FrameLimit frame_limit, MR_SpecLineLimit line_limit,
+    MR_PrintStackRecord print_stack_record)
  {
      MR_StackWalkStepResult          result;
      const MR_ProcLayout             *proc_layout;
@@ -217,18 +218,13 @@
  }

  const MR_LabelLayout *
-MR_find_nth_ancestor(const MR_LabelLayout *label_layout, int ancestor_level,
-    MR_Word **stack_trace_sp, MR_Word **stack_trace_curfr,
-    const char **problem)
+MR_find_nth_ancestor(const MR_LabelLayout *label_layout,
+    MR_Level ancestor_level, MR_Word **stack_trace_sp,
+    MR_Word **stack_trace_curfr, const char **problem)
  {
      MR_StackWalkStepResult  result;
      const MR_LabelLayout    *return_label_layout;
-    int                     i;
-
-    if (ancestor_level < 0) {
-        *problem = "no such stack frame";
-        return NULL;
-    }
+    MR_Unsigned             i;

      MR_do_init_modules();
      *problem = NULL;
@@ -350,8 +346,8 @@
  /**************************************************************************/

  void
-MR_dump_nondet_stack(FILE *fp, MR_Word *limit_addr, int frame_limit,
-    int line_limit, MR_Word *base_maxfr)
+MR_dump_nondet_stack(FILE *fp, MR_Word *limit_addr, MR_FrameLimit frame_limit,
+    MR_SpecLineLimit line_limit, MR_Word *base_maxfr)
  {
  #ifndef MR_HIGHLEVEL_CODE

@@ -445,7 +441,7 @@

  void
  MR_dump_nondet_stack_from_layout(FILE *fp, MR_Word *limit_addr,
-    int frame_limit, int line_limit, MR_Word *base_maxfr,
+    MR_FrameLimit frame_limit, MR_SpecLineLimit line_limit, MR_Word *base_maxfr,
      const MR_LabelLayout *top_layout, MR_Word *base_sp, MR_Word *base_curfr)
  {
      int                     frame_size;
@@ -1137,11 +1133,11 @@

  void
  MR_dump_stack_record_print(FILE *fp, const MR_ProcLayout *proc_layout,
-    int count, int start_level, MR_Word *base_sp, MR_Word *base_curfr,
+    int count, MR_Level start_level, MR_Word *base_sp, MR_Word *base_curfr,
      const char *filename, int linenumber, const char *goal_path,
      MR_bool context_mismatch)
  {
-    fprintf(fp, "%4d ", start_level);
+    fprintf(fp, "%4" MR_INTEGER_LENGTH_MODIFIER "d ", start_level);

      if (count > 1) {
          fprintf(fp, " %3d* ", count);
Index: runtime/mercury_stack_trace.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.40
diff -u -r1.40 mercury_stack_trace.h
--- runtime/mercury_stack_trace.h	5 Dec 2006 03:51:13 -0000	1.40
+++ runtime/mercury_stack_trace.h	2 Oct 2007 17:01:27 -0000
@@ -16,6 +16,11 @@
  **	Definitions for use by the stack tracing.
  */

+typedef MR_Unsigned MR_FrameLimit;
+typedef MR_Unsigned MR_SpecLineLimit;
+typedef MR_Unsigned MR_Level;
+
+
  /*---------------------------------------------------------------------------*/

  /*
@@ -63,7 +68,7 @@

  typedef	void		(*MR_PrintStackRecord)(FILE *fp,
  				const MR_ProcLayout *proc_layout,
-				int count, int level,
+				int count, MR_Level level,
  				MR_Word *base_sp, MR_Word * base_curfr,
  				const char *filename, int linenumber,
  				const char *goal_path,
@@ -75,7 +80,8 @@
  				MR_Word *current_frame,
  				MR_bool include_trace_data,
  				MR_bool include_contexts,
-				int frame_limit, int line_limit,
+				MR_FrameLimit frame_limit,
+				MR_SpecLineLimit line_limit,
  				MR_PrintStackRecord print_stack_record);

  /*
@@ -88,7 +94,8 @@
  */

  extern	void	MR_dump_nondet_stack(FILE *fp, MR_Word *limit_addr,
-			int frame_limit, int line_limit, MR_Word *maxfr);
+			MR_FrameLimit frame_limit,
+			MR_SpecLineLimit line_limit, MR_Word *maxfr);

  /*
  ** MR_dump_nondet_stack_from_layout
@@ -100,8 +107,9 @@
  */

  extern	void	MR_dump_nondet_stack_from_layout(FILE *fp,
-			MR_Word *limit_addr, int frame_limit, int line_limit,
-			MR_Word *maxfr, const MR_LabelLayout *label_layout,
+			MR_Word *limit_addr, MR_FrameLimit frame_limit,
+			MR_SpecLineLimit line_limit, MR_Word *maxfr,
+			const MR_LabelLayout *label_layout,
  			MR_Word *base_sp, MR_Word *base_curfr);

  /*
@@ -139,7 +147,7 @@

  extern	const MR_LabelLayout *MR_find_nth_ancestor(
  			const MR_LabelLayout *label_layout,
-			int ancestor_level, MR_Word **stack_trace_sp,
+			MR_Level ancestor_level, MR_Word **stack_trace_sp,
  			MR_Word **stack_trace_curfr, const char **problem);

  /*
@@ -312,7 +320,7 @@

  extern	void	MR_dump_stack_record_print(FILE *fp,
  			const MR_ProcLayout *proc_layout, int count,
-			int start_level, MR_Word *base_sp, MR_Word *base_curfr,
+			MR_Level start_level, MR_Word *base_sp, MR_Word *base_curfr,
  			const char *filename, int linenumber,
  			const char *goal_path, MR_bool context_mismatch);

Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.106
diff -u -r1.106 mercury_trace.c
--- trace/mercury_trace.c	2 Oct 2007 03:37:26 -0000	1.106
+++ trace/mercury_trace.c	2 Oct 2007 17:01:28 -0000
@@ -642,7 +642,7 @@

  MR_RetryResult
  MR_trace_retry(MR_EventInfo *event_info,
-    MR_AncestorLevel ancestor_level, MR_RetryAcrossIo across_io,
+    MR_Level ancestor_level, MR_RetryAcrossIo across_io,
      MR_bool assume_all_io_is_tabled, const char *retry_interactive_message,
      MR_bool *unsafe_retry, const char **problem,
      FILE *in_fp, FILE *out_fp, MR_Code **jumpaddr)
Index: trace/mercury_trace.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace.h,v
retrieving revision 1.37
diff -u -r1.37 mercury_trace.h
--- trace/mercury_trace.h	2 Oct 2007 03:37:27 -0000	1.37
+++ trace/mercury_trace.h	2 Oct 2007 17:01:28 -0000
@@ -26,13 +26,11 @@

  #include "mercury_memory_zones.h"   /* for MR_MAX_FAKE_REG */
  #include "mercury_types.h"          /* for MR_Unsigned etc */
+#include "mercury_stack_trace.h"    /* for MR_Level etc    */
  #include "mercury_trace_base.h"     /* for MR_TracePort    */
  #include "mercury_std.h"            /* for MR_bool         */


-typedef MR_Unsigned MR_AncestorLevel;
-typedef MR_Unsigned MR_FrameLimit;
-typedef MR_Unsigned MR_SpecLineLimit;
  typedef MR_Unsigned MR_IgnoreCount;

  /*
@@ -147,7 +145,7 @@
  } MR_RetryResult;

  extern  MR_RetryResult  MR_trace_retry(MR_EventInfo *event_info,
-                            MR_AncestorLevel ancestor_level,
+                            MR_Level ancestor_level,
                              MR_RetryAcrossIo across_io,
                              MR_bool assume_all_io_is_tabled,
                              const char *retry_interactive_message,
Index: trace/mercury_trace_cmd_backward.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_backward.c,v
retrieving revision 1.3
diff -u -r1.3 mercury_trace_cmd_backward.c
--- trace/mercury_trace_cmd_backward.c	2 Oct 2007 03:37:27 -0000	1.3
+++ trace/mercury_trace_cmd_backward.c	2 Oct 2007 17:01:28 -0000
@@ -51,8 +51,8 @@
  MR_trace_cmd_retry(char **words, int word_count, MR_TraceCmdInfo *cmd,
      MR_EventInfo *event_info, MR_Code **jumpaddr)
  {
-    MR_AncestorLevel    n;
-    MR_AncestorLevel    ancestor_level;
+    MR_Level            n;
+    MR_Level            ancestor_level;
      MR_RetryAcrossIo    across_io;
      const char          *problem;
      MR_RetryResult      result;
Index: trace/mercury_trace_cmd_breakpoint.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_breakpoint.c,v
retrieving revision 1.6
diff -u -r1.6 mercury_trace_cmd_breakpoint.c
--- trace/mercury_trace_cmd_breakpoint.c	2 Oct 2007 03:37:27 -0000	1.6
+++ trace/mercury_trace_cmd_breakpoint.c	2 Oct 2007 17:01:28 -0000
@@ -322,7 +322,7 @@
                  "Ambiguous procedure specification. The matches are:\n");

              for (i = 0; i < matches.match_proc_next; i++) {
-                fprintf(MR_mdb_out, "%d: ", i);
+                fprintf(MR_mdb_out, "%" MR_INTEGER_LENGTH_MODIFIER "u: ", i);
                  MR_print_proc_id_and_nl(MR_mdb_out, matches.match_procs[i]);
              }

@@ -331,7 +331,7 @@
              }

              sprintf(buf, "\nWhich do you want to put "
-                "a breakpoint on (0-%d or *)? ",
+                "a breakpoint on (0-%" MR_INTEGER_LENGTH_MODIFIER "u or *)? ",
                  matches.match_proc_next - 1);
              line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
              if (line2 == NULL) {
@@ -394,7 +394,7 @@
                  "Ambiguous procedure specification. The matches are:\n");

              for (i = 0; i < matches.match_proc_next; i++) {
-                fprintf(MR_mdb_out, "%d: ", i);
+                fprintf(MR_mdb_out, "%" MR_INTEGER_LENGTH_MODIFIER "u: ", i);
                  MR_print_proc_id_and_nl(MR_mdb_out, matches.match_procs[i]);
              }

@@ -402,7 +402,8 @@
                  return KEEP_INTERACTING;
              }

-            sprintf(buf, "\nWhich do you want to put a breakpoint on (0-%d)? ",
+            sprintf(buf, "\nWhich do you want to put a breakpoint on (0-%"
+                MR_INTEGER_LENGTH_MODIFIER "u)? ",
                  matches.match_proc_next - 1);
              line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
              if (line2 == NULL) {
@@ -459,7 +460,8 @@
                  const MR_LabelLayout    *this_label;

                  this_label = matching_labels[i];
-                fprintf(MR_mdb_out, "%d: %4s %s\n",
+                fprintf(MR_mdb_out, "%" MR_INTEGER_LENGTH_MODIFIER
+                    "u: %4s %s\n",
                      i,
                      MR_simplified_port_names[this_label->MR_sll_port],
                      MR_label_goal_path(this_label));
@@ -710,7 +712,9 @@
              MR_maybe_print_spy_point(n, problem);
          } else {
              fflush(MR_mdb_out);
-            fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
+            fprintf(MR_mdb_err,
+                "mdb: break point #%"
+                MR_INTEGER_LENGTH_MODIFIER "u does not exist.\n", n);
          }
      } else if (word_count == 2 && MR_streq(words[1], "*")) {
          int i;
@@ -829,7 +833,9 @@
              MR_print_spy_point(MR_mdb_out, n, MR_FALSE);
          } else {
              fflush(MR_mdb_out);
-            fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
+            fprintf(MR_mdb_err,
+                "mdb: break point #%"
+                MR_INTEGER_LENGTH_MODIFIER "u does not exist.\n", n);
          }
      } else if (word_count == 2 && MR_streq(words[1], "*")) {
          int i;
@@ -879,7 +885,9 @@
              MR_print_spy_point(MR_mdb_out, n, MR_FALSE);
          } else {
              fflush(MR_mdb_out);
-            fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
+            fprintf(MR_mdb_err,
+                "mdb: break point #%"
+                MR_INTEGER_LENGTH_MODIFIER "u does not exist.\n", n);
          }
      } else if (word_count == 2 && MR_streq(words[1], "*")) {
          int i;
@@ -932,7 +940,9 @@
              MR_delete_spy_point(n);
          } else {
              fflush(MR_mdb_out);
-            fprintf(MR_mdb_err, "mdb: break point #%d does not exist.\n", n);
+            fprintf(MR_mdb_err,
+                "mdb: break point #%"
+                MR_INTEGER_LENGTH_MODIFIER "u does not exist.\n", n);
          }
      } else if (word_count == 2 && MR_streq(words[1], "*")) {
          int i;
Index: trace/mercury_trace_cmd_dd.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_dd.c,v
retrieving revision 1.5
diff -u -r1.5 mercury_trace_cmd_dd.c
--- trace/mercury_trace_cmd_dd.c	2 Oct 2007 03:37:27 -0000	1.5
+++ trace/mercury_trace_cmd_dd.c	2 Oct 2007 17:01:28 -0000
@@ -178,12 +178,14 @@
                  fprintf(MR_mdb_out, "Ambiguous predicate or function"
                      " specification. The matches are:\n");
                  for (i = 0; i < matches.match_proc_next; i++) {
-                    fprintf(MR_mdb_out, "%d: ", i);
+                    fprintf(MR_mdb_out, "%" MR_INTEGER_LENGTH_MODIFIER "u: ",
+                        i);
                      MR_print_pred_id_and_nl(MR_mdb_out,
                          matches.match_procs[i]);
                  }
                  sprintf(buf, "\nWhich predicate or function "
-                    "do you want to trust (0-%d or *)? ",
+                    "do you want to trust (0-%" MR_INTEGER_LENGTH_MODIFIER
+                    "u or *)? ",
                      matches.match_proc_next - 1);
                  line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
                  if (line2 == NULL) {
Index: trace/mercury_trace_cmd_developer.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_developer.c,v
retrieving revision 1.7
diff -u -r1.7 mercury_trace_cmd_developer.c
--- trace/mercury_trace_cmd_developer.c	2 Oct 2007 03:37:27 -0000	1.7
+++ trace/mercury_trace_cmd_developer.c	2 Oct 2007 17:01:28 -0000
@@ -1396,7 +1396,9 @@
              MR_print_proc_id_and_nl(MR_mdb_out, matches.match_procs[i]);
          }

-        sprintf(buf, "\nWhich procedure's table do you want to print (0-%d)? ",
+        sprintf(buf,
+            "\nWhich procedure's table do you want to print (0-%"
+            MR_INTEGER_LENGTH_MODIFIER "d)? ",
              matches.match_proc_next - 1);
          line2 = MR_trace_getline(buf, MR_mdb_in, MR_mdb_out);
          if (line2 == NULL || !MR_trace_is_natural_number(line2, &n)) {
Index: trace/mercury_trace_cmd_misc.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_misc.c,v
retrieving revision 1.4
diff -u -r1.4 mercury_trace_cmd_misc.c
--- trace/mercury_trace_cmd_misc.c	19 Jan 2007 04:42:50 -0000	1.4
+++ trace/mercury_trace_cmd_misc.c	2 Oct 2007 17:01:28 -0000
@@ -116,7 +116,8 @@
              fprintf(fp, "scroll off\n");
          }

-        fprintf(fp, "scroll %d\n", MR_scroll_limit);
+        fprintf(fp, "scroll %" MR_INTEGER_LENGTH_MODIFIER "u\n",
+            MR_scroll_limit);
          fprintf(fp, "stack_default_limit %d\n", MR_stack_default_line_limit);

          switch (MR_context_position) {
@@ -181,7 +182,8 @@
                  MR_dice_pass_trace_counts_file);
          }

-        fprintf(fp, "list_context_lines %d\n", MR_num_context_lines);
+        fprintf(fp, "list_context_lines %" MR_INTEGER_LENGTH_MODIFIER "u\n",
+            MR_num_context_lines);
          MR_TRACE_CALL_MERCURY(
              path_list = ML_LISTING_get_list_path(MR_listing_path);
              if (! MR_list_is_empty(path_list)) {
Index: trace/mercury_trace_cmd_parameter.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_cmd_parameter.c,v
retrieving revision 1.7
diff -u -r1.7 mercury_trace_cmd_parameter.c
--- trace/mercury_trace_cmd_parameter.c	2 Oct 2007 03:37:28 -0000	1.7
+++ trace/mercury_trace_cmd_parameter.c	2 Oct 2007 17:01:28 -0000
@@ -175,7 +175,8 @@
              MR_scroll_limit = n;
              if (MR_trace_internal_interacting) {
                  fprintf(MR_mdb_out,
-                    "Scroll window size set to %d.\n", MR_scroll_limit);
+                    "Scroll window size set to %" MR_INTEGER_LENGTH_MODIFIER
+                    "u.\n", MR_scroll_limit);
              }
          } else {
              MR_trace_usage_cur_cmd();
@@ -187,7 +188,9 @@
          } else {
              fprintf(MR_mdb_out, "off");
          }
-        fprintf(MR_mdb_out, ", scroll window size is %d.\n", MR_scroll_limit);
+        fprintf(MR_mdb_out,
+            ", scroll window size is %" MR_INTEGER_LENGTH_MODIFIER "u.\n",
+            MR_scroll_limit);
      } else {
          MR_trace_usage_cur_cmd();
      }
@@ -485,7 +488,8 @@
          MR_num_context_lines = n;
      } else if (word_count == 1) {
          fprintf(MR_mdb_out,
-            "Printing %d lines around each context listing\n",
+            "Printing %" MR_INTEGER_LENGTH_MODIFIER
+            "u lines around each context listing\n",
              MR_num_context_lines);
      } else {
          MR_trace_usage_cur_cmd();
@@ -665,7 +669,8 @@
          num_io_actions = (int) n;

          fprintf(MR_mdb_out,
-            "The maximum number of I/O actions printed is %d\n",
+            "The maximum number of I/O actions printed is %"
+            MR_INTEGER_LENGTH_MODIFIER "u\n",
              num_io_actions);
      } else {
          MR_trace_usage_cur_cmd();
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.84
diff -u -r1.84 mercury_trace_external.c
--- trace/mercury_trace_external.c	3 Jan 2007 05:17:21 -0000	1.84
+++ trace/mercury_trace_external.c	2 Oct 2007 17:01:28 -0000
@@ -231,7 +231,7 @@
                      const char *extra, MR_Word *base_sp, MR_Word *base_curfr);
  static void     MR_dump_stack_record_print_to_socket(FILE *fp,
                      const MR_ProcLayout *entry_layout, int count,
-                    int start_level, MR_Word *base_sp, MR_Word *base_curfr,
+                    MR_Level start_level, MR_Word *base_sp, MR_Word *base_curfr,
                      const char *filename, int linenumber,
                      const char *goal_path, MR_bool context_mismatch);
  static void     MR_get_list_modules_to_import(MR_Word debugger_request,
@@ -1265,12 +1265,13 @@

  static void
  MR_dump_stack_record_print_to_socket(FILE *fp,
-    const MR_ProcLayout *entry_layout, int count, int start_level,
+    const MR_ProcLayout *entry_layout, int count, MR_Level start_level,
      MR_Word *base_sp, MR_Word *base_curfr,
      const char *filename, int linenumber,
      const char *goal_path, MR_bool context_mismatch)
  {
-    MR_send_message_to_socket_format("level(%d).\n", start_level);
+    MR_send_message_to_socket_format(
+        "level(%" MR_INTEGER_LENGTH_MODIFIER "u).\n", start_level);
      MR_print_proc_id_to_socket(entry_layout, NULL, base_sp, base_curfr);
  }

Index: trace/mercury_trace_spy.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_spy.c,v
retrieving revision 1.33
diff -u -r1.33 mercury_trace_spy.c
--- trace/mercury_trace_spy.c	2 Oct 2007 03:37:28 -0000	1.33
+++ trace/mercury_trace_spy.c	2 Oct 2007 17:01:28 -0000
@@ -1139,7 +1139,9 @@
      }

      if (point->MR_spy_ignore_count > 1) {
-        fprintf(fp, "\n%12s(ignore next %d %s events)\n",
+        fprintf(fp,
+            "\n%12s(ignore next %" MR_INTEGER_LENGTH_MODIFIER
+            "u %s events)\n",
              "", point->MR_spy_ignore_count,
              MR_ignore_when_to_string(point->MR_spy_ignore_when));
      } else if (point->MR_spy_ignore_count > 0) {
@@ -1224,7 +1226,8 @@
  {
      switch (cond->MR_cond_var_spec.MR_var_spec_kind) {
          case MR_VAR_SPEC_NUMBER:
-            fprintf(fp, "%d", cond->MR_cond_var_spec.MR_var_spec_number);
+            fprintf(fp, "%" MR_INTEGER_LENGTH_MODIFIER "u",
+                cond->MR_cond_var_spec.MR_var_spec_number);
              break;

          case MR_VAR_SPEC_NAME:
@@ -1308,11 +1311,13 @@
          if (point->MR_spy_ignore_count > 0) {
              switch (point->MR_spy_ignore_when) {
                  case MR_SPY_IGNORE_INTERFACE:
-                    fprintf(fp, " -I%d", point->MR_spy_ignore_count);
+                    fprintf(fp, " -I%" MR_INTEGER_LENGTH_MODIFIER "u",
+                        point->MR_spy_ignore_count);
                      break;

                  case MR_SPY_IGNORE_ENTRY:
-                    fprintf(fp, " -E%d", point->MR_spy_ignore_count);
+                    fprintf(fp, " -E%" MR_INTEGER_LENGTH_MODIFIER "u",
+                        point->MR_spy_ignore_count);
                      break;

                  default:
Index: trace/mercury_trace_vars.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.78
diff -u -r1.78 mercury_trace_vars.c
--- trace/mercury_trace_vars.c	2 Oct 2007 03:37:29 -0000	1.78
+++ trace/mercury_trace_vars.c	2 Oct 2007 17:01:28 -0000
@@ -1123,7 +1123,8 @@
  {
      switch (var_spec->MR_var_spec_kind) {
          case MR_VAR_SPEC_NUMBER:
-            fprintf(fp, "%d", var_spec->MR_var_spec_number);
+            fprintf(fp, "%" MR_INTEGER_LENGTH_MODIFIER "u",
+                var_spec->MR_var_spec_number);
              break;

          case MR_VAR_SPEC_NAME:
@@ -1610,7 +1611,8 @@
      {
          switch (var_spec->MR_var_spec_kind) {
              case MR_VAR_SPEC_NUMBER:
-                sprintf(MR_trace_bad_path_in_var_buffer, "%s%s%d",
+                sprintf(MR_trace_bad_path_in_var_buffer,
+                "%s%s%" MR_INTEGER_LENGTH_MODIFIER "u",
                      path_msg, BAD_VAR_PATH_MSG_MIDDLE,
                      var_spec->MR_var_spec_number);
                  break;
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list