[m-rev.] diff: add a new option, --no-warn-unresolved-polymorphism
Julien Fischer
juliensf at csse.unimelb.edu.au
Sun May 4 00:53:42 AEST 2008
Estimated hours taken: 0.5
Branches: main
Add a new option, --no-warn-unresolved-polymorphism, to stop the
compiler emitting warnings about unresolved polymorphism.
compiler/options.m:
compiler/post_typecheck.m:
Add the option and make reporting unresolved polymorphism
conditional on its value.
doc/user_guide.texi:
Document the new option.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid//no_warn_unresolved_poly.m:
Test the new option.
Julien.
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.614
diff -u -r1.614 options.m
--- compiler/options.m 28 Apr 2008 07:23:12 -0000 1.614
+++ compiler/options.m 3 May 2008 14:37:48 -0000
@@ -125,6 +125,7 @@
; warn_insts_without_matching_type
; warn_unused_imports
; inform_ite_instead_of_switch
+ ; warn_unresolved_polymorphism
% Verbosity options
; verbose
@@ -970,7 +971,8 @@
% the compiler itself which is compiled
% with --halt-at-warn by default.
warn_unused_imports - bool(no),
- inform_ite_instead_of_switch - bool(no)
+ inform_ite_instead_of_switch - bool(no),
+ warn_unresolved_polymorphism - bool(yes)
]).
option_defaults_2(verbosity_option, [
% Verbosity Options
@@ -1751,6 +1753,7 @@
warn_insts_without_matching_type).
long_option("warn-unused-imports", warn_unused_imports).
long_option("inform-ite-instead-of-switch", inform_ite_instead_of_switch).
+long_option("warn-unresolved-polymorphism", warn_unresolved_polymorphism).
% verbosity options
long_option("verbose", verbose).
@@ -3174,7 +3177,9 @@
"\tbeen marked as obsolete.",
"--inform-ite-instead-of-switch",
"\tGenerate informational messages for if-then-elses that could be",
- "\treplaced by switches."
+ "\treplaced by switches.",
+ "--no-warn-unresolved-polymorphism",
+ "\tDo not warn about unresolved polymorphism."
]).
:- pred options_help_verbosity(io::di, io::uo) is det.
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.126
diff -u -r1.126 post_typecheck.m
--- compiler/post_typecheck.m 28 Apr 2008 00:50:54 -0000 1.126
+++ compiler/post_typecheck.m 3 May 2008 14:37:48 -0000
@@ -252,12 +252,17 @@
UnresolvedVarsTypes = []
;
UnresolvedVarsTypes = [_ | _],
+ module_info_get_globals(ModuleInfo, Globals),
+ globals.lookup_bool_option(Globals, warn_unresolved_polymorphism,
+ WarnUnresolvedPolymorphism),
(
ReportErrs = yes,
+ WarnUnresolvedPolymorphism = yes
+ ->
report_unresolved_type_warning(ModuleInfo, PredId, !.PredInfo,
VarSet, UnresolvedVarsTypes, !Specs)
;
- ReportErrs = no
+ true
),
% Bind all the type variables in `Set' to `void' ...
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.561
diff -u -r1.561 user_guide.texi
--- doc/user_guide.texi 28 Apr 2008 07:23:12 -0000 1.561
+++ doc/user_guide.texi 3 May 2008 14:37:48 -0000
@@ -6282,6 +6282,11 @@
Generate informational messages for if-then-elses that could be
replaced by switches.
+ at sp 1
+ at item --no-warn-unresolved-polymorphism
+ at findex --no-warn-unresolved-polymorphism
+Do not warn about unresolved polymorphism.
+
@end table
@node Verbosity options
Index: tests/valid/Mercury.options
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/Mercury.options,v
retrieving revision 1.48
diff -u -r1.48 Mercury.options
--- tests/valid/Mercury.options 17 Mar 2008 01:56:11 -0000 1.48
+++ tests/valid/Mercury.options 3 May 2008 14:37:48 -0000
@@ -94,6 +94,7 @@
MCFLAGS-mostly_uniq_mode_inf = --infer-all
MCFLAGS-mpj6 = --infer-all
MCFLAGS-no_warn_obsolete = --no-warn-obsolete
+MCFLAGS-no_warn_unresolved_poly = --no-warn-unresolved-polymorphism
MCFLAGS-opt_det_warn = --intermodule-optimization --halt-at-warn
MCFLAGS-opt_det_warn2 = --intermodule-optimization --halt-at-warn --no-warn-inferred-erroneous
MCFLAGS-par_dupelim = --optimize-dups
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.212
diff -u -r1.212 Mmakefile
--- tests/valid/Mmakefile 25 Apr 2008 17:22:31 -0000 1.212
+++ tests/valid/Mmakefile 3 May 2008 14:37:48 -0000
@@ -177,6 +177,7 @@
nested_mod_type_bug \
nested_module_bug \
no_warn_obsolete \
+ no_warn_unresolved_poly \
nondet_live \
opt_det_warn \
overloading \
Index: tests/valid/no_warn_unresolved_poly.m
===================================================================
RCS file: tests/valid/no_warn_unresolved_poly.m
diff -N tests/valid/no_warn_unresolved_poly.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/valid/no_warn_unresolved_poly.m 3 May 2008 14:37:48 -0000
@@ -0,0 +1,12 @@
+% Test the --no-warn-unresolved-polymorphism option.
+%
+:- module no_warn_unresolved_poly.
+:- interface.
+
+:- func foo = int.
+
+:- implementation.
+
+:- import_module list.
+
+foo = list.length([]).
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list