[m-rev.] diff: fix ANSI conformance problem with declarative debugger

Fergus Henderson fjh at cs.mu.OZ.AU
Mon May 7 12:56:50 AEST 2001


I found this one by looking at the logs from the automated tests with lcc.

----------

Estimated hours taken: 0.5
Branches: main

Fix a bug that broke tests/debugger/declarative/*_term_dep.m
when compiled with lcc.

runtime/mercury_stack_layout.h:
	Change the type of the proc_rep field from MR_Word to MR_Word *,
	to avoid casts from pointers to integers in static initializers,
	which are not allowed in ANSI/ISO C.

trace/mercury_trace_internal.c:
trace/mercury_trace_declarative.c:
	Add some casts to match the change to mercury_stack_layout.h.

Workspace: /mnt/mars/home/mars/fjh/ws1/mercury
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.48
diff -u -d -r1.48 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	2001/01/21 03:24:54	1.48
+++ runtime/mercury_stack_layout.h	2001/05/07 02:45:52
@@ -493,7 +493,10 @@
 **
 ** The proc_rep field contains a representation of the body of the procedure
 ** as a Mercury term of type goal_rep, defined in program_representation.m.
-** If will be 0 if no such representation is available.
+** Note that the type of this field is `MR_Word *', not `MR_Word',
+** for the same reasons that MR_mkword() has type `MR_Word *' rather
+** than `MR_Word' (see the comment in runtime/mercury_tags.h).
+** It will be a null pointer if no such representation is available.
 **
 ** The used_var_names field points to an array that contains offsets
 ** into the string table, with the offset at index i-1 giving the name of
@@ -573,7 +576,7 @@
 typedef	struct MR_Exec_Trace_Struct {
 	const MR_Label_Layout	*MR_exec_call_label;
 	const MR_Module_Layout	*MR_exec_module_layout;
-	MR_Word			MR_exec_proc_rep;
+	MR_Word			*MR_exec_proc_rep;
 	const MR_int_least16_t	*MR_exec_used_var_names;
 	MR_int_least16_t	MR_exec_max_var_num;
 	MR_int_least16_t	MR_exec_max_r_num;
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.43
diff -u -d -r1.43 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	2001/04/26 18:44:13	1.43
+++ trace/mercury_trace_declarative.c	2001/05/07 02:42:54
@@ -468,7 +468,7 @@
 		at_depth_limit = FALSE;
 	}
 
-	proc_rep = layout->MR_sll_entry->MR_sle_proc_rep;
+	proc_rep = (MR_Word) layout->MR_sll_entry->MR_sle_proc_rep;
 	atom = MR_decl_make_atom(layout, event_info->MR_saved_regs,
 			MR_PORT_CALL);
 	MR_TRACE_CALL_MERCURY(
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.102
diff -u -d -r1.102 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	2001/04/26 18:44:13	1.102
+++ trace/mercury_trace_internal.c	2001/05/07 02:41:28
@@ -1759,13 +1759,13 @@
 		const MR_Proc_Layout	*entry;
 
 		entry = event_info->MR_event_sll->MR_sll_entry;
-		if (entry->MR_sle_proc_rep == 0) {
+		if (entry->MR_sle_proc_rep == NULL) {
 			fprintf(MR_mdb_out,
 				"current procedure has no body info\n");
 		} else {
 			MR_trace_browse_internal(
 				ML_goal_rep_type(),
-				entry->MR_sle_proc_rep,
+				(MR_Word) entry->MR_sle_proc_rep,
 				MR_BROWSE_CALLER_PRINT,
 				MR_BROWSE_DEFAULT_FORMAT);
 		}
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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