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

David Overton dmo at cs.mu.OZ.AU
Tue Aug 13 14:35:32 AEST 2002


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.
> 
> 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 }

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

$ mmc -v test

[...]

% Creating initialization file...
% Invoking system command `c2init --grade asm_fast.gc --mercury-standard-library-directory /home/dmo/install/latest-cvs/lib/mercury -O2 --init-c-file test_init.c.tmp -I -O2/modules -I /home/dmo/install/latest-cvs/lib/mercury/modules  -O2.init -O2 test.c'...
% done.
mkinit: invalid option -- O
Usage: mkinit [options] files...
Options: [-a] [-c maxcalls] [-o filename] [-w entry] [-i] [-l] [-t] [-x]

This causes the `configure' test for a sufficiently recent compiler to
fail.

Simon, can you look into this?


David
-- 
David Overton                  Uni of Melbourne     +61 3 8344 9159
dmo at cs.mu.oz.au                Monash Uni (Clayton) +61 3 9905 5779
http://www.cs.mu.oz.au/~dmo    Mobile Phone         +61 4 0337 4393
--------------------------------------------------------------------------
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