[m-rev.] diff: fix `mmc --make' bug

Simon Taylor stayl at cs.mu.OZ.AU
Wed Apr 24 06:42:21 AEST 2002


Estimated hours taken: 1
Branches: main

compiler/make.module_target.m:
	The `.int0' file for a module depends on the `.int0' file for the
	parent module, which caused circular dependencies with nested
	sub-modules, resulting in a compiler abort. The circular dependencies
	are now removed from the list of dependencies to make.
	Test case: tests/valid/foreign_type_spec.m.

Index: make.module_target.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make.module_target.m,v
retrieving revision 1.3
diff -u -u -r1.3 make.module_target.m
--- make.module_target.m	20 Mar 2002 12:36:36 -0000	1.3
+++ make.module_target.m	23 Apr 2002 20:33:23 -0000
@@ -85,6 +85,17 @@
 			union_deps(target_dependencies(Globals, FileType)),
 			ModulesToCheck, DepsSuccess, set__init,
 			DepFiles0, Info4, Info5),
+		{ TargetFile = _ - private_interface ->
+			% Avoid circular dependencies (the `.int0' files
+			% for the nested sub-modules depend on this module's
+			% `.int0' file).
+			DepFilesToMake = set__to_sorted_list(
+				set__delete_list(DepFiles0, 
+				make_dependency_list(ModulesToCheck,
+					private_interface)))
+		;
+			DepFilesToMake = set__to_sorted_list(DepFiles0)
+		},
 		{ DepFiles = set__to_sorted_list(DepFiles0) },
 
 		debug_msg(
@@ -118,10 +129,10 @@
 			{ DepsResult = error }
 		;
 			foldl2_maybe_stop_at_error(KeepGoing,
-				make_module_target, DepFiles,
+				make_module_target, DepFilesToMake,
 				_, Info8, Info9),
 			check_dependencies(TargetFileName,
-				MaybeOldestTimestamp, DepFiles,
+				MaybeOldestTimestamp, DepFilesToMake,
 				DepsResult0, Info9, Info10),
 			{ DepsResult =
 				( DepsSuccess = yes -> DepsResult0 ; error ) }
--------------------------------------------------------------------------
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