[m-rev.] for review: fix sub-module build problem

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 16 04:15:44 AEDT 2001


How about the following?

----------

Estimated hours taken: 2
Branches: main

When compiling a module which contains a nested sub-module you must
build the all the dependencies of the sub-module's .int file
(including, in particular, the parent's .int0) before
attempting to build the parent's .int file.

compiler/modules.m:
	When generating the .d file for a submodule,
	generate rules to say that the parent modules' .date files
	depend on same things as the submodule's .int file.

Workspace: /home/earth/fjh/ws-earth4/mercury
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.205
diff -u -d -r1.205 modules.m
--- compiler/modules.m	15 Nov 2001 16:02:14 -0000	1.205
+++ compiler/modules.m	15 Nov 2001 17:06:41 -0000
@@ -2043,19 +2043,35 @@
 				"endif"
 		]),
 
+		% The .date and .date0 files depend on the .int0 files
+		% for the parent modules, and the .int3 files for the
+		% directly and indirectly imported modules.
+		%
+		% For nested sub-modules, the `.date' files for the
+		% parent modules also depend on the same things as the
+		% `.date' files for this module, since all the `.date'
+		% files will get produced by a single mmc command.
+		% XXX The same is true for the `.date0' files, but
+		% including those dependencies here might result in
+		% cyclic dependencies(?).
+
 		module_name_to_file_name(ModuleName, ".date", no,
 						DateFileName),
 		module_name_to_file_name(ModuleName, ".date0", no,
 						Date0FileName),
 		io__write_strings(DepStream, [
 				"\n\n", DateFileName, " ",
-				Date0FileName, " : ",
+				Date0FileName
+		]),
+		write_dependencies_list(ParentDeps, ".date", DepStream),
+		io__write_strings(DepStream, [
+				" : ",
 				SourceFileName
 		]),
 		write_dependencies_list(ParentDeps, ".int0", DepStream),
 		write_dependencies_list(LongDeps, ".int3", DepStream),
 		write_dependencies_list(ShortDeps, ".int3", DepStream),
-			
+
 		module_name_to_file_name(ModuleName, ".dir", no, DirFileName),
 		module_name_to_split_c_file_name(ModuleName, 0, ".$O",
 			SplitCObj0FileName),

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  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