[m-rev.] fix for mmc --make-interface --warn-tail-recursion
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Feb 15 19:43:13 AEDT 2002
Estimated hours taken: 1
Branches: main
compiler/handle_options.m:
Don't complain about --warn-non-tail-recursion if we're just
building interface files.
compiler/globals.m:
Remove the implied modes for globals__lookup_bool_option
and globals__io_lookup_bool_option; declaring these modes
explicitly here would not have any efficiency benefit, and
makes taking the address of those procedures (e.g. to pass
to list__foldl, as is now done in handle_options.m) more difficult.
Workspace: /home/ceres/fjh/mercury
Index: compiler/globals.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.47
diff -u -d -r1.47 globals.m
--- compiler/globals.m 11 Nov 2001 10:10:16 -0000 1.47
+++ compiler/globals.m 14 Feb 2002 06:04:22 -0000
@@ -83,9 +83,7 @@
:- pred globals__lookup_option(globals::in, option::in, option_data::out)
is det.
-:- pred globals__lookup_bool_option(globals, option, bool).
-:- mode globals__lookup_bool_option(in, in, out) is det.
-:- mode globals__lookup_bool_option(in, in, in) is semidet. % implied
+:- pred globals__lookup_bool_option(globals::in, option::in, bool::out) is det.
:- pred globals__lookup_int_option(globals::in, option::in, int::out) is det.
:- pred globals__lookup_string_option(globals::in, option::in, string::out)
is det.
@@ -159,9 +157,8 @@
:- pred globals__io_lookup_option(option::in, option_data::out,
io__state::di, io__state::uo) is det.
-:- pred globals__io_lookup_bool_option(option, bool, io__state, io__state).
-:- mode globals__io_lookup_bool_option(in, out, di, uo) is det.
-:- mode globals__io_lookup_bool_option(in, in, di, uo) is semidet. % implied
+:- pred globals__io_lookup_bool_option(option::in, bool::out,
+ io__state::di, io__state::uo) is det.
:- pred globals__io_lookup_int_option(option::in, int::out,
io__state::di, io__state::uo) is det.
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.129
diff -u -d -r1.129 handle_options.m
--- compiler/handle_options.m 12 Feb 2002 16:36:00 -0000 1.129
+++ compiler/handle_options.m 14 Feb 2002 06:02:04 -0000
@@ -809,15 +809,39 @@
% we are expecting some to be missing.
option_implies(use_opt_files, warn_missing_opt_files, bool(no)),
- % --warn-non-tail-recursion requires both --high-level-code
- % and --optimize-tailcalls. It also doesn't work if you use
- % --errorcheck-only.
- option_requires(warn_non_tail_recursion, highlevel_code, bool(yes),
- "--warn-non-tail-recursion requires --high-level-code"),
- option_requires(warn_non_tail_recursion, optimize_tailcalls, bool(yes),
- "--warn-non-tail-recursion requires --optimize-tailcalls"),
+ % --warn-non-tail-recursion doesn't work if you use --errorcheck-only,
+ % because the warnings are issued in the MLDS back-end, rather than
+ % as part of semantic analysis on the HLDS.
option_requires(warn_non_tail_recursion, errorcheck_only, bool(no),
- "--warn-non-tail-recursion is incompatible with --errorcheck-only"),
+ "--warn-non-tail-recursion is incompatible with --errorcheck-only"),
+
+ % --warn-non-tail-recursion also requires both --high-level-code
+ % and --optimize-tailcalls. But don't complain about this if
+ % we're not compiling (e.g. if we're just generating the
+ % interface files), since in that case you wouldn't get the
+ % warnings anyway. Being quiet in this case avoids problems
+ % if you put --warn-non-tail-recursion in MCFLAGS, since
+ % Mmake will pass $(MCFLAGS) but not $(GRADEFLAGS) to mmc
+ % when building the interface files.
+ { NonCompileOptionList = [convert_to_mercury,
+ generate_dependencies, make_interface,
+ make_short_interface, make_private_interface,
+ make_optimization_interface,
+ make_transitive_opt_interface,
+ typecheck_only] },
+ list__map_foldl(globals__io_lookup_bool_option, NonCompileOptionList,
+ NotCompilingBoolList),
+ { NotCompiling = bool__or_list(NotCompilingBoolList) },
+ ( { NotCompiling = yes } ->
+ []
+ ;
+ option_requires(warn_non_tail_recursion,
+ highlevel_code, bool(yes),
+ "--warn-non-tail-recursion requires --high-level-code"),
+ option_requires(warn_non_tail_recursion,
+ optimize_tailcalls, bool(yes),
+ "--warn-non-tail-recursion requires --optimize-tailcalls")
+ ),
% The backend foreign languages depend on the target.
(
--
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