[m-rev.] for review: fix warnings on x86_64
Mark Brown
mark at cs.mu.OZ.AU
Wed Aug 31 01:02:10 AEST 2005
Hi,
Most of this is straightforward. The main question is what to do about
the XXX comment in runtime/mercury_types.h. I'm not sure what should be
done here, or even if this is a problem at all.
Cheers,
Mark.
Estimated hours taken: 2
Branches: main
Fix some warnings and type errors that show up on the x86_64 architecture.
browser/io_action.m:
Declare is_func in the C code for pickup_io_action to be MR_Bool
rather than MR_bool, since it is a (word sized) Mercury bool, not
a C boolean.
library/construct.m:
runtime/mercury_unify_compare_body.h:
Provide values for variables even when MR_fatal_error is called,
to avoid warnings about uninitialized variables. Add default
switch cases which call MR_fatal_error.
mdbcomp/rtti_access.m:
Pass an int* to MR_find_context, and cast the result to an MR_Integer
afterwards.
robdd/bryant.h:
This code incorrectly assumes that unsigned long will have 32 bits.
Flag the error with an XXX.
runtime/mercury_deconstruct.c:
trace/mercury_trace_internal.c:
Cast arity values to int before printing. We don't support
arity > 1024 anyway.
runtime/mercury_proc_id.h:
runtime/mercury_types.h:
Add an extra branch to the MR_Proc_Id union for the case when no
proc id is present, and add a macro to test for this case. We can't
test the enum directly as we did before, because C compilers may
report a warning that the test will never succeed (since -1 is not
one of the values in the enum).
Add an XXX pointing out that MR_PredFunc no longer matches
pred_or_func.
Fix an out-of-date comment.
runtime/mercury_stack_layout.h:
Use the new macro instead of testing directly whether the proc id
exists.
runtime/mercury_stack_trace.c:
runtime/mercury_trace_base.c:
runtime/mercury_type_info.c:
trace/mercury_trace_internal.c:
Use MR_INTEGER_LENGTH_MODIFIER, which is set by `configure', to
get the right format specifier when printing integers with the same
size as MR_Word.
runtime/mercury_type_info.c:
Compare pseudo-typeinfos as MR_Integers rather than ints.
trace/mercury_trace.c:
trace/mercury_trace_tables.c:
Provide a dummy value for variables to avoid uninitialized variable
warnings.
trace/mercury_trace_completion.c:
Cast a void* to MR_Integer before casting it to int. It would be
nicer to avoid the second cast altogether, but the readline interface
requires it.
trace/mercury_trace_internal.c:
Use MR_trace_is_unsigned when working with MR_Unsigned values.
Cast pseudo-typeinfos which are variables to MR_Integer rather than
int, to avoid compiler warnings about pointer casts. We cast them
to int before printing them, but that is because we know they won't
be that big.
Parse the argument to the goto command as type MR_Unsigned instead
of int, to make it possible to goto an event with a number bigger
than 2^31, on 64-bit machines at least. (We already get 200M+
events when the compiler is in a debug grade.)
trace/mercury_trace_util.c:
trace/mercury_trace_util.h:
Provide MR_trace_is_unsigned, which is like MR_trace_is_natural_number
except that it works with MR_Unsigned values.
trace/mercury_trace_vars.c:
Cast void* to MR_Integer rather than int.
Index: browser/io_action.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/io_action.m,v
retrieving revision 1.9
diff -u -r1.9 io_action.m
--- browser/io_action.m 19 Jun 2005 02:14:17 -0000 1.9
+++ browser/io_action.m 30 Aug 2005 10:37:08 -0000
@@ -89,7 +89,7 @@
"{
const char *problem;
const char *proc_name;
- MR_bool is_func;
+ MR_Bool is_func;
MR_Word args;
MR_bool io_action_tabled;
MR_String ProcName;
Index: library/construct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.20
diff -u -r1.20 construct.m
--- library/construct.m 16 Jun 2005 04:08:00 -0000 1.20
+++ library/construct.m 30 Aug 2005 10:37:08 -0000
@@ -534,7 +534,12 @@
break;
case MR_SECTAG_VARIABLE:
+ new_data = (MR_Word) 0; /* avoid a warning */
MR_fatal_error(""construct(): cannot construct variable"");
+
+ default:
+ new_data = (MR_Word) 0; /* avoid a warning */
+ MR_fatal_error(""construct(): unrecognised sectag locn"");
}
if (! MR_list_is_empty(arg_list)) {
@@ -585,6 +590,7 @@
break;
default:
+ new_data = (MR_Word) 0; /* avoid a warning */
MR_fatal_error(""bad type_ctor_rep in construct:construct"");
}
Index: mdbcomp/rtti_access.m
===================================================================
RCS file: /home/mercury1/repository/mercury/mdbcomp/rtti_access.m,v
retrieving revision 1.1
diff -u -r1.1 rtti_access.m
--- mdbcomp/rtti_access.m 24 Aug 2005 09:07:10 -0000 1.1
+++ mdbcomp/rtti_access.m 30 Aug 2005 10:37:08 -0000
@@ -80,8 +80,10 @@
[will_not_call_mercury, thread_safe, promise_pure],
"
const char *filename;
+ int line_no;
- SUCCESS_INDICATOR = MR_find_context(Label, &filename, &LineNo);
+ SUCCESS_INDICATOR = MR_find_context(Label, &filename, &line_no);
+ LineNo = (MR_Integer) line_no;
MR_TRACE_USE_HP(
MR_make_aligned_string(FileName, (MR_String) filename);
);
Index: robdd/bryant.h
===================================================================
RCS file: /home/mercury1/repository/mercury/robdd/bryant.h,v
retrieving revision 1.2
diff -u -r1.2 bryant.h
--- robdd/bryant.h 15 Dec 2004 06:57:45 -0000 1.2
+++ robdd/bryant.h 30 Aug 2005 10:37:08 -0000
@@ -63,6 +63,7 @@
#endif
/* number of bits in an unsigned long, and the log (base 2) of that */
+/* XXX this is wrong for 64-bit architectures */
#define MR_ROBDD_BITS_PER_WORD 32
#define MR_ROBDD_LOG_BITS_PER_WORD 5
Index: runtime/mercury_deconstruct.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deconstruct.c,v
retrieving revision 1.17
diff -u -r1.17 mercury_deconstruct.c
--- runtime/mercury_deconstruct.c 14 Dec 2004 01:07:24 -0000 1.17
+++ runtime/mercury_deconstruct.c 30 Aug 2005 10:37:08 -0000
@@ -332,7 +332,7 @@
sprintf(str, wrap? "<<%s.%s/%d>>" : "%s.%s/%d",
tci->MR_type_ctor_module_name,
tci->MR_type_ctor_name,
- tci->MR_type_ctor_arity);
+ (int) tci->MR_type_ctor_arity);
return (MR_ConstString) str;
}
Index: runtime/mercury_proc_id.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_proc_id.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_proc_id.h
--- runtime/mercury_proc_id.h 23 May 2004 22:16:51 -0000 1.4
+++ runtime/mercury_proc_id.h 30 Aug 2005 14:06:54 -0000
@@ -15,7 +15,10 @@
/*
** This type indicates whether a procedure came from a predicate or a function.
** This enum should EXACTLY match the definition of the `pred_or_func' type
-** in browser/util.m.
+** in mdbcomp/prim_data.m.
+**
+** XXX enums have type int, which is 32 bits on x86_64, whereas the
+** pred_or_func type is 64 bits.
*/
typedef enum {
@@ -24,12 +27,15 @@
} MR_PredFunc;
/*
-** MR_Proc_Id is a union. The usual alternative identifies ordinary
-** procedures, while the other alternative identifies automatically generated
-** unification, comparison and index procedures. The meanings of the fields
-** in both forms are the same as in procedure labels. The runtime system
-** can figure out which form is present by using the macro MR_PROC_ID_IS_UCI,
-** which will return true only if the procedure is of the second type.
+** MR_Proc_Id is a union. The first alternative identifies ordinary
+** procedures, while the second alternative identifies automatically generated
+** unification, comparison and index procedures. The third alternative
+** indicates that no proc id exists. The meanings of the fields in the
+** first two forms are the same as in procedure labels. The runtime system
+** can figure out if a proc id exists by using the macro MR_PROC_ID_EXISTS,
+** and it can figure out which form is present by using the macro
+** MR_PROC_ID_IS_UCI, which will return true only if the proc id exists and
+** the procedure is of the second type.
**
** The compiler generates MR_User_Proc_Id and MR_UCI_Proc_Id structures
** in order to avoid having to initialize the MR_Proc_Id union through the
@@ -58,11 +64,24 @@
MR_int_least16_t MR_uci_mode;
};
+struct MR_No_Proc_Id_Struct {
+ /*
+ ** This field should align with the first field of
+ ** MR_User_Proc_Id_Struct, which means that it should have the same
+ ** size as MR_PredFunc, an enum.
+ */
+ int MR_no_proc_id_flag;
+};
+
union MR_Proc_Id_Union {
MR_User_Proc_Id MR_proc_user;
MR_UCI_Proc_Id MR_proc_uci;
+ MR_No_Proc_Id MR_proc_none;
};
+#define MR_PROC_ID_EXISTS(proc_id) \
+ ((proc_id).MR_proc_none.MR_no_proc_id_flag != -1)
+
#define MR_PROC_ID_IS_UCI(proc_id) \
((MR_Unsigned) (proc_id).MR_proc_user.MR_user_pred_or_func \
> MR_FUNCTION)
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.93
diff -u -r1.93 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h 24 Aug 2005 09:07:11 -0000 1.93
+++ runtime/mercury_stack_layout.h 30 Aug 2005 10:37:08 -0000
@@ -904,7 +904,7 @@
} MR_Proc_Layout_Traversal;
#define MR_PROC_LAYOUT_HAS_PROC_ID(entry) \
- ((MR_Word) entry->MR_sle_user.MR_user_pred_or_func != -1)
+ (MR_PROC_ID_EXISTS(entry->MR_sle_proc_id))
#define MR_PROC_LAYOUT_HAS_EXEC_TRACE(entry) \
(MR_PROC_LAYOUT_HAS_PROC_ID(entry) \
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.71
diff -u -r1.71 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c 2 Mar 2005 01:20:20 -0000 1.71
+++ runtime/mercury_stack_trace.c 30 Aug 2005 10:37:08 -0000
@@ -548,17 +548,17 @@
fprintf(fp, "call event ");
MR_print_nondstackptr(fp,
&MR_event_num_framevar(base_maxfr));
- fprintf(fp, " => %d, ",
+ fprintf(fp, " => %" MR_INTEGER_LENGTH_MODIFIER "d, ",
MR_event_num_framevar(base_maxfr) + 1);
fprintf(fp, "call seq ");
MR_print_nondstackptr(fp,
&MR_call_num_framevar(base_maxfr));
- fprintf(fp, " => %d, ",
+ fprintf(fp, " => %" MR_INTEGER_LENGTH_MODIFIER "d, ",
MR_call_num_framevar(base_maxfr)),
fprintf(fp, "depth ");
MR_print_nondstackptr(fp,
&MR_call_depth_framevar(base_maxfr));
- fprintf(fp, " => %d\n",
+ fprintf(fp, " => %" MR_INTEGER_LENGTH_MODIFIER "d\n",
MR_call_depth_framevar(base_maxfr));
lines_dumped_so_far += 1;
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.70
diff -u -r1.70 mercury_trace_base.c
--- runtime/mercury_trace_base.c 24 Aug 2005 09:07:11 -0000 1.70
+++ runtime/mercury_trace_base.c 30 Aug 2005 10:37:08 -0000
@@ -357,17 +357,19 @@
switch (path_port) {
case PORT_ONLY:
- fprintf(fp, "%s %u",
+ fprintf(fp, "%s %" MR_INTEGER_LENGTH_MODIFIER "u",
MR_port_names[port], exec_count);
break;
case PATH_ONLY:
- fprintf(fp, "<%s> %u",
+ fprintf(fp,
+ "<%s> %" MR_INTEGER_LENGTH_MODIFIER "u",
MR_label_goal_path(label), exec_count);
break;
case PORT_AND_PATH:
- fprintf(fp, "%s <%s> %u",
+ fprintf(fp,
+ "%s <%s> %" MR_INTEGER_LENGTH_MODIFIER "u",
MR_port_names[port], MR_label_goal_path(label),
exec_count);
break;
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.61
diff -u -r1.61 mercury_type_info.c
--- runtime/mercury_type_info.c 14 Dec 2004 01:07:25 -0000 1.61
+++ runtime/mercury_type_info.c 30 Aug 2005 10:37:08 -0000
@@ -281,9 +281,9 @@
if (MR_PSEUDO_TYPEINFO_IS_VARIABLE(pti1) &&
MR_PSEUDO_TYPEINFO_IS_VARIABLE(pti2))
{
- if ((int) pti1 < (int) pti2) {
+ if ((MR_Integer) pti1 < (MR_Integer) pti2) {
return MR_COMPARE_LESS;
- } else if ((int) pti1 > (int) pti2) {
+ } else if ((MR_Integer) pti1 > (MR_Integer) pti2) {
return MR_COMPARE_GREATER;
} else {
return MR_COMPARE_EQUAL;
@@ -393,7 +393,7 @@
if (MR_PSEUDO_TYPEINFO_IS_VARIABLE(pti1) &&
MR_PSEUDO_TYPEINFO_IS_VARIABLE(pti2))
{
- if ((int) pti1 != (int) pti2) {
+ if ((MR_Integer) pti1 != (MR_Integer) pti2) {
return MR_FALSE;
} else {
return MR_TRUE;
@@ -876,15 +876,20 @@
MR_Word
MR_typeclass_ref_error(MR_Word tci, int n, const char *msg)
{
- fprintf(stderr, "n1: # of extra instance args: %d\n",
+ fprintf(stderr,
+ "n1: # of extra instance args: %" MR_INTEGER_LENGTH_MODIFIER "d\n",
MR_typeclass_info_num_extra_instance_args(tci));
- fprintf(stderr, "n1-n2: # of instance type vars: %d\n",
+ fprintf(stderr,
+ "n1-n2: # of instance type vars: %" MR_INTEGER_LENGTH_MODIFIER "d\n",
MR_typeclass_info_num_instance_type_vars(tci));
- fprintf(stderr, "n2: # of instance constraints: %d\n",
+ fprintf(stderr,
+ "n2: # of instance constraints: %" MR_INTEGER_LENGTH_MODIFIER "d\n",
MR_typeclass_info_num_instance_constraints(tci));
- fprintf(stderr, "n3: # of superclasses: %d\n",
+ fprintf(stderr,
+ "n3: # of superclasses: %" MR_INTEGER_LENGTH_MODIFIER "d\n",
MR_typeclass_info_num_superclasses(tci));
- fprintf(stderr, "n4: # of parameters: %d\n",
+ fprintf(stderr,
+ "n4: # of parameters: %" MR_INTEGER_LENGTH_MODIFIER "d\n",
MR_typeclass_info_num_params(tci));
fprintf(stderr, "access parameters: %s, %d\n", msg, n);
MR_fatal_error("typeclass_info reference error");
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.42
diff -u -r1.42 mercury_types.h
--- runtime/mercury_types.h 10 Jun 2005 06:38:31 -0000 1.42
+++ runtime/mercury_types.h 30 Aug 2005 10:37:08 -0000
@@ -216,6 +216,7 @@
typedef struct MR_User_Proc_Id_Struct MR_User_Proc_Id;
typedef struct MR_UCI_Proc_Id_Struct MR_UCI_Proc_Id;
+typedef struct MR_No_Proc_Id_Struct MR_No_Proc_Id;
typedef union MR_Proc_Id_Union MR_Proc_Id;
typedef struct MR_CallSiteStatic_Struct MR_CallSiteStatic;
Index: runtime/mercury_unify_compare_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_unify_compare_body.h,v
retrieving revision 1.40
diff -u -r1.40 mercury_unify_compare_body.h
--- runtime/mercury_unify_compare_body.h 30 Mar 2005 00:54:44 -0000 1.40
+++ runtime/mercury_unify_compare_body.h 30 Aug 2005 10:37:08 -0000
@@ -218,8 +218,13 @@
sectag = 0; \
break; \
case MR_SECTAG_VARIABLE: \
+ sectag = 0; /* avoid a warning */ \
MR_fatal_error("find_du_functor_desc(): " \
"attempt get functor desc of variable"); \
+ default: \
+ sectag = 0; /* avoid a warning */ \
+ MR_fatal_error("find_du_functor_desc(): " \
+ "unrecognised sectag locn"); \
} \
\
functor_desc = ptaglayout->MR_sectag_alternatives[sectag];\
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.87
diff -u -r1.87 mercury_trace.c
--- trace/mercury_trace.c 15 Aug 2005 08:52:50 -0000 1.87
+++ trace/mercury_trace.c 30 Aug 2005 10:37:08 -0000
@@ -802,6 +802,7 @@
*unsafe_retry = MR_FALSE;
}
} else {
+ found_io_action_counter = MR_FALSE; /* avoid a warning */
*unsafe_retry = MR_FALSE;
}
Index: trace/mercury_trace_completion.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_completion.c,v
retrieving revision 1.2
diff -u -r1.2 mercury_trace_completion.c
--- trace/mercury_trace_completion.c 7 Mar 2002 07:12:24 -0000 1.2
+++ trace/mercury_trace_completion.c 30 Aug 2005 10:37:08 -0000
@@ -426,10 +426,10 @@
#ifdef MR_NO_USE_READLINE
return NULL;
#else
- int state;
- state = (int) *data;
+ MR_Integer state;
+ state = (MR_Integer) *data;
*data = (MR_Completer_Data) 1;
- return filename_completion_function((char *) word, state);
+ return filename_completion_function((char *) word, (int) state);
#endif /* ! MR_NO_USE_READLINE */
}
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.213
diff -u -r1.213 mercury_trace_internal.c
--- trace/mercury_trace_internal.c 24 Aug 2005 09:07:14 -0000 1.213
+++ trace/mercury_trace_internal.c 30 Aug 2005 11:07:55 -0000
@@ -598,7 +598,7 @@
MR_bool *split, MR_bool *close_window, char ***words,
int *word_count, const char *cat, const char *item);
static MR_bool MR_trace_options_dd(MR_bool *assume_all_io_is_tabled,
- MR_Integer *default_depth, MR_Integer *num_nodes,
+ MR_Unsigned *default_depth, MR_Unsigned *num_nodes,
MR_Decl_Search_Mode *search_mode,
MR_bool *search_mode_was_set,
MR_bool *search_mode_requires_trace_counts,
@@ -1628,7 +1628,7 @@
MR_Event_Info *event_info, MR_Event_Details *event_details,
MR_Code **jumpaddr)
{
- int n;
+ MR_Unsigned n;
cmd->MR_trace_strict = MR_TRUE;
cmd->MR_trace_print_level = MR_default_print_level;
@@ -1637,7 +1637,7 @@
"forward", "goto"))
{
; /* the usage message has already been printed */
- } else if (word_count == 2 && MR_trace_is_natural_number(words[1], &n))
+ } else if (word_count == 2 && MR_trace_is_unsigned(words[1], &n))
{
if (MR_trace_event_number < n) {
cmd->MR_trace_cmd = MR_CMD_GOTO;
@@ -4859,8 +4859,8 @@
table_next = MR_int_hash_lookup(*table_cur_ptr, n);
if (table_next == NULL) {
fprintf(MR_mdb_out,
- "call table does not contain %d in argument position %d.\n",
- n, arg_num);
+ "call table does not contain %" MR_INTEGER_LENGTH_MODIFIER "d"
+ " in argument position %d.\n", n, arg_num);
return MR_FALSE;
}
@@ -5106,7 +5106,7 @@
switch (call_table_args[i].MR_cta_step) {
case MR_TABLE_STEP_INT:
- fprintf(MR_mdb_out, "%d",
+ fprintf(MR_mdb_out, "%" MR_INTEGER_LENGTH_MODIFIER "d",
call_table_args[i].MR_cta_int_cur_value);
break;
@@ -5514,7 +5514,7 @@
fprintf(fp, "type constructor %s.%s/%d",
type_ctor_info->MR_type_ctor_module_name,
type_ctor_info->MR_type_ctor_name,
- type_ctor_info->MR_type_ctor_arity);
+ (int) type_ctor_info->MR_type_ctor_arity);
rep = MR_type_ctor_rep(type_ctor_info);
if (print_rep) {
@@ -5562,7 +5562,7 @@
fprintf(fp, ", ");
}
fprintf(fp, "%s/%d", maybe_res_functor->MR_maybe_res_name,
- maybe_res_functor-> MR_maybe_res_arity);
+ (int) maybe_res_functor-> MR_maybe_res_arity);
}
fprintf(fp, "\n");
break;
@@ -5655,13 +5655,13 @@
{
MR_TypeCtorInfo type_ctor_info;
MR_PseudoTypeInfo *pseudo_args;
- int tvar_num;
+ MR_Integer tvar_num;
int arity;
int i;
if (MR_PSEUDO_TYPEINFO_IS_VARIABLE(pseudo)) {
- tvar_num = (int) pseudo;
- fprintf(fp, "T%d", tvar_num);
+ tvar_num = (MR_Integer) pseudo;
+ fprintf(fp, "T%d", (int) tvar_num);
} else {
type_ctor_info = MR_PSEUDO_TYPEINFO_GET_TYPE_CTOR_INFO(pseudo);
fprintf(fp, "%s.%s",
@@ -7138,7 +7138,7 @@
static MR_bool
MR_trace_options_dd(MR_bool *assume_all_io_is_tabled,
- MR_Integer *default_depth, MR_Integer *num_nodes,
+ MR_Unsigned *default_depth, MR_Unsigned *num_nodes,
MR_Decl_Search_Mode *search_mode, MR_bool *search_mode_was_set,
MR_bool *search_mode_requires_trace_counts,
char **pass_trace_counts_file, char **fail_trace_counts_file,
@@ -7158,7 +7158,7 @@
break;
case 'd':
- if (! MR_trace_is_natural_number(MR_optarg, default_depth)) {
+ if (! MR_trace_is_unsigned(MR_optarg, default_depth)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -7169,7 +7169,7 @@
break;
case 'n':
- if (! MR_trace_is_natural_number(MR_optarg, num_nodes)) {
+ if (! MR_trace_is_unsigned(MR_optarg, num_nodes)) {
MR_trace_usage(cat, item);
return MR_FALSE;
}
@@ -8543,9 +8543,9 @@
MR_trace_command_completer_next(const char *word, size_t word_len,
MR_Completer_Data *data)
{
- int command_index;
+ MR_Integer command_index;
- command_index = (int) *data;
+ command_index = (MR_Integer) *data;
while (1) {
const char *command;
const char *category;
Index: trace/mercury_trace_tables.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
retrieving revision 1.37
diff -u -r1.37 mercury_trace_tables.c
--- trace/mercury_trace_tables.c 14 Aug 2005 03:20:59 -0000 1.37
+++ trace/mercury_trace_tables.c 30 Aug 2005 10:37:08 -0000
@@ -1021,6 +1021,8 @@
/* +1 for the '.' */
module_len = strlen(module);
size += module_len + 1;
+ } else {
+ module_len = 0; /* avoid a warning */
}
completion = MR_malloc(size + 1);
Index: trace/mercury_trace_util.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.c,v
retrieving revision 1.15
diff -u -r1.15 mercury_trace_util.c
--- trace/mercury_trace_util.c 11 Jul 2005 07:30:31 -0000 1.15
+++ trace/mercury_trace_util.c 30 Aug 2005 10:54:39 -0000
@@ -48,6 +48,25 @@
}
MR_bool
+MR_trace_is_unsigned(const char *word, MR_Unsigned *value)
+{
+ if (word != NULL && MR_isdigit(*word)) {
+ *value = *word - '0';
+ word++;
+ while (MR_isdigit(*word)) {
+ *value = (*value * 10) + *word - '0';
+ word++;
+ }
+
+ if (*word == '\0') {
+ return MR_TRUE;
+ }
+ }
+
+ return MR_FALSE;
+}
+
+MR_bool
MR_trace_is_integer(const char *word, MR_Integer *value)
{
int sign;
@@ -158,14 +177,14 @@
{
#ifndef MR_HIGHLEVEL_CODE
fprintf(fp, "from event details:\n");
- fprintf(fp, "call event %d, call seq %d, depth %d\n",
- event_details->MR_event_number,
- event_details->MR_call_seqno,
- event_details->MR_call_depth);
+ fprintf(fp, "call event %ld, call seq %ld, depth %ld\n",
+ (long) event_details->MR_event_number,
+ (long) event_details->MR_call_seqno,
+ (long) event_details->MR_call_depth);
fprintf(fp, "from global vars:\n");
- fprintf(fp, "call event %d, call seq %d, depth %d\n",
- MR_trace_event_number,
- MR_trace_call_seqno,
- MR_trace_call_depth);
+ fprintf(fp, "call event %ld, call seq %ld, depth %ld\n",
+ (long) MR_trace_event_number,
+ (long) MR_trace_call_seqno,
+ (long) MR_trace_call_depth);
#endif
}
Index: trace/mercury_trace_util.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_util.h,v
retrieving revision 1.11
diff -u -r1.11 mercury_trace_util.h
--- trace/mercury_trace_util.h 10 Feb 2005 04:10:33 -0000 1.11
+++ trace/mercury_trace_util.h 30 Aug 2005 10:58:12 -0000
@@ -32,10 +32,14 @@
/*
** MR_trace_is_natural_number checks whether the given word contains a natural
** number, i.e. a sequence of digits. If yes, it puts the value of the number
-** in *value and returns MR_TRUE, otherwise it returns MR_FALSE.
+** in *value (an int) and returns MR_TRUE, otherwise it returns MR_FALSE.
+**
+** MR_trace_is_unsigned is similar, but puts the value of the number in a
+** location of type MR_Unsigned.
**
** MR_trace_is_integer is similar, but it also allows an initial minus sign
-** to denote a negative number.
+** to denote a negative number. It puts the value of the number in a location
+** of type MR_Integer.
**
** MR_trace_is_float is similar again, but it also allows an optional
** fractional part.
@@ -46,6 +50,8 @@
extern MR_bool MR_trace_is_natural_number(const char *word, int *value);
+extern MR_bool MR_trace_is_unsigned(const char *word, MR_Unsigned *value);
+
extern MR_bool MR_trace_is_integer(const char *word, MR_Integer *value);
extern MR_bool MR_trace_is_float(const char *word, MR_Float *value);
Index: trace/mercury_trace_vars.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_vars.c,v
retrieving revision 1.63
diff -u -r1.63 mercury_trace_vars.c
--- trace/mercury_trace_vars.c 11 Jul 2005 07:30:31 -0000 1.63
+++ trace/mercury_trace_vars.c 30 Aug 2005 10:37:08 -0000
@@ -690,7 +690,7 @@
details->MR_var_fullname, details->MR_var_basename,
details->MR_var_num_suffix,
details->MR_var_has_suffix ? "yes" : "no");
- fprintf(out, "typeinfo %p, value %x\n",
+ fprintf(out, "typeinfo %p, value %" MR_INTEGER_LENGTH_MODIFIER "x\n",
details->MR_var_type, details->MR_var_value);
}
@@ -1508,10 +1508,10 @@
MR_trace_var_completer_next(const char *word, size_t word_len,
MR_Completer_Data *data)
{
- int slot;
+ MR_Integer slot;
const char *var_name;
- slot = (int) *data;
+ slot = (MR_Integer) *data;
while (slot < MR_point.MR_point_var_count) {
var_name = MR_point.MR_point_vars[slot].MR_var_fullname;
slot++;
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list