[m-rev.] trivial diff: mercury_compile.m: fix c2init call

Simon Taylor stayl at cs.mu.OZ.AU
Wed Nov 28 01:08:13 AEDT 2001


Estimated hours taken: 2
Branches: main

Improvements for the code which creates the `_init.o' files.

compiler/modules.m:
compiler/mercury_compile.m:
	When c2init is invoked the command line used is recorded
	in a file <module>_init.c.cmd.
	
	Update the `_init.c' file if the c2init command
	line has changed since the last time it was run,
	for example if the user has added C2INITFLAGS=--trace.	

compiler/mercury_compile.m:
	Separate out the code to create the `_init.o' file into
	a new predicate.

	Pass the grade to c2init (the initialization code generated
	by c2init is grade dependent).

	Use the `--init-c-file' c2init option rather than `-o'.

Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.226
diff -u -u -r1.226 mercury_compile.m
--- mercury_compile.m	26 Nov 2001 10:57:31 -0000	1.226
+++ mercury_compile.m	27 Nov 2001 13:52:59 -0000
@@ -3841,6 +3841,8 @@
 	    ;
 		TraceOpt = ""
 	    },
+	    globals__io_get_globals(Globals),
+	    { compute_grade(Globals, Grade) },
 
 	    globals__io_lookup_accumulating_option(init_file_directories,
 			InitFileDirsList),
@@ -3854,8 +3856,9 @@
 
 	    join_module_list(Modules, ".c", [], CFileNames),
 	    { MkInitCmd = string__append_list(
-	    	["c2init ", TraceOpt, " -o ", InitCFileName, " ",
-		InitFileDirs, " ", InitFileNames, " " | CFileNames]) },
+	    	["c2init --grade ", Grade, " ", TraceOpt,
+		" --init-c-file ", InitCFileName, " ", InitFileDirs, " ",
+		InitFileNames, " " | CFileNames]) },
 	    invoke_shell_command(MkInitCmd, MkInitOK),
 	    maybe_report_stats(Stats),
 	    ( { MkInitOK = no } ->
@@ -3871,8 +3874,6 @@
 		    report_error("compilation of init file failed.")
 		;
 		    maybe_write_string(Verbose, "% Linking...\n"),
-		    globals__io_get_globals(Globals),
-		    { compute_grade(Globals, Grade) },
 		    globals__io_lookup_bool_option(target_debug, Target_Debug),
 		    { Target_Debug = yes ->
 		    	Target_Debug_Opt = "--no-strip "
--------------------------------------------------------------------------
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