[m-rev.] diff: delete unused local variables in trace library

Julien Fischer jfischer at opturion.com
Thu Mar 20 11:47:50 AEDT 2014


Branches: master, 14.01

When we originally added support for clang, most of its warnings were
disabled (and still are); I've been trying it out with more warning 
options enabled and this is the first (of probably a few) changes that fix
up things that it is complaining about.

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

Delete unused local variables in trace library.

trace/mercury_trace.c:
trace/mercury_trace_cmd_breakpoint.c:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_dd.c:
trace/mercury_trace_cmd_developer.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_help.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_spy.c:
trace/mercury_trace_tables.c:
trace/mercury_trace_vars.c:
 	As above.

Julien.

diff --git a/trace/mercury_trace.c b/trace/mercury_trace.c
index 1cdcab5..c19d19e 100644
--- a/trace/mercury_trace.c
+++ b/trace/mercury_trace.c
@@ -1197,7 +1197,6 @@ MR_find_saved_io_counter(const MR_LabelLayout *call_label,
      MR_Word *base_sp, MR_Word *base_curfr, MR_Unsigned *saved_io_counter_ptr)
  {
      const MR_ProcLayout     *level_layout;
-    MR_Unsigned             saved_io_counter;

      if (call_label == NULL) {
          return MR_FALSE;
diff --git a/trace/mercury_trace_cmd_breakpoint.c b/trace/mercury_trace_cmd_breakpoint.c
index 10bc0c4..3ca8ae4 100644
--- a/trace/mercury_trace_cmd_breakpoint.c
+++ b/trace/mercury_trace_cmd_breakpoint.c
@@ -219,11 +219,9 @@ MR_trace_cmd_break(char **words, int word_count, MR_TraceCmdInfo *cmd,
              user_event_set, user_event_name, print_list, &problem);
          MR_maybe_print_spy_point(slot, problem);
      } else if (word_count >= 2 && MR_streq(words[1], "user_event_set")) {
-        const MR_UserEventSpec  *user_event_spec;
          const char              *user_event_set;
          int                     slot;
          int                     set;
-        int                     spec;
          MR_bool                 found_event_set;

          if (word_count == 2) {
@@ -1187,7 +1185,6 @@ MR_trace_options_when_action_multi_ignore(MR_SpyWhen *when,
  {
      int             c;
      MR_SpyPrint     sp;
-    MR_SpyPrintList list;
      MR_bool         warn;
      const char      *problem;

diff --git a/trace/mercury_trace_cmd_browsing.c b/trace/mercury_trace_cmd_browsing.c
index c429073..995daec 100644
--- a/trace/mercury_trace_cmd_browsing.c
+++ b/trace/mercury_trace_cmd_browsing.c
@@ -605,7 +605,6 @@ MR_trace_cmd_hold(char **words, int word_count, MR_TraceCmdInfo *cmd,
      char        *held_var_name;
      MR_TypeInfo type_info;
      MR_Word     value;
-    const char  *ignored_name;
      const char  *problem;
      MR_bool     bad_subterm;

@@ -710,7 +709,6 @@ MR_Next
  MR_trace_cmd_dump(char **words, int word_count, MR_TraceCmdInfo *cmd,
      MR_EventInfo *event_info, MR_Code **jumpaddr)
  {
-    MR_bool         verbose = MR_FALSE;
      MR_Word         browser_term;
      const char      *problem = NULL;
      MR_bool         quiet = MR_FALSE;
diff --git a/trace/mercury_trace_cmd_dd.c b/trace/mercury_trace_cmd_dd.c
index 517e63b..e356ecb 100644
--- a/trace/mercury_trace_cmd_dd.c
+++ b/trace/mercury_trace_cmd_dd.c
@@ -59,7 +59,6 @@ MR_trace_cmd_dd(char **words, int word_count, MR_TraceCmdInfo *cmd,
      char                *fail_trace_counts_file;
      MR_String           problem;
      MR_bool             testing = MR_FALSE;
-    MR_bool             debug = MR_FALSE;
      const char          *filename;
      MR_DeclMode         decl_mode;

diff --git a/trace/mercury_trace_cmd_developer.c b/trace/mercury_trace_cmd_developer.c
index fd6bcaa..73b7e7b 100644
--- a/trace/mercury_trace_cmd_developer.c
+++ b/trace/mercury_trace_cmd_developer.c
@@ -253,8 +253,6 @@ MR_Next
  MR_trace_cmd_var_details(char **words, int word_count, MR_TraceCmdInfo *cmd,
      MR_EventInfo *event_info, MR_Code **jumpaddr)
  {
-    int n;
-
      if (word_count == 1) {
          const char  *problem;

@@ -274,8 +272,6 @@ MR_Next
  MR_trace_cmd_term_size(char **words, int word_count, MR_TraceCmdInfo *cmd,
      MR_EventInfo *event_info, MR_Code **jumpaddr)
  {
-    int n;
-
      if (word_count == 2) {
          const char  *problem;

@@ -1296,7 +1292,6 @@ MR_trace_cmd_ambiguity(char **words, int word_count,
      MR_bool         print_types;
      MR_bool         print_functors;
      FILE            *fp;
-    int             i;

      filename = NULL;
      print_procs = MR_FALSE;
@@ -1748,7 +1743,6 @@ MR_trace_cmd_table_print_tip(const MR_ProcLayout *proc,
          case MR_EVAL_METHOD_MINIMAL_STACK_COPY:
              {
                  MR_Subgoal  *subgoal;
-                int         subgoal_num;

                  fprintf(MR_mdb_out, "trie node %p\n", table);
                  subgoal = table->MR_subgoal;
diff --git a/trace/mercury_trace_declarative.c b/trace/mercury_trace_declarative.c
index 2254c43..02d10c7 100644
--- a/trace/mercury_trace_declarative.c
+++ b/trace/mercury_trace_declarative.c
@@ -495,8 +495,6 @@ MR_Code *
  MR_trace_decl_debug(MR_EventInfo *event_info)
  {
      const MR_ProcLayout     *entry;
-    MR_Unsigned             depth;
-    MR_Integer              trace_suppress;
      MR_Unsigned             node_depth;
      MR_Unsigned             call_seqno;
      MR_TracePort            port;
@@ -1410,7 +1408,6 @@ MR_decl_make_atom_args(const MR_LabelLayout *layout, MR_Word *saved_regs,
      MR_Word                 atom_args;
      int                     hv;   /* any head variable */
      int                     num_added_args;
-    MR_TypeInfoParams       type_params;
      const MR_ProcLayout     *entry;

      entry = layout->MR_sll_entry;
@@ -1642,7 +1639,6 @@ MR_trace_start_decl_debug(MR_DeclMode mode, const char *outfile,
      MR_bool new_session, MR_TraceCmdInfo *cmd, MR_EventInfo *event_info,
      MR_Code **jumpaddr)
  {
-    MR_RetryResult          result;
      const MR_ProcLayout     *entry;
      FILE                    *out;
      const char              *message;
diff --git a/trace/mercury_trace_help.c b/trace/mercury_trace_help.c
index 91698ee..1839c41 100644
--- a/trace/mercury_trace_help.c
+++ b/trace/mercury_trace_help.c
@@ -76,7 +76,6 @@ MR_trace_add_item(const char *category, const char *item, int slot,
  {
      MR_Word     path;
      char        *category_on_heap;
-    const char  *result;

      MR_trace_help_ensure_init();
      MR_trace_add_help_word(item);
diff --git a/trace/mercury_trace_internal.c b/trace/mercury_trace_internal.c
index d37cdd7..3d117e8 100644
--- a/trace/mercury_trace_internal.c
+++ b/trace/mercury_trace_internal.c
@@ -203,7 +203,6 @@ MR_trace_event_internal(MR_TraceCmdInfo *cmd, MR_bool interactive,
      MR_Code     *jumpaddr;
      char        *line;
      MR_Next     res;
-    const char  *prompt;

      if (! interactive) {
          return MR_trace_event_internal_report(cmd, print_list, event_info);
@@ -299,7 +298,6 @@ MR_trace_internal_ensure_init(void)
      if (! MR_trace_internal_initialized) {
          char        *env;
          MR_Unsigned n;
-        int         i;

          if (MR_mdb_benchmark_silent) {
              (void) close(1);
@@ -503,7 +501,6 @@ MR_trace_internal_create_mdb_window(void)
          ** Parent - set up the mdb I/O streams to point to the pseudo-terminal.
          */
          MR_signal_action    old_alarm_action;
-        int                 wait_status;
          int                 err_fd = -1;
          int                 out_fd = -1;

diff --git a/trace/mercury_trace_spy.c b/trace/mercury_trace_spy.c
index 5265e24..94345c9 100644
--- a/trace/mercury_trace_spy.c
+++ b/trace/mercury_trace_spy.c
@@ -531,8 +531,6 @@ MR_spy_cond_is_true(MR_SpyPoint *point, const MR_LabelLayout *label_layout)
      MR_Word         saved_regs[MR_MAX_FAKE_REG];
      int             max_f_num;
      MR_Float        saved_f_regs[MR_MAX_VIRTUAL_F_REG];
-    MR_VarSpec      var_spec;
-    char            *path;
      const char      *problem;
      char            *bad_path;
      MR_TypeInfo     type_info;
@@ -840,8 +838,6 @@ MR_add_user_event_spy_point(MR_SpyAction action,
      MR_SpyPoint     *point;
      int             name_slot;
      int             set_slot;
-    int             point_slot;
-    int             i;

      *problem = NULL;

diff --git a/trace/mercury_trace_tables.c b/trace/mercury_trace_tables.c
index 790ba2e..5e07552 100644
--- a/trace/mercury_trace_tables.c
+++ b/trace/mercury_trace_tables.c
@@ -1079,11 +1079,9 @@ MR_bool
  MR_parse_proc_spec(char *str, MR_ProcSpec *spec)
  {
      char    *dash;
-    char    *start;
      char    *end;
      int     n;
      int     len;
-    MR_bool found;

      spec->MR_proc_module = NULL;
      spec->MR_proc_name   = NULL;
@@ -1232,7 +1230,6 @@ MR_parse_trailing_number(char *start, char **end, int *number)
  {
      MR_bool found_digit;
      int     power_of_10;
-    char    c;
      char    *tmp_end;

      found_digit = MR_FALSE;
@@ -1530,7 +1527,6 @@ MR_trace_proc_spec_completer_next(const char *dont_use_this_word,
      char                    *name;
      size_t                  name_len;
      const char              *module_name;
-    int                     module_name_len;
      char                    *completion;

      data = (MR_ProcCompleterData *) *completer_data;
diff --git a/trace/mercury_trace_vars.c b/trace/mercury_trace_vars.c
index 7558431..3b8c097 100644
--- a/trace/mercury_trace_vars.c
+++ b/trace/mercury_trace_vars.c
@@ -800,7 +800,6 @@ MR_trace_compare_value_details(const void *arg1, const void *arg2)
  {
      MR_ValueDetails *value1;
      MR_ValueDetails *value2;
-    int             diff;

      value1 = (MR_ValueDetails *) arg1;
      value2 = (MR_ValueDetails *) arg2;
@@ -1216,7 +1215,6 @@ MR_convert_goal_to_synthetic_term(const char **functor_ptr,
      MR_Word                 is_func;
      MR_Word                 arg_list;
      MR_Word                 arg;
-    MR_TypeInfo             arg_list_typeinfo;
      MR_ValueDetails         *vars;
      int                     headvar_num;
      int                     arity;
@@ -1822,7 +1820,6 @@ MR_select_specified_subterm(char *path, MR_TypeInfo type_info, MR_Word *value,
      const MR_DuArgLocn  *arg_locn;
      char                *old_path;
      int                 arg_num;
-    int                 len;

      if (path == NULL) {
          *sub_value = value;



More information about the reviews mailing list