[m-rev.] diff: fix default -O2 setting

Simon Taylor stayl at cs.mu.OZ.AU
Tue Aug 13 15:52:23 AEST 2002


On 13-Aug-2002, David Overton <dmo at cs.mu.OZ.AU> wrote:
> On Mon, Aug 12, 2002 at 12:07:50PM +1000, Simon Taylor wrote:
> > 
> > Estimated hours taken: 0.5
> > Branches: main
> > 
> > compiler/handle_options.m:
> > compiler/options_file.m:
> > 	The compiler was treating the default setting of -O2 in
> > 	handle_options.m as if it were given on the command line,
> > 	so it was overriding settings in Mercury.options.
> > 	Prepend it to the value of the DEFAULT_MCFLAGS variable
> > 	instead.

> This change seems to cause the -O2 option to be passed to c2init
> (multiple times).  E.g.

Sorry about that.

Simon.


Estimated hours taken: 0.2
Branches: main

compiler/options_file.m:
	My last change was prepending `-O2' to all
	variables, not just MCFLAGS.

Index: options_file.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options_file.m,v
retrieving revision 1.11
diff -u -u -r1.11 options_file.m
--- options_file.m	12 Aug 2002 02:07:09 -0000	1.11
+++ options_file.m	13 Aug 2002 05:42:00 -0000
@@ -730,8 +730,10 @@
 	->
 		assoc_list__from_corresponding_lists(VariableTypes,
 			Values, VariableValues),
-		Result = yes(list__condense(
-			list__map(convert_to_mmc_options, VariableValues)))
+		% Default to `-O2', even when mercury_compile
+		% is called directly, not by the mmc script.
+		Result = yes(["-O2" | list__condense(
+			list__map(convert_to_mmc_options, VariableValues))])
 	;
 		Result = no
 	}.
@@ -901,9 +903,7 @@
 		{ ExtraFlagsResult = yes(ExtraFlags) },
 		{ ModuleFlagsResult = yes(TargetFlags) }
 	->
-		% Default to `-O2', even when mercury_compile
-		% is called directly, not by the mmc script.
-		{ Result = yes(list__condense([["-O2" | DefaultFlags],
+		{ Result = yes(list__condense([DefaultFlags,
 				Flags, ExtraFlags, TargetFlags])) }
 	;
 		{ Result = no }
--------------------------------------------------------------------------
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