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

Simon Taylor stayl at cs.mu.OZ.AU
Mon Aug 12 12:07:50 AEST 2002


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.

Index: handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.146
diff -u -u -r1.146 handle_options.m
--- handle_options.m	7 Aug 2002 13:11:49 -0000	1.146
+++ handle_options.m	11 Aug 2002 10:11:05 -0000
@@ -129,9 +129,7 @@
 process_options(Args0, OptionArgs, Args, Result) :-
 	OptionOps = option_ops(short_option, long_option,
 		option_defaults, special_handler),
-	% default to optimization level `-O2'
-	Args1 = ["-O2" | Args0],
-	getopt__process_options(OptionOps, Args1,
+	getopt__process_options(OptionOps, Args0,
 		OptionArgs, Args, Result).
 
 :- pred dump_arguments(list(string), io__state, io__state).
Index: options_file.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options_file.m,v
retrieving revision 1.10
diff -u -u -r1.10 options_file.m
--- options_file.m	8 Aug 2002 06:25:47 -0000	1.10
+++ options_file.m	11 Aug 2002 10:13:56 -0000
@@ -901,7 +901,9 @@
 		{ ExtraFlagsResult = yes(ExtraFlags) },
 		{ ModuleFlagsResult = yes(TargetFlags) }
 	->
-		{ Result = yes(list__condense([DefaultFlags,
+		% Default to `-O2', even when mercury_compile
+		% is called directly, not by the mmc script.
+		{ Result = yes(list__condense([["-O2" | 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