[m-rev.] for review: printing error messages in order
Zoltan Somogyi
zs at csse.unimelb.edu.au
Mon Jul 27 15:45:14 AEST 2009
With this diff, I am asking for two things. First is a review by anyone.
However, I am also asking for practical tryouts. I am now using a version
of the compiler with this diff on my laptop, but since I don't use mmc --make,
I am also installing it on goliath for mmc --make users to try out. This
should provide a more thorough test than just a review.
The directory you would need to add to the front of your path to use
this test version of the compiler is
/home/goliath/workspaces/zs/test_install/bin
The install should be done by about 6 or 7pm.
Zoltan.
Make all the pre-HLDS and front-end passes of the compiler gather up
all their error messages and print them all at once, in sorted order,
unless the user asked for progress messages, in which case we print all the
errors accumulated so far just before each printing each progress message.
This should make error message output significantly easier to interpret.
compiler/module_imports.m:
Add a new field to the module_imports structure (the main pre-HLDS
representation of the parse tree) to hold the list of error messages
generated so far.
Rename the module_imports structure as the module_and_imports
structure, since it holds the module's items as well as information
about its imports.
Update the access predicates to encourage getting the items, the error
messages and the error indication all at once.
Add mechanisms for updating the error indication and the error
messages.
Add a distinguishing prefix to the field names of the structure.
compiler/error_util.m:
compiler/hlds_error_util.m:
Add facilities for printing error messages in batches.
In error_util.m, delete an unused argument from several predicates.
compiler/mercury_compile.m:
compiler/intermod.m:
Gather up error messages to print in batches.
In the parts of the code affected by the above, explicitly pass
around a globals structure, instead of having all the predicates
get it of the I/O state. Since some code (e.g. the start recompilation
system) still uses the copy in the I/O state, we ensure that this copy
is kept in sync with the explicitly passed around copy.
Rename some predicates to avoid ambiguities.
compiler/modules.m:
Return errors in the module_and_imports structure, not separately.
Gather up error messages to print in batches.
Explicitly pass around globals structures.
compiler/read_modules.m:
Rename the read_modules type to have_read_module_map, since this is
more explicit.
For each module we have already read, remember not just the items we
read from it, but also the error messages we generated during the
reading. This is so these error messages can be printed together with
other errors from other sources.
Explicitly pass around globals structures.
compiler/prog_io.m:
compiler/purity.m:
compiler/stratify.m:
Rename several predicates to avoid ambiguities.
compiler/modes.m:
Change the interface of the main predicate to avoid the need for a
lambda expression in mercury_compile.m.
compiler/recompilation.check.m:
Add a distinguishing prefix to the field names of a structure.
Fix a wrong definition of this_file.
Conform to the changes above.
compiler/compiler_target_code.m:
compiler/deps_map.m:
compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds.m:
compiler/make_hlds_passes.m:
compiler/trans_opt.m:
compiler/write_deps_file.m:
Conform to the changes above.
compiler/add_clause.m:
compiler/add_pragma.m:
compiler/state_var.m:
Add an import of io, since their parent make_hlds.m does not import io
anymore.
In add_pragma, update an error message that did not mention trseg as
well as tr as indicating a trailing grade.
tests/hard_coded/Mmakefile:
Move two tests that cannot pass in debug grades due to the lack of tail
recursion to the list containing the other tests with this property.
tests/invalid/test_feature_set.err_exp:
Update the expected output of this test to expect the update error
message from add_pragma.
tests/invalid/test_feature_set.err_exp2:
Add this file as the expected output for trailing grades.
tests/invalid/*.err_exp:
tests/warnings/*.err_exp:
Update the expected output for many tests to expect the error messages
in sorted order.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/add_clause.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_clause.m,v
retrieving revision 1.55
diff -u -b -r1.55 add_clause.m
--- compiler/add_clause.m 11 Jun 2009 07:00:05 -0000 1.55
+++ compiler/add_clause.m 22 Jul 2009 15:11:30 -0000
@@ -84,6 +84,7 @@
:- import_module assoc_list.
:- import_module bool.
:- import_module int.
+:- import_module io.
:- import_module map.
:- import_module pair.
:- import_module set.
@@ -1124,7 +1125,7 @@
report_svar_unify_error(Context, VarSet, StateVar, !Specs) :-
Name = varset.lookup_name(VarSet, StateVar),
- Pieces = [nl, words("Error:"), fixed("!" ++ Name),
+ Pieces = [words("Error:"), fixed("!" ++ Name),
words("cannot appear as a unification argument."), nl,
words("You probably meant"), fixed("!." ++ Name),
words("or"), fixed("!:" ++ Name), suffix(".")],
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.93
diff -u -b -r1.93 add_pragma.m
--- compiler/add_pragma.m 16 Jul 2009 07:27:11 -0000 1.93
+++ compiler/add_pragma.m 25 Jul 2009 12:10:09 -0000
@@ -186,6 +186,7 @@
:- import_module bimap.
:- import_module bool.
:- import_module int.
+:- import_module io.
:- import_module list.
:- import_module map.
:- import_module multi_map.
@@ -3850,10 +3851,8 @@
current_grade_supports_concurrency(Globals, IsConcurrencySupported),
(
IsConcurrencySupported = no,
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("supports concurrent execution.")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that supports concurrent execution.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
@@ -3866,14 +3865,11 @@
SinglePrecFloat),
(
SinglePrecFloat = no,
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("uses single precision floats.")
- ],
- VerbosePieces = [
- words("Grades that use single precision floats contain the"),
- words("grade modifier"), quote("spf"), suffix(".")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that uses single precision floats.")],
+ VerbosePieces = [words("Grades that use single precision floats"),
+ words("contain the grade modifier"),
+ quote("spf"), suffix(".")],
Msg = simple_msg(Context,
[always(Pieces), verbose_only(VerbosePieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
@@ -3887,14 +3883,11 @@
SinglePrecFloat),
(
SinglePrecFloat = yes,
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("uses double precision floats.")
- ],
- VerbosePieces = [
- words("Grades that use double precision floats do not"),
- words("contain the grade modifier"), quote("spf"), suffix(".")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that uses double precision floats.")],
+ VerbosePieces = [words("Grades that use double precision floats"),
+ words("do not contain the grade modifier"),
+ quote("spf"), suffix(".")],
Msg = simple_msg(Context,
[always(Pieces), verbose_only(VerbosePieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
@@ -3907,10 +3900,8 @@
current_grade_supports_tabling(Globals, IsTablingSupported),
(
IsTablingSupported = no,
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("supports memoisation.")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that supports memoisation.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
@@ -3922,10 +3913,8 @@
current_grade_supports_par_conj(Globals, IsParConjSupported),
(
IsParConjSupported = no,
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("supports executing conjuntions in parallel.")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that supports executing conjuntions in parallel.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
@@ -3937,14 +3926,11 @@
globals.lookup_bool_option(Globals, use_trail, UseTrail),
(
UseTrail = no,
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("supports trailing.")
- ],
- VerbosePieces = [
- words("Grades that support trailing contain the"),
- words("grade modifier"), quote("tr"), suffix(".")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that supports trailing.")],
+ VerbosePieces = [words("Grades that support trailing contain"),
+ words("the grade modifiers"), quote("tr"),
+ words("or"), quote("trseg"), suffix(".")],
Msg = simple_msg(Context,
[always(Pieces), verbose_only(VerbosePieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
@@ -3964,10 +3950,8 @@
->
true
;
- Pieces = [
- words("Error: this module must be compiled using the"),
- words("strict sequential semantics.")
- ],
+ Pieces = [words("Error: this module must be compiled using"),
+ words("the strict sequential semantics.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
@@ -3980,7 +3964,7 @@
% This is okay because this feature is only of interest with the
% C or asm backends. We ignore it if the target language is
% something else.
- %
+
( GC_Method = gc_automatic
; GC_Method = gc_boehm
; GC_Method = gc_boehm_debug
@@ -3990,10 +3974,8 @@
( GC_Method = gc_accurate
; GC_Method = gc_none
),
- Pieces = [
- words("Error: this module must be compiled in a grade that"),
- words("uses conservative garbage collection.")
- ],
+ Pieces = [words("Error: this module must be compiled in a grade"),
+ words("that uses conservative garbage collection.")],
Msg = simple_msg(Context, [always(Pieces)]),
Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
!:Specs = [Spec | !.Specs]
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.143
diff -u -b -r1.143 compile_target_code.m
--- compiler/compile_target_code.m 7 Jul 2009 01:08:59 -0000 1.143
+++ compiler/compile_target_code.m 22 Jul 2009 05:27:33 -0000
@@ -73,7 +73,7 @@
% compile_csharp_file(ErrorStream, C#File, DLLFile, Succeeded)
%
-:- pred compile_csharp_file(io.output_stream::in, module_imports::in,
+:- pred compile_csharp_file(io.output_stream::in, module_and_imports::in,
file_name::in, file_name::in, bool::out, io::di, io::uo) is det.
% compile_erlang_file(ErrorStream, ErlangFile, Succeeded)
@@ -336,17 +336,18 @@
string.append_list(list.condense(list.map(
(func(DLLDir) = ["/lib:", DLLDir, " "]), DLLDirs))),
- ( mercury_std_library_module_name(Imports ^ module_name) ->
+ ( mercury_std_library_module_name(Imports ^ mai_module_name) ->
Prefix = "/addmodule:"
;
Prefix = "/r:"
),
ForeignDeps = list.map(
(func(M) =
- foreign_import_module_name_from_module(M, Imports ^ module_name)),
- Imports ^ foreign_import_modules),
- ReferencedDlls = referenced_dlls(Imports ^ module_name,
- Imports ^ int_deps ++ Imports ^ impl_deps ++ ForeignDeps),
+ foreign_import_module_name_from_module(M,
+ Imports ^ mai_module_name)),
+ Imports ^ mai_foreign_import_modules),
+ ReferencedDlls = referenced_dlls(Imports ^ mai_module_name,
+ Imports ^ mai_int_deps ++ Imports ^ mai_impl_deps ++ ForeignDeps),
list.map_foldl(
(pred(Mod::in, Result::out, IO0::di, IO::uo) is det :-
module_name_to_file_name(Mod, ".dll", do_not_create_dirs,
Index: compiler/deps_map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deps_map.m,v
retrieving revision 1.1
diff -u -b -r1.1 deps_map.m
--- compiler/deps_map.m 21 Jul 2008 03:10:06 -0000 1.1
+++ compiler/deps_map.m 22 Jul 2009 07:56:13 -0000
@@ -16,6 +16,7 @@
:- module parse_tree.deps_map.
:- interface.
+:- import_module libs.globals.
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.file_names.
:- import_module parse_tree.module_imports.
@@ -34,7 +35,7 @@
:- type deps
---> deps(
have_processed,
- module_imports
+ module_and_imports
).
:- type submodule_kind
@@ -49,7 +50,7 @@
%-----------------------------------------------------------------------------%
-:- pred generate_deps_map(module_name::in, maybe_search::in,
+:- pred generate_deps_map(globals::in, module_name::in, maybe_search::in,
deps_map::in, deps_map::out, io::di, io::uo) is det.
% Insert a new entry into the deps_map. If the module already occurred
@@ -73,8 +74,8 @@
%
% XXX This shouldn't need to be exported.
%
-:- pred insert_into_deps_map(module_imports::in, deps_map::in, deps_map::out)
- is det.
+:- pred insert_into_deps_map(module_and_imports::in,
+ deps_map::in, deps_map::out) is det.
%-----------------------------------------------------------------------------%
@@ -104,8 +105,8 @@
( list.last(Ancestors, Parent) ->
map.lookup(DepsMap, ModuleName, deps(_, ModuleImports)),
map.lookup(DepsMap, Parent, deps(_, ParentImports)),
- ModuleFileName = ModuleImports ^ source_file_name,
- ParentFileName = ParentImports ^ source_file_name,
+ ModuleFileName = ModuleImports ^ mai_source_file_name,
+ ParentFileName = ParentImports ^ mai_source_file_name,
( ModuleFileName = ParentFileName ->
Kind = nested_submodule
;
@@ -117,31 +118,34 @@
%-----------------------------------------------------------------------------%
-generate_deps_map(ModuleName, Search, !DepsMap, !IO) :-
- generate_deps_map_loop(set.make_singleton_set(ModuleName), Search,
+generate_deps_map(Globals, ModuleName, Search, !DepsMap, !IO) :-
+ generate_deps_map_loop(Globals, set.make_singleton_set(ModuleName), Search,
!DepsMap, !IO).
-:- pred generate_deps_map_loop(set(module_name)::in, maybe_search::in,
+:- pred generate_deps_map_loop(globals::in,
+ set(module_name)::in, maybe_search::in,
deps_map::in, deps_map::out, io::di, io::uo) is det.
-generate_deps_map_loop(!.Modules, Search, !DepsMap, !IO) :-
+generate_deps_map_loop(Globals, !.Modules, Search, !DepsMap, !IO) :-
( set.remove_least(!.Modules, Module, !:Modules) ->
- generate_deps_map_step(Module, !Modules, Search, !DepsMap, !IO),
- generate_deps_map_loop(!.Modules, Search, !DepsMap, !IO)
+ generate_deps_map_step(Globals, Module, !Modules, Search, !DepsMap,
+ !IO),
+ generate_deps_map_loop(Globals, !.Modules, Search, !DepsMap, !IO)
;
% If we can't remove the smallest, then the set of modules to be
% processed is empty.
true
).
-:- pred generate_deps_map_step(module_name::in,
+:- pred generate_deps_map_step(globals::in, module_name::in,
set(module_name)::in, set(module_name)::out,
maybe_search::in, deps_map::in, deps_map::out, io::di, io::uo) is det.
-generate_deps_map_step(Module, !Modules, Search, !DepsMap, !IO) :-
+generate_deps_map_step(Globals, Module, !Modules, Search, !DepsMap, !IO) :-
% Look up the module's dependencies, and determine whether
% it has been processed yet.
- lookup_dependencies(Module, Search, Done, !DepsMap, ModuleImports, !IO),
+ lookup_dependencies(Globals, Module, Search, Done, !DepsMap,
+ ModuleImports, !IO),
% If the module hadn't been processed yet, then add its imports, parents,
% and public children to the list of dependencies we need to generate,
@@ -153,12 +157,12 @@
list.map(
(func(foreign_import_module_info(_, ImportedModule, _))
= ImportedModule),
- ModuleImports ^ foreign_import_modules),
+ ModuleImports ^ mai_foreign_import_modules),
list.condense(
- [ModuleImports ^ parent_deps,
- ModuleImports ^ int_deps,
- ModuleImports ^ impl_deps,
- ModuleImports ^ public_children, % a.k.a. incl_deps
+ [ModuleImports ^ mai_parent_deps,
+ ModuleImports ^ mai_int_deps,
+ ModuleImports ^ mai_impl_deps,
+ ModuleImports ^ mai_public_children, % a.k.a. incl_deps
ForeignImportedModules],
ModulesToAdd),
% We could keep a list of the modules we have already processed
@@ -174,40 +178,40 @@
% If we don't know its dependencies, read the module and
% save the dependencies in the dependency map.
%
-:- pred lookup_dependencies(module_name::in, maybe_search::in,
- have_processed::out, deps_map::in, deps_map::out, module_imports::out,
+:- pred lookup_dependencies(globals::in, module_name::in, maybe_search::in,
+ have_processed::out, deps_map::in, deps_map::out, module_and_imports::out,
io::di, io::uo) is det.
-lookup_dependencies(Module, Search, Done, !DepsMap, ModuleImports, !IO) :-
+lookup_dependencies(Globals, Module, Search, Done, !DepsMap, ModuleImports,
+ !IO) :-
( map.search(!.DepsMap, Module, deps(DonePrime, ModuleImportsPrime)) ->
Done = DonePrime,
ModuleImports = ModuleImportsPrime
;
- read_dependencies(Module, Search, ModuleImportsList, !IO),
+ read_dependencies(Globals, Module, Search, ModuleImportsList, !IO),
list.foldl(insert_into_deps_map, ModuleImportsList, !DepsMap),
map.lookup(!.DepsMap, Module, deps(Done, ModuleImports))
).
insert_into_deps_map(ModuleImports, !DepsMap) :-
- module_imports_get_module_name(ModuleImports, ModuleName),
+ module_and_imports_get_module_name(ModuleImports, ModuleName),
svmap.set(ModuleName, deps(not_yet_processed, ModuleImports), !DepsMap).
% Read a module to determine the (direct) dependencies of that module
% and any nested sub-modules it contains.
%
-:- pred read_dependencies(module_name::in, maybe_search::in,
- list(module_imports)::out, io::di, io::uo) is det.
+:- pred read_dependencies(globals::in, module_name::in, maybe_search::in,
+ list(module_and_imports)::out, io::di, io::uo) is det.
-read_dependencies(ModuleName, Search, ModuleImportsList, !IO) :-
- read_module_ignore_errors(ModuleName, ".m",
+read_dependencies(Globals, ModuleName, Search, ModuleImportsList, !IO) :-
+ read_module_ignore_errors(Globals, ModuleName, ".m",
"Getting dependencies for module", Search, do_not_return_timestamp,
Items0, Error, FileName0, _, !IO),
- globals.io_get_globals(Globals, !IO),
(
Items0 = [],
Error = fatal_module_errors
->
- read_module_ignore_errors(ModuleName, ".int",
+ read_module_ignore_errors(Globals, ModuleName, ".int",
"Getting dependencies for module interface", Search,
do_not_return_timestamp, Items, _Error, FileName, _, !IO),
SubModuleList = [ModuleName - Items]
@@ -219,6 +223,6 @@
),
assoc_list.keys(SubModuleList, SubModuleNames),
list.map(init_dependencies(FileName, ModuleName, SubModuleNames,
- Error, Globals), SubModuleList, ModuleImportsList).
+ [], Error, Globals), SubModuleList, ModuleImportsList).
%-----------------------------------------------------------------------------%
Index: compiler/error_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/error_util.m,v
retrieving revision 1.70
diff -u -b -r1.70 error_util.m
--- compiler/error_util.m 21 Jul 2009 04:10:40 -0000 1.70
+++ compiler/error_util.m 23 Jul 2009 11:20:25 -0000
@@ -240,6 +240,11 @@
%-----------------------------------------------------------------------------%
+:- pred maybe_write_out_errors_no_module(bool::in, globals::in,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
+
+%-----------------------------------------------------------------------------%
+
% write_error_spec(Spec, Globals, !NumWarnings, !NumErrors, !IO):
% write_error_specs(Specs, Globals, !NumWarnings, !NumErrors, !IO):
%
@@ -703,22 +708,35 @@
%-----------------------------------------------------------------------------%
+maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO) :-
+ % maybe_write_out_errors in hlds_error_util.m is a HLDS version
+ % of this predicate. The documentstion is in that file.
+ (
+ Verbose = no
+ ;
+ Verbose = yes,
+ % XXX _NumErrors
+ write_error_specs(!.Specs, Globals,
+ 0, _NumWarnings, 0, _NumErrors, !IO),
+ !:Specs = []
+ ).
+
+%-----------------------------------------------------------------------------%
+
write_error_spec(Spec, Globals, !NumWarnings, !NumErrors, !IO) :-
- write_error_specs([Spec], Globals, !NumWarnings, !NumErrors, !IO).
+ do_write_error_spec(Globals, Spec, !NumWarnings, !NumErrors, !IO).
write_error_specs(Specs0, Globals, !NumWarnings, !NumErrors, !IO) :-
sort_error_specs(Specs0, Specs),
- io.get_exit_status(OrigExitStatus, !IO),
- list.foldl3(do_write_error_spec(Globals, OrigExitStatus), Specs,
+ list.foldl3(do_write_error_spec(Globals), Specs,
!NumWarnings, !NumErrors, !IO).
-:- pred do_write_error_spec(globals::in, int::in, error_spec::in,
+:- pred do_write_error_spec(globals::in, error_spec::in,
int::in, int::out, int::in, int::out, io::di, io::uo) is det.
-do_write_error_spec(Globals, OrigExitStatus, Spec, !NumWarnings, !NumErrors,
- !IO) :-
+do_write_error_spec(Globals, Spec, !NumWarnings, !NumErrors, !IO) :-
Spec = error_spec(Severity, _, Msgs),
- do_write_error_msgs(Msgs, Globals, OrigExitStatus, treat_as_first,
+ do_write_error_msgs(Msgs, Globals, treat_as_first,
have_not_printed_anything, PrintedSome, !IO),
MaybeActual = actual_error_severity(Globals, Severity),
(
@@ -760,14 +778,13 @@
---> lower_next_initial
; do_not_lower_next_initial.
-:- pred do_write_error_msgs(list(error_msg)::in, globals::in, int::in,
+:- pred do_write_error_msgs(list(error_msg)::in, globals::in,
maybe_treat_as_first::in,
maybe_printed_something::in, maybe_printed_something::out,
io::di, io::uo) is det.
-do_write_error_msgs([], _Globals, _OrigExitStatus, _First, !PrintedSome, !IO).
-do_write_error_msgs([Msg | Msgs], Globals, OrigExitStatus, !.First,
- !PrintedSome, !IO) :-
+do_write_error_msgs([], _Globals, _First, !PrintedSome, !IO).
+do_write_error_msgs([Msg | Msgs], Globals, !.First, !PrintedSome, !IO) :-
(
Msg = simple_msg(SimpleContext, Components),
MaybeContext = yes(SimpleContext),
@@ -786,19 +803,18 @@
),
Indent = ExtraIndentLevel * indent_increment,
write_msg_components(Components, MaybeContext, Indent, Globals,
- OrigExitStatus, !First, !PrintedSome, !IO),
- do_write_error_msgs(Msgs, Globals, OrigExitStatus, !.First, !PrintedSome,
- !IO).
+ !First, !PrintedSome, !IO),
+ do_write_error_msgs(Msgs, Globals, !.First, !PrintedSome, !IO).
:- pred write_msg_components(list(error_msg_component)::in,
- maybe(prog_context)::in, int::in, globals::in, int::in,
+ maybe(prog_context)::in, int::in, globals::in,
maybe_treat_as_first::in, maybe_treat_as_first::out,
maybe_printed_something::in, maybe_printed_something::out,
io::di, io::uo) is det.
-write_msg_components([], _, _, _, _, !First, !PrintedSome, !IO).
+write_msg_components([], _, _, _, !First, !PrintedSome, !IO).
write_msg_components([Component | Components], MaybeContext, Indent, Globals,
- OrigExitStatus, !First, !PrintedSome, !IO) :-
+ !First, !PrintedSome, !IO) :-
(
Component = always(ComponentPieces),
do_write_error_pieces(!.First, MaybeContext, Indent,
@@ -810,7 +826,7 @@
globals.lookup_bool_option(Globals, Option, OptionValue),
( OptionValue = RequiredValue ->
write_msg_components(EmbeddedComponents, MaybeContext, Indent,
- Globals, OrigExitStatus, !First, !PrintedSome, !IO)
+ Globals, !First, !PrintedSome, !IO)
;
true
)
@@ -849,7 +865,7 @@
!:PrintedSome = printed_something
),
write_msg_components(Components, MaybeContext, Indent, Globals,
- OrigExitStatus, !First, !PrintedSome, !IO).
+ !First, !PrintedSome, !IO).
:- pred unsafe_cast_to_io_pred(pred(io, io)::in,
pred(io, io)::out(pred(di, uo) is det)) is det.
Index: compiler/hlds_error_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_error_util.m,v
retrieving revision 1.26
diff -u -b -r1.26 hlds_error_util.m
--- compiler/hlds_error_util.m 19 Jan 2007 07:04:13 -0000 1.26
+++ compiler/hlds_error_util.m 22 Jul 2009 17:17:10 -0000
@@ -21,10 +21,13 @@
:- import_module hlds.hlds_module.
:- import_module hlds.hlds_pred.
+:- import_module libs.globals.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.error_util.
:- import_module assoc_list.
+:- import_module bool.
+:- import_module io.
:- import_module list.
:- import_module pair.
@@ -65,6 +68,48 @@
assoc_list(pred_proc_id, prog_context)) = list(format_component).
%-----------------------------------------------------------------------------%
+%
+% Every possible path of execution in mercury_compile.m should call
+% definitely_write_out_errors exactly once, just after the compiler
+% has finished doing all the things that can generate error reports.
+%
+% If Verbose = no, then this call is intended to write out all at once
+% all the error specifications accumulated until then. They are written out
+% all at once so that write_error_specs can sort them by context.
+%
+% If Verbose = yes, then keeping all the error messages until the end would
+% be confusing, since we would be reporting that e.g. the program had type
+% errors *before* printing the type error messages. In that case, we want to
+% print (using maybe_write_out_errors or its pre-HLDS twin) all the
+% accumulated errors before each message to the user.
+%
+% This applies to *all* messages.
+%
+% - The calls to maybe_write_out_errors before a message that announces
+% the completion (and success or failure) of a phase obviously report
+% the errors (if any) discovered by the phase.
+%
+% - The calls to maybe_write_out_errors before a message that announces
+% the phase the compiler is about to enter serve to write out any messages
+% from previous phases that have not yet been written out.
+%
+% We could require each phase to write out the errors it discovers when it
+% finishes (if Verbose = yes, that is), but that would eliminate any
+% opportunity to group and sort together the error messages of two or more
+% adjacent phases that are *not* separated by a message to the user even with
+% Verbose = yes. Since the cost of calling maybe_write_out_errors
+% when there is nothing to print is so low (a few dozen instructions),
+% we can easily afford to incur it unnecessarily once per compiler phase.
+
+:- pred definitely_write_out_errors(globals::in,
+ module_info::in, module_info::out, list(error_spec)::in,
+ io::di, io::uo) is det.
+
+:- pred maybe_write_out_errors(bool::in, globals::in,
+ module_info::in, module_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
+
+%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
:- implementation.
@@ -84,14 +129,13 @@
%-----------------------------------------------------------------------------%
- % NOTE: the code of this predicate duplicates the functionality of
- % hlds_out.write_pred_id. Changes here should be made there as well.
- %
-describe_one_pred_name(Module, ShouldModuleQualify, PredId) = Pieces :-
- module_info_pred_info(Module, PredId, PredInfo),
+describe_one_pred_name(ModuleInfo, ShouldModuleQualify, PredId) = Pieces :-
+ module_info_pred_info(ModuleInfo, PredId, PredInfo),
Pieces = describe_one_pred_info_name(ShouldModuleQualify, PredInfo).
describe_one_pred_info_name(ShouldModuleQualify, PredInfo) = Pieces :-
+ % NOTE The code of this predicate duplicates the functionality of
+ % hlds_out.write_pred_id. Changes here should be made there as well.
PredName = pred_info_name(PredInfo),
ModuleName = pred_info_module(PredInfo),
Arity = pred_info_orig_arity(PredInfo),
@@ -137,9 +181,9 @@
Pieces = Prefix ++ [sym_name_and_arity(PredSymName / OrigArity)]
).
-describe_one_pred_name_mode(Module, ShouldModuleQualify, PredId, InstVarSet,
- ArgModes0) = Pieces :-
- module_info_pred_info(Module, PredId, PredInfo),
+describe_one_pred_name_mode(ModuleInfo, ShouldModuleQualify, PredId,
+ InstVarSet, ArgModes0) = Pieces :-
+ module_info_pred_info(ModuleInfo, PredId, PredInfo),
ModuleName = pred_info_module(PredInfo),
PredName = pred_info_name(PredInfo),
Arity = pred_info_orig_arity(PredInfo),
@@ -169,33 +213,38 @@
ArgModesPart], Descr),
Pieces = [words(Descr)].
-describe_several_pred_names(Module, ShouldModuleQualify, PredIds) = Pieces :-
- PiecesList = list.map(describe_one_pred_name(Module, ShouldModuleQualify),
+describe_several_pred_names(ModuleInfo, ShouldModuleQualify, PredIds)
+ = Pieces :-
+ PiecesList = list.map(
+ describe_one_pred_name(ModuleInfo, ShouldModuleQualify),
PredIds),
Pieces = component_lists_to_pieces(PiecesList).
-describe_one_proc_name(Module, ShouldModuleQualify, proc(PredId, ProcId))
+describe_one_proc_name(ModuleInfo, ShouldModuleQualify, proc(PredId, ProcId))
= Pieces :-
- PredPieces = describe_one_pred_name(Module, ShouldModuleQualify, PredId),
+ PredPieces = describe_one_pred_name(ModuleInfo, ShouldModuleQualify,
+ PredId),
proc_id_to_int(ProcId, ProcIdInt),
string.int_to_string(ProcIdInt, ProcIdStr),
Pieces = PredPieces ++ [words("mode"), words(ProcIdStr)].
-describe_one_proc_name_mode(Module, ShouldModuleQualify, proc(PredId, ProcId))
- = Pieces :-
- module_info_pred_proc_info(Module, PredId, ProcId, _, ProcInfo),
+describe_one_proc_name_mode(ModuleInfo, ShouldModuleQualify,
+ proc(PredId, ProcId)) = Pieces :-
+ module_info_pred_proc_info(ModuleInfo, PredId, ProcId, _, ProcInfo),
proc_info_get_argmodes(ProcInfo, ArgModes),
proc_info_get_inst_varset(ProcInfo, InstVarSet),
- Pieces = describe_one_pred_name_mode(Module, ShouldModuleQualify,
+ Pieces = describe_one_pred_name_mode(ModuleInfo, ShouldModuleQualify,
PredId, InstVarSet, ArgModes).
-describe_several_proc_names(Module, ShouldModuleQualify, PPIds) = Pieces :-
- PiecesList = list.map(describe_one_proc_name(Module, ShouldModuleQualify),
+describe_several_proc_names(ModuleInfo, ShouldModuleQualify, PPIds) = Pieces :-
+ PiecesList = list.map(
+ describe_one_proc_name(ModuleInfo, ShouldModuleQualify),
PPIds),
Pieces = component_lists_to_pieces(PiecesList).
-describe_one_call_site(Module, ShouldModuleQualify, PPId - Context) = Pieces :-
- ProcNamePieces = describe_one_proc_name(Module, ShouldModuleQualify,
+describe_one_call_site(ModuleInfo, ShouldModuleQualify, PPId - Context)
+ = Pieces :-
+ ProcNamePieces = describe_one_proc_name(ModuleInfo, ShouldModuleQualify,
PPId),
term.context_file(Context, FileName),
term.context_line(Context, LineNumber),
@@ -203,8 +252,9 @@
Pieces = ProcNamePieces ++
[words("at"), fixed(FileName ++ ":" ++ LineNumberStr)].
-describe_several_call_sites(Module, ShouldModuleQualify, Sites) = Pieces :-
- PiecesList = list.map(describe_one_call_site(Module, ShouldModuleQualify),
+describe_several_call_sites(ModuleInfo, ShouldModuleQualify, Sites) = Pieces :-
+ PiecesList = list.map(
+ describe_one_call_site(ModuleInfo, ShouldModuleQualify),
Sites),
Pieces = component_lists_to_pieces(PiecesList).
@@ -233,6 +283,26 @@
%-----------------------------------------------------------------------------%
+definitely_write_out_errors(Globals, !HLDS, Specs, !IO) :-
+ write_error_specs(Specs, Globals,
+ 0, _NumWarnings, 0, NumErrors, !IO),
+ module_info_incr_num_errors(NumErrors, !HLDS).
+
+maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO) :-
+ % maybe_write_out_errors_no_module in error_util.m is a pre-HLDS version
+ % of this predicate.
+ (
+ Verbose = no
+ ;
+ Verbose = yes,
+ write_error_specs(!.Specs, Globals,
+ 0, _NumWarnings, 0, NumErrors, !IO),
+ module_info_incr_num_errors(NumErrors, !HLDS),
+ !:Specs = []
+ ).
+
+%-----------------------------------------------------------------------------%
+
:- func this_file = string.
this_file = "hlds_error_util.m".
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.245
diff -u -b -r1.245 intermod.m
--- compiler/intermod.m 11 Jun 2009 07:00:11 -0000 1.245
+++ compiler/intermod.m 24 Jul 2009 07:43:04 -0000
@@ -39,6 +39,7 @@
:- interface.
:- import_module hlds.hlds_module.
+:- import_module libs.globals.
:- import_module parse_tree.error_util.
:- import_module parse_tree.module_imports.
:- import_module parse_tree.prog_io.
@@ -61,7 +62,8 @@
% Add the items from the .opt files of imported modules to
% the items for this module.
%
-:- pred grab_opt_files(module_imports::in, module_imports::out, bool::out,
+:- pred grab_opt_files(globals::in,
+ module_and_imports::in, module_and_imports::out, bool::out,
io::di, io::uo) is det.
% Make sure that local preds which have been exported in the .opt
@@ -74,10 +76,11 @@
---> opt_file
; trans_opt_file.
- % update_error_status(OptFileType, FileName, Error, Specs, !Status):
+ % update_error_status(Globals, OptFileType, FileName,
+ % ModuleSpecs, !Specs, ModuleError, !Error):
%
% Work out whether any fatal errors have occurred while reading
- % `.opt' files, updating Status0 if there were fatal errors.
+ % `.opt' files, updating !Error if there were fatal errors.
%
% A missing `.opt' file is only a fatal error if
% `--warn-missing-opt-files --halt-at-warn' was passed the compiler.
@@ -86,8 +89,9 @@
%
% This is also used by trans_opt.m for reading `.trans_opt' files.
%
-:- pred update_error_status(opt_file_type::in, string::in, module_error::in,
- list(error_spec)::in, bool::in, bool::out, io::di, io::uo) is det.
+:- pred update_error_status(globals::in, opt_file_type::in, string::in,
+ list(error_spec)::in, list(error_spec)::in, list(error_spec)::out,
+ module_error::in, bool::in, bool::out) is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -179,9 +183,8 @@
do_adjust_pred_import_status(!.IntermodInfo, !ModuleInfo)
)
),
- %
+
% Restore the option setting that we overrode above.
- %
globals.io_set_option(line_numbers, bool(LineNumbers), !IO).
%-----------------------------------------------------------------------------%
@@ -2306,29 +2309,31 @@
% Read in and process the optimization interfaces.
%
-grab_opt_files(!Module, FoundError, !IO) :-
+grab_opt_files(Globals, !Module, FoundError, !IO) :-
% Read in the .opt files for imported and ancestor modules.
- ModuleName = !.Module ^ module_name,
- Ancestors0 = !.Module ^ parent_deps,
- InterfaceDeps0 = !.Module ^ int_deps,
- ImplementationDeps0 = !.Module ^ impl_deps,
+ ModuleName = !.Module ^ mai_module_name,
+ Ancestors0 = !.Module ^ mai_parent_deps,
+ InterfaceDeps0 = !.Module ^ mai_int_deps,
+ ImplementationDeps0 = !.Module ^ mai_impl_deps,
OptFiles = list.sort_and_remove_dups(list.condense(
[Ancestors0, InterfaceDeps0, ImplementationDeps0])),
- globals.io_lookup_bool_option(read_opt_files_transitively, Transitive,
- !IO),
+ globals.lookup_bool_option(Globals, read_opt_files_transitively,
+ Transitive),
ModulesProcessed = set.insert(set.sorted_list_to_set(OptFiles),
ModuleName),
- read_optimization_interfaces(Transitive, ModuleName, OptFiles,
- ModulesProcessed, cord.empty, OptItemsCord, no, OptError, !IO),
- OptItems = cord.list(OptItemsCord),
+ read_optimization_interfaces(Globals, Transitive, ModuleName, OptFiles,
+ ModulesProcessed, cord.empty, OptItemsCord, [], OptSpecs, no, OptError,
+ !IO),
% Append the items to the current item list, using a `opt_imported'
- % psuedo-declaration to let make_hlds know the opt_imported stuff
+ % pseudo-declaration to let make_hlds know the opt_imported stuff
% is coming.
- module_imports_get_items(!.Module, Items0),
- Items1 = Items0 ++ cord.from_list([
- make_pseudo_decl(md_opt_imported) | OptItems]),
- module_imports_set_items(Items1, !Module),
+ %
+ % XXX Using this mechanism to let make_hlds know this is a bad design.
+ OptItems = cord.list(OptItemsCord),
+ AddedItems = [make_pseudo_decl(md_opt_imported) | OptItems],
+ module_and_imports_add_items(cord.from_list(AddedItems), !Module),
+ module_and_imports_add_specs(OptSpecs, !Module),
% Get the :- pragma unused_args(...) declarations created when writing
% the .opt file for the current module. These are needed because we can
@@ -2341,17 +2346,17 @@
% condition reuse actually has none. But we have to maintain the interface
% for modules that use the conditional reuse information from the `.opt'
% file.
- globals.io_lookup_bool_option(intermod_unused_args, UnusedArgs, !IO),
- globals.io_lookup_bool_option(structure_reuse_analysis, StructureReuse,
- !IO),
+ globals.lookup_bool_option(Globals, intermod_unused_args, UnusedArgs),
+ globals.lookup_bool_option(Globals, structure_reuse_analysis,
+ StructureReuse),
(
( UnusedArgs = yes
; StructureReuse = yes
)
->
- read_optimization_interfaces(no, ModuleName, [ModuleName],
- set.init, cord.empty, LocalItemsCord, no, UA_SR_Error, !IO),
- LocalItems = cord.list(LocalItemsCord),
+ read_optimization_interfaces(Globals, no, ModuleName, [ModuleName],
+ set.init, cord.empty, LocalItemsCord, [], LocalSpecs,
+ no, UA_SR_Error, !IO),
KeepPragma = (pred(Item::in) is semidet :-
Item = item_pragma(ItemPragma),
ItemPragma = item_pragma_info(_, Pragma, _, _),
@@ -2363,11 +2368,9 @@
Pragma = pragma_structure_reuse(_, _, _, _, _, _)
)
),
- list.filter(KeepPragma, LocalItems, PragmaItems),
-
- module_imports_get_items(!.Module, Items2),
- Items = Items2 ++ cord.from_list(PragmaItems),
- module_imports_set_items(Items, !Module)
+ cord.filter(KeepPragma, LocalItemsCord, PragmaItemsCord),
+ module_and_imports_add_items(PragmaItemsCord, !Module),
+ module_and_imports_add_specs(LocalSpecs, !Module)
;
UA_SR_Error = no
),
@@ -2375,7 +2378,7 @@
% Read .int0 files required by the `.opt' files.
Int0Files = list.delete_all(
list.condense(list.map(get_ancestors, OptFiles)), ModuleName),
- process_module_private_interfaces(ReadModules, Int0Files,
+ process_module_private_interfaces(Globals, ReadModules, Int0Files,
make_pseudo_decl(md_opt_imported),
make_pseudo_decl(md_opt_imported),
[], AncestorImports1,
@@ -2383,7 +2386,6 @@
% Figure out which .int files are needed by the .opt files
get_dependencies(OptItems, NewImportDeps0, NewUseDeps0),
- globals.io_get_globals(Globals, !IO),
get_implicit_dependencies(OptItems, Globals,
NewImplicitImportDeps0, NewImplicitUseDeps0),
NewDeps = list.sort_and_remove_dups(list.condense(
@@ -2393,17 +2395,19 @@
% Read in the .int, and .int2 files needed by the .opt files.
map.init(ReadModules),
- process_module_long_interfaces(ReadModules, must_be_qualified,
+ process_module_long_interfaces(Globals, ReadModules, must_be_qualified,
NewDeps, ".int",
make_pseudo_decl(md_opt_imported), make_pseudo_decl(md_opt_imported),
[], NewIndirectDeps, [], NewImplIndirectDeps, !Module, !IO),
- process_module_short_interfaces_and_impls_transitively(ReadModules,
- NewIndirectDeps ++ NewImplIndirectDeps, ".int2",
+ process_module_short_interfaces_and_impls_transitively(Globals,
+ ReadModules, NewIndirectDeps ++ NewImplIndirectDeps, ".int2",
make_pseudo_decl(md_opt_imported), make_pseudo_decl(md_opt_imported),
!Module, !IO),
% Figure out whether anything went wrong.
- module_imports_get_error(!.Module, FoundError0),
+ % XXX We should try to put all the relevant error indications into !Module,
+ % and let our caller figure out what to do with them.
+ module_and_imports_get_results(!.Module, _Items, _Specs, FoundError0),
(
( FoundError0 \= no_module_errors
; OptError = yes
@@ -2415,16 +2419,18 @@
FoundError = no
).
-:- pred read_optimization_interfaces(bool::in, module_name::in,
+:- pred read_optimization_interfaces(globals::in, bool::in, module_name::in,
list(module_name)::in, set(module_name)::in,
- cord(item)::in, cord(item)::out, bool::in, bool::out,
- io::di, io::uo) is det.
-
-read_optimization_interfaces(_, _, [], _, !Items, !Error, !IO).
-read_optimization_interfaces(Transitive, ModuleName,
- [ModuleToRead | ModulesToRead], ModulesProcessed0, !Items, !Error,
- !IO) :-
- globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+ cord(item)::in, cord(item)::out,
+ list(error_spec)::in, list(error_spec)::out,
+ bool::in, bool::out, io::di, io::uo) is det.
+
+read_optimization_interfaces(_, _, _, [], _, !Items, !Specs, !Error, !IO).
+read_optimization_interfaces(Globals, Transitive, ModuleName,
+ [ModuleToRead | ModulesToRead], ModulesProcessed0,
+ !Items, !Specs, !Error, !IO) :-
+ globals.lookup_bool_option(Globals, very_verbose, VeryVerbose),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals, !Specs, !IO),
maybe_write_string(VeryVerbose,
"% Reading optimization interface for module", !IO),
maybe_write_string(VeryVerbose, " `", !IO),
@@ -2434,13 +2440,14 @@
maybe_flush_output(VeryVerbose, !IO),
module_name_to_search_file_name(ModuleToRead, ".opt", FileName, !IO),
- prog_io.read_opt_file(FileName, ModuleToRead, OptItems, Specs, ModuleError,
- !IO),
- update_error_status(opt_file, FileName, ModuleError, Specs, !Error, !IO),
+ actually_read_opt_file(FileName, ModuleToRead, OptItems, OptSpecs,
+ OptError, !IO),
+ update_error_status(Globals, opt_file, FileName,
+ OptSpecs, !Specs, OptError, !Error),
!:Items = !.Items ++ cord.from_list(OptItems),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals, !Specs, !IO),
maybe_write_string(VeryVerbose, "% done.\n", !IO),
- globals.io_get_globals(Globals, !IO),
(
Transitive = yes,
get_dependencies(OptItems, NewImportDeps0, NewUseDeps0),
@@ -2457,21 +2464,33 @@
ModulesProcessed = ModulesProcessed0,
NewDeps = []
),
- read_optimization_interfaces(Transitive, ModuleName,
- NewDeps ++ ModulesToRead, ModulesProcessed, !Items, !Error, !IO).
+ read_optimization_interfaces(Globals, Transitive, ModuleName,
+ NewDeps ++ ModulesToRead, ModulesProcessed,
+ !Items, !Specs, !Error, !IO).
-update_error_status(FileType, FileName, ModuleError, Specs,
- !Error, !IO) :-
+update_error_status(_Globals, FileType, FileName,
+ ModuleSpecs, !Specs, ModuleError, !Error) :-
(
ModuleError = no_module_errors
+ % OptSpecs contains no errors. I (zs) don't know whether it could
+ % contain any warnings or informational messages, but if it could,
+ % we should add those error_specs to !Specs. Not doing so preserves
+ % old behavior.
;
ModuleError = some_module_errors,
- globals.io_get_globals(Globals, !IO),
- % XXX _NumWarnings _NumErrors
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors, !IO),
+ !:Specs = ModuleSpecs ++ !.Specs,
!:Error = yes
;
ModuleError = fatal_module_errors,
+ % We get here if we couldn't find and/or open the file.
+ % ModuleSpecs will already contain an error_severity error_spec
+ % about that, with more details than the message we generate below,
+ % but the test case hard_coded/intermod_unused_args insists on
+ % there being no error, only a warning, and on the text below.
+ % That is why we do not add ModuleSpecs to !Specs here.
+ %
+ % I (zs) don't know whether adding a version of ModuleSpecs (possibly
+ % with downgraded severity) to !Specs would be a better idea.
(
FileType = opt_file,
WarningOption = warn_missing_opt_files
@@ -2479,22 +2498,14 @@
FileType = trans_opt_file,
WarningOption = warn_missing_trans_opt_files
),
- globals.io_lookup_bool_option(WarningOption, DoWarn, !IO),
- (
- DoWarn = yes,
- io.write_string("Warning: cannot open `", !IO),
- io.write_string(FileName, !IO),
- io.write_string("'.\n", !IO),
- globals.io_lookup_bool_option(halt_at_warn, HaltAtWarn, !IO),
- (
- HaltAtWarn = yes,
- !:Error = yes
- ;
- HaltAtWarn = no
- )
- ;
- DoWarn = no
- )
+ Severity =
+ severity_conditional(WarningOption, yes, severity_warning, no),
+ Pieces = [option_is_set(WarningOption, yes,
+ [always([words("Warning: cannot open"), quote(FileName),
+ suffix("."), nl])])],
+ Msg = error_msg(no, treat_as_first, 0, Pieces),
+ Spec = error_spec(Severity, phase_read_files, [Msg]),
+ !:Specs = [Spec | !.Specs]
).
%-----------------------------------------------------------------------------%
Index: compiler/make.dependencies.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.dependencies.m,v
retrieving revision 1.54
diff -u -b -r1.54 make.dependencies.m
--- compiler/make.dependencies.m 5 May 2009 05:53:15 -0000 1.54
+++ compiler/make.dependencies.m 22 Jul 2009 06:34:00 -0000
@@ -758,8 +758,8 @@
% This is because if this module is a submodule, then it
% may depend on things imported only by its ancestors.
%
- module_names_to_index_set(Imports ^ impl_deps, ImplDeps, !Info),
- module_names_to_index_set(Imports ^ int_deps, IntDeps, !Info),
+ module_names_to_index_set(Imports ^ mai_impl_deps, ImplDeps, !Info),
+ module_names_to_index_set(Imports ^ mai_int_deps, IntDeps, !Info),
Modules0 = union(ImplDeps, IntDeps),
(
ModuleName = qualified(ParentModule, _),
@@ -931,7 +931,7 @@
(
MaybeImports = yes(Imports),
ForeignModulesList = get_foreign_imported_modules_lang(Languages,
- Imports ^ foreign_import_modules),
+ Imports ^ mai_foreign_import_modules),
module_names_to_index_set(ForeignModulesList, ForeignModules, !Info),
Success = yes
;
@@ -993,7 +993,7 @@
list.filter_map(
(pred(FI::in, M::out) is semidet :-
FI = foreign_import_module_info(Lang, M, _)
- ), Imports ^ foreign_import_modules, ModulesList),
+ ), Imports ^ mai_foreign_import_modules, ModulesList),
module_names_to_index_set(ModulesList, Modules, !Info),
Success = yes
;
@@ -1053,7 +1053,7 @@
MaybeImports = yes(Imports),
Success = yes,
FilesList = map((func(File) = dep_file(File, no)),
- Imports ^ fact_table_deps),
+ Imports ^ mai_fact_table_deps),
Files = set.list_to_set(FilesList)
;
MaybeImports = no,
@@ -1159,7 +1159,7 @@
ModuleLocn = any_module
;
ModuleLocn = local_module,
- Imports ^ module_dir = dir.this_directory
+ Imports ^ mai_module_dir = dir.this_directory
)
->
(
@@ -1167,37 +1167,37 @@
% Anywhere the interface of the child module is needed,
% the parent must also have been imported.
DependenciesType = interface_imports,
- ImportsToCheck = Imports ^ int_deps
+ ImportsToCheck = Imports ^ mai_int_deps
;
DependenciesType = all_dependencies,
ImportsToCheck = list.condense([
- Imports ^ int_deps,
- Imports ^ impl_deps,
- Imports ^ parent_deps,
- Imports ^ children,
+ Imports ^ mai_int_deps,
+ Imports ^ mai_impl_deps,
+ Imports ^ mai_parent_deps,
+ Imports ^ mai_children,
get_foreign_imported_modules(
- Imports ^ foreign_import_modules)
+ Imports ^ mai_foreign_import_modules)
])
;
DependenciesType = all_imports,
ImportsToCheck = list.condense([
- Imports ^ int_deps,
- Imports ^ impl_deps,
- Imports ^ parent_deps,
+ Imports ^ mai_int_deps,
+ Imports ^ mai_impl_deps,
+ Imports ^ mai_parent_deps,
get_foreign_imported_modules(
- Imports ^ foreign_import_modules)
+ Imports ^ mai_foreign_import_modules)
])
),
module_names_to_index_set(ImportsToCheck, ImportsToCheckSet,
!Info),
ImportingModule = !.Info ^ importing_module,
- !:Info = !.Info ^ importing_module := yes(ModuleName),
+ !Info ^ importing_module := yes(ModuleName),
Modules1 = insert(Modules0, ModuleIndex),
deps_set_foldl3_maybe_stop_at_error(KeepGoing,
find_transitive_module_dependencies_2(KeepGoing,
DependenciesType, ModuleLocn),
ImportsToCheckSet, Success, Modules1, Modules, !Info, !IO),
- !:Info = !.Info ^ importing_module := ImportingModule
+ !Info ^ importing_module := ImportingModule
;
Success = yes,
Modules = Modules0
@@ -1457,7 +1457,7 @@
Status = deps_status_error
;
MaybeImports = yes(Imports),
- ( Imports ^ module_dir \= dir.this_directory ->
+ ( Imports ^ mai_module_dir \= dir.this_directory ->
% Targets from libraries are always considered to be
% up-to-date if they exist.
Index: compiler/make.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.m,v
retrieving revision 1.58
diff -u -b -r1.58 make.m
--- compiler/make.m 30 Apr 2009 04:37:26 -0000 1.58
+++ compiler/make.m 22 Jul 2009 05:21:17 -0000
@@ -39,7 +39,8 @@
:- pred make_process_args(options_variables::in, list(string)::in,
list(file_name)::in, io::di, io::uo) is det.
-:- pred make_write_module_dep_file(module_imports::in, io::di, io::uo) is det.
+:- pred make_write_module_dep_file(module_and_imports::in, io::di, io::uo)
+ is det.
:- func make_module_dep_file_extension = string.
@@ -98,10 +99,10 @@
:- type make_info
---> make_info(
- % The items field of each module_imports structure should be
- % empty -- we're not trying to cache the items here.
+ % The items field of each module_and_imports structure
+ % should be empty -- we're not trying to cache the items here.
module_dependencies :: map(module_name,
- maybe(module_imports)),
+ maybe(module_and_imports)),
file_timestamps :: file_timestamps,
Index: compiler/make.module_dep_file.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.module_dep_file.m,v
retrieving revision 1.38
diff -u -b -r1.38 make.module_dep_file.m
--- compiler/make.module_dep_file.m 2 Dec 2008 04:30:23 -0000 1.38
+++ compiler/make.module_dep_file.m 24 Jul 2009 06:22:45 -0000
@@ -29,10 +29,11 @@
% command, so this predicate may need to read the source for
% the module.
%
-:- pred get_module_dependencies(module_name::in, maybe(module_imports)::out,
- make_info::in, make_info::out, io::di, io::uo) is det.
+:- pred get_module_dependencies(module_name::in,
+ maybe(module_and_imports)::out, make_info::in, make_info::out,
+ io::di, io::uo) is det.
-:- pred write_module_dep_file(module_imports::in, io::di, io::uo) is det.
+:- pred write_module_dep_file(module_and_imports::in, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -90,8 +91,10 @@
(
Error = yes,
MaybeImports = no,
- !:Info = !.Info ^ module_dependencies
- ^ elem(ModuleName) := MaybeImports
+ ModuleDepMap0 = !.Info ^ module_dependencies,
+ % XXX Could this be map.det_update or map.det_insert?
+ map.set(ModuleDepMap0, ModuleName, MaybeImports, ModuleDepMap),
+ !Info ^ module_dependencies := ModuleDepMap
;
Error = no,
maybe_get_module_dependencies(RebuildModuleDeps,
@@ -119,8 +122,8 @@
).
:- pred maybe_get_module_dependencies(rebuild_module_deps::in,
- module_name::in, maybe(module_imports)::out, make_info::in, make_info::out,
- io::di, io::uo) is det.
+ module_name::in, maybe(module_and_imports)::out,
+ make_info::in, make_info::out, io::di, io::uo) is det.
maybe_get_module_dependencies(RebuildModuleDeps, ModuleName, MaybeImports,
!Info, !IO) :-
@@ -132,7 +135,7 @@
).
:- pred do_get_module_dependencies(rebuild_module_deps::in, module_name::in,
- maybe(module_imports)::out, make_info::in, make_info::out,
+ maybe(module_and_imports)::out, make_info::in, make_info::out,
io::di, io::uo) is det.
do_get_module_dependencies(RebuildModuleDeps, ModuleName, !:MaybeImports,
@@ -184,9 +187,9 @@
map.lookup(!.Info ^ module_dependencies, ModuleName, !:MaybeImports),
(
!.MaybeImports = yes(Imports0),
- Imports0 ^ module_dir = dir.this_directory
+ Imports0 ^ mai_module_dir = dir.this_directory
->
- SourceFileName1 = Imports0 ^ source_file_name,
+ SourceFileName1 = Imports0 ^ mai_source_file_name,
get_file_timestamp([dir.this_directory], SourceFileName1,
MaybeSourceFileTimestamp1, !Info, !IO),
(
@@ -216,25 +219,28 @@
;
MaybeDepFileTimestamp = error(_),
- %
- % Try to make the dependencies. This will succeed when the
- % module name doesn't match the file name and the dependencies
- % for this module haven't been built before. It will fail if the
- % source file is in another directory.
- %
+ % Try to make the dependencies. This will succeed when the module name
+ % doesn't match the file name and the dependencies for this module
+ % haven't been built before. It will fail if the source file
+ % is in another directory.
(
RebuildModuleDeps = do_rebuild_module_deps,
make_module_dependencies(ModuleName, !Info, !IO)
;
RebuildModuleDeps = do_not_rebuild_module_deps,
- !:Info = !.Info ^ module_dependencies ^ elem(ModuleName) := no
+ ModuleDepMap0 = !.Info ^ module_dependencies,
+ % XXX Could this be map.det_update or map.det_insert?
+ map.set(ModuleDepMap0, ModuleName, no, ModuleDepMap1),
+ !Info ^ module_dependencies := ModuleDepMap1
)
),
- ( !:MaybeImports = !.Info ^ module_dependencies ^ elem(ModuleName) ->
- true
+ ModuleDepMap2 = !.Info ^ module_dependencies,
+ ( map.search(ModuleDepMap2, ModuleName, MaybeImportsPrime) ->
+ !:MaybeImports = MaybeImportsPrime
;
!:MaybeImports = no,
- !:Info = !.Info ^ module_dependencies ^ elem(ModuleName) := no
+ map.det_insert(ModuleDepMap2, ModuleName, no, ModuleDepMap),
+ !Info ^ module_dependencies := ModuleDepMap
).
%-----------------------------------------------------------------------------%
@@ -246,18 +252,20 @@
write_module_dep_file(Imports0, !IO) :-
% Make sure all the required fields are filled in.
globals.io_get_globals(Globals, !IO),
- module_imports_get_items_list(Imports0, Items0),
+ module_and_imports_get_results(Imports0, Items0, _Specs, _Errors),
strip_imported_items(Items0, Items),
- init_dependencies(Imports0 ^ source_file_name,
- Imports0 ^ source_file_module_name,
- Imports0 ^ nested_children, no_module_errors, Globals,
- Imports0 ^ module_name - Items, Imports),
+ init_dependencies(Imports0 ^ mai_source_file_name,
+ Imports0 ^ mai_source_file_module_name,
+ Imports0 ^ mai_nested_children,
+ Imports0 ^ mai_specs, no_module_errors, Globals,
+ Imports0 ^ mai_module_name - Items, Imports),
do_write_module_dep_file(Imports, !IO).
-:- pred do_write_module_dep_file(module_imports::in, io::di, io::uo) is det.
+:- pred do_write_module_dep_file(module_and_imports::in, io::di, io::uo)
+ is det.
do_write_module_dep_file(Imports, !IO) :-
- ModuleName = Imports ^ module_name,
+ ModuleName = Imports ^ mai_module_name,
module_name_to_file_name(ModuleName, make_module_dep_file_extension,
do_create_dirs, ProgDepFile, !IO),
io.open_output(ProgDepFile, ProgDepResult, !IO),
@@ -267,31 +275,31 @@
io.write_string("module(", !IO),
io.write_int(module_dependencies_version_number, !IO),
io.write_string(", """, !IO),
- io.write_string(Imports ^ source_file_name, !IO),
+ io.write_string(Imports ^ mai_source_file_name, !IO),
io.write_string(""",\n\t", !IO),
mercury_output_bracketed_sym_name(
- Imports ^ source_file_module_name, !IO),
+ Imports ^ mai_source_file_module_name, !IO),
io.write_string(",\n\t{", !IO),
- io.write_list(Imports ^ parent_deps,
+ io.write_list(Imports ^ mai_parent_deps,
", ", mercury_output_bracketed_sym_name, !IO),
io.write_string("},\n\t{", !IO),
- io.write_list(Imports ^ int_deps,
+ io.write_list(Imports ^ mai_int_deps,
", ", mercury_output_bracketed_sym_name, !IO),
io.write_string("},\n\t{", !IO),
- io.write_list(Imports ^ impl_deps,
+ io.write_list(Imports ^ mai_impl_deps,
", ", mercury_output_bracketed_sym_name, !IO),
io.write_string("},\n\t{", !IO),
- io.write_list(Imports ^ children,
+ io.write_list(Imports ^ mai_children,
", ", mercury_output_bracketed_sym_name, !IO),
io.write_string("},\n\t{", !IO),
- io.write_list(Imports ^ nested_children,
+ io.write_list(Imports ^ mai_nested_children,
", ", mercury_output_bracketed_sym_name, !IO),
io.write_string("},\n\t{", !IO),
- io.write_list(Imports ^ fact_table_deps,
+ io.write_list(Imports ^ mai_fact_table_deps,
", ", io.write, !IO),
io.write_string("},\n\t{", !IO),
(
- Imports ^ has_foreign_code =
+ Imports ^ mai_has_foreign_code =
contains_foreign_code(ForeignLanguages0)
->
ForeignLanguages = set.to_sorted_list(ForeignLanguages0)
@@ -301,7 +309,7 @@
io.write_list(ForeignLanguages, ", ",
mercury_output_foreign_language_string, !IO),
io.write_string("},\n\t{", !IO),
- io.write_list(Imports ^ foreign_import_modules, ", ",
+ io.write_list(Imports ^ mai_foreign_import_modules, ", ",
(pred(ForeignImportModule::in, !.IO::di, !:IO::uo) is det :-
ForeignImportModule = foreign_import_module_info(Lang,
ForeignImport, _),
@@ -310,11 +318,11 @@
mercury_output_bracketed_sym_name(ForeignImport, !IO)
), !IO),
io.write_string("},\n\t", !IO),
- contains_foreign_export_to_string(Imports ^ contains_foreign_export,
- ContainsForeignExportStr),
+ contains_foreign_export_to_string(
+ Imports ^ mai_contains_foreign_export, ContainsForeignExportStr),
io.write_string(ContainsForeignExportStr, !IO),
io.write_string(",\n\t", !IO),
- has_main_to_string(Imports ^ has_main, HasMainStr),
+ has_main_to_string(Imports ^ mai_has_main, HasMainStr),
io.write_string(HasMainStr, !IO),
io.write_string("\n).\n", !IO),
io.set_output_stream(OldOutputStream, _, !IO),
@@ -464,37 +472,29 @@
set.list_to_set(ForeignLanguages))
),
- % Imports = module_imports(^...),
- Imports ^ source_file_name = SourceFileName,
- Imports ^ source_file_module_name = SourceFileModuleName,
- Imports ^ module_name = ModuleName,
- Imports ^ parent_deps = Parents,
- Imports ^ int_deps = IntDeps,
- Imports ^ impl_deps = ImplDeps,
- Imports ^ indirect_deps = [], % not used.
- Imports ^ children = Children,
- Imports ^ public_children = [], % not used.
- Imports ^ nested_children = NestedChildren,
- Imports ^ fact_table_deps = FactDeps,
- Imports ^ has_foreign_code = ContainsForeignCode,
- Imports ^ foreign_import_modules = ForeignImports,
- Imports ^ contains_foreign_export = ContainsForeignExport,
- Imports ^ items = cord.empty, % not used.
- Imports ^ error = no_module_errors, % not used.
- Imports ^ maybe_timestamps = no, % not used.
- Imports ^ has_main = HasMain,
- Imports ^ module_dir = ModuleDir,
-
- !:Info = !.Info ^ module_dependencies ^ elem(ModuleName)
- := yes(Imports),
+ IndirectDeps = [],
+ PublicChildren = [],
+ Items = cord.empty,
+ Specs = [],
+ Errors = no_module_errors,
+ MaybeTimestamps = no,
+ Imports = module_and_imports(SourceFileName, SourceFileModuleName,
+ ModuleName, Parents, IntDeps, ImplDeps, IndirectDeps,
+ Children, PublicChildren, NestedChildren, FactDeps,
+ ContainsForeignCode, ForeignImports, ContainsForeignExport,
+ Items, Specs, Errors, MaybeTimestamps, HasMain, ModuleDir),
+
+ ModuleDepMap0 = !.Info ^ module_dependencies,
+ % XXX Could this be map.det_insert?
+ map.set(ModuleDepMap0, ModuleName, yes(Imports), ModuleDepMap),
+ !Info ^ module_dependencies := ModuleDepMap,
- %
% Read the dependencies for the nested children. If something
% goes wrong (for example one of the files was removed), the
% dependencies for all modules in the source file will be remade
% (make_module_dependencies expects to be given the top-level
% module in the source file).
- %
+
SubRebuildModuleDeps = do_not_rebuild_module_deps,
list.foldl2(
read_module_dependencies_2(SubRebuildModuleDeps, SearchDirs),
@@ -572,12 +572,18 @@
redirect_output(ModuleName, MaybeErrorStream, !Info, !IO),
(
MaybeErrorStream = yes(ErrorStream),
+ globals.io_get_globals(Globals, !IO),
io.set_output_stream(ErrorStream, OldOutputStream, !IO),
% XXX Why ask for the timestamp if we then ignore it?
- read_module(ModuleName, ".m", "Getting dependencies for module",
- do_not_search, do_return_timestamp, Items, Error, SourceFileName,
- _, !IO),
- ( Error = fatal_module_errors ->
+ read_module(Globals, ModuleName, ".m",
+ "Getting dependencies for module",
+ do_not_search, do_return_timestamp, Items, Specs0, Error,
+ SourceFileName, _, !IO),
+ (
+ Error = fatal_module_errors,
+ io.set_output_stream(ErrorStream, _, !IO),
+ write_error_specs(Specs0, Globals, 0, _NumWarnings, 0, _NumErrors,
+ !IO),
io.set_output_stream(OldOutputStream, _, !IO),
io.write_string("** Error: error reading file `", !IO),
io.write_string(SourceFileName, !IO),
@@ -597,30 +603,36 @@
module_name_to_file_name(ModuleName, ".err", do_not_create_dirs,
ErrFileName, !IO),
io.remove_file(ErrFileName, _, !IO),
- !:Info = !.Info ^ module_dependencies ^ elem(ModuleName) := no
+ ModuleDepMap0 = !.Info ^ module_dependencies,
+ % XXX Could this be map.det_update?
+ map.set(ModuleDepMap0, ModuleName, no, ModuleDepMap),
+ !Info ^ module_dependencies := ModuleDepMap
;
- io.set_exit_status(0, !IO),
+ ( Error = no_module_errors
+ ; Error = some_module_errors
+ ),
io.set_output_stream(ErrorStream, _, !IO),
- split_into_submodules(ModuleName, Items, SubModuleList, [], Specs),
- globals.io_get_globals(Globals, !IO),
+ split_into_submodules(ModuleName, Items, SubModuleList,
+ Specs0, Specs),
+ io.set_exit_status(0, !IO),
write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
!IO),
io.set_output_stream(OldOutputStream, _, !IO),
assoc_list.keys(SubModuleList, SubModuleNames),
list.map(init_dependencies(SourceFileName, ModuleName,
- SubModuleNames, Error, Globals),
+ SubModuleNames, [], Error, Globals),
SubModuleList, ModuleImportList),
list.foldl(
(pred(ModuleImports::in, Info0::in, Info::out) is det :-
- SubModuleName = ModuleImports ^ module_name,
+ SubModuleName = ModuleImports ^ mai_module_name,
Info = Info0 ^ module_dependencies ^ elem(SubModuleName)
:= yes(ModuleImports)
), ModuleImportList, !Info),
% If there were no errors, write out the `.int3' file
- % while we have the contents of the module. The `int3'
- % file doesn't depend on anything else.
+ % while we have the contents of the module. The `int3' file
+ % does not depend on anything else.
(
Error = no_module_errors,
Target = target_file(ModuleName,
@@ -636,9 +648,7 @@
cleanup_short_interfaces(SubModuleNames),
Succeeded, !Info, !IO)
;
- ( Error = some_module_errors
- ; Error = fatal_module_errors
- ),
+ Error = some_module_errors,
Succeeded = no
),
@@ -666,10 +676,11 @@
make_short_interfaces(ErrorStream, SourceFileName, SubModuleList, _, Succeeded,
!Info, !IO) :-
io.set_output_stream(ErrorStream, OutputStream, !IO),
+ globals.io_get_globals(Globals, !IO),
list.foldl(
(pred(SubModule::in, !.IO::di, !:IO::uo) is det :-
SubModule = SubModuleName - SubModuleItems,
- modules.make_short_interface(SourceFileName,
+ modules.make_short_interface(Globals, SourceFileName,
SubModuleName, SubModuleItems, !IO)
), SubModuleList, !IO),
io.set_output_stream(OutputStream, _, !IO),
Index: compiler/make.module_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.module_target.m,v
retrieving revision 1.71
diff -u -b -r1.71 make.module_target.m
--- compiler/make.module_target.m 5 May 2009 05:53:15 -0000 1.71
+++ compiler/make.module_target.m 24 Jul 2009 04:53:58 -0000
@@ -61,7 +61,7 @@
% Find the foreign code files generated when a module is processed.
% The `pic' field is only used for C foreign code.
%
-:- pred external_foreign_code_files(pic::in, module_imports::in,
+:- pred external_foreign_code_files(pic::in, module_and_imports::in,
list(foreign_code_file)::out, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
@@ -130,10 +130,10 @@
% effect of making the target for the top-level module in
% the file.
CompilationTask = process_module(_) - _,
- Imports ^ source_file_module_name \= ModuleName
+ Imports ^ mai_source_file_module_name \= ModuleName
->
NestedTargetFile = target_file(
- Imports ^ source_file_module_name, FileType),
+ Imports ^ mai_source_file_module_name, FileType),
make_module_target_extra_options(ExtraOptions,
dep_target(NestedTargetFile),
Succeeded, !Info, !IO)
@@ -147,7 +147,8 @@
debug_file_msg(TargetFile, "checking dependencies", !IO),
( CompilationTask = process_module(_) - _ ->
- ModulesToCheck = [ModuleName | Imports ^ nested_children]
+ ModulesToCheck =
+ [ModuleName | Imports ^ mai_nested_children]
;
ModulesToCheck = [ModuleName]
),
@@ -340,7 +341,7 @@
%-----------------------------------------------------------------------------%
:- pred build_target(compilation_task_result::in, target_file::in,
- module_imports::in, list(target_file)::in, list(file_name)::in,
+ module_and_imports::in, list(target_file)::in, list(file_name)::in,
list(string)::in, bool::out, make_info::in, make_info::out,
io::di, io::uo) is det.
@@ -405,7 +406,7 @@
).
:- pred build_target_2(module_name::in, compilation_task_type::in,
- maybe(file_name)::in, module_imports::in, list(string)::in,
+ maybe(file_name)::in, module_and_imports::in, list(string)::in,
io.output_stream::in, bool::out, make_info::in, make_info::out,
io::di, io::uo) is det.
@@ -472,14 +473,14 @@
Succeeded, !IO).
build_target_2(ModuleName, foreign_code_to_object_code(PIC, Lang), _,
- Imports, _, ErrorStream, Succeeded, !Info, !Io) :-
- foreign_code_file(ModuleName, PIC, Lang, ForeignCodeFile, !Io),
+ Imports, _, ErrorStream, Succeeded, !Info, !IO) :-
+ foreign_code_file(ModuleName, PIC, Lang, ForeignCodeFile, !IO),
% Run the compilation in a child process so it can be killed
% if an interrupt arrives.
call_in_forked_process(
compile_foreign_code_file(ErrorStream, PIC, Imports, ForeignCodeFile),
- Succeeded, !Io).
+ Succeeded, !IO).
build_target_2(ModuleName, fact_table_code_to_object_code(PIC, FactTableFile),
_, Imports, _, ErrorStream, Succeeded, !Info, !IO) :-
@@ -494,7 +495,7 @@
Succeeded, !IO).
:- pred build_object_code(module_name::in, compilation_target::in, pic::in,
- io.output_stream::in, module_imports::in, bool::out,
+ io.output_stream::in, module_and_imports::in, bool::out,
io::di, io::uo) is det.
build_object_code(ModuleName, target_c, PIC, ErrorStream, _Imports,
@@ -514,7 +515,7 @@
build_object_code(ModuleName, target_il, _, ErrorStream, Imports, Succeeded,
!IO) :-
compile_target_code.il_assemble(ErrorStream, ModuleName,
- Imports ^ has_main, Succeeded, !IO).
+ Imports ^ mai_has_main, Succeeded, !IO).
build_object_code(_ModuleName, target_x86_64, _, _ErrorStream, _Imports,
_Succeeded, _, _) :-
sorry(this_file, "NYI mmc --make and target x86_64").
@@ -526,7 +527,7 @@
Succeeded, !IO).
:- pred compile_foreign_code_file(io.output_stream::in, pic::in,
- module_imports::in, foreign_code_file::in, bool::out,
+ module_and_imports::in, foreign_code_file::in, bool::out,
io::di, io::uo) is det.
compile_foreign_code_file(ErrorStream, PIC, _Imports,
@@ -628,13 +629,13 @@
:- pred call_mercury_compile_main(list(string)::in, bool::out,
io::di, io::uo) is det.
-call_mercury_compile_main(Args, Succeeded, !Io) :-
- io.get_exit_status(Status0, !Io),
- io.set_exit_status(0, !Io),
- mercury_compile.main(Args, !Io),
- io.get_exit_status(Status, !Io),
+call_mercury_compile_main(Args, Succeeded, !IO) :-
+ io.get_exit_status(Status0, !IO),
+ io.set_exit_status(0, !IO),
+ mercury_compile.main(Args, !IO),
+ io.get_exit_status(Status, !IO),
Succeeded = ( Status = 0 -> yes ; no ),
- io.set_exit_status(Status0, !Io).
+ io.set_exit_status(Status0, !IO).
:- pred invoke_mmc(io.output_stream::in, maybe(file_name)::in,
list(string)::in, bool::out, io::di, io::uo) is det.
@@ -862,7 +863,7 @@
unexpected(this_file, "touched_files: no module dependencies")
),
- NestedChildren = Imports ^ nested_children,
+ NestedChildren = Imports ^ mai_nested_children,
SourceFileModuleNames = [ModuleName | NestedChildren],
list.map_foldl2(get_module_dependencies, NestedChildren,
@@ -928,9 +929,9 @@
%
HeaderModuleNames =
list.filter_map(
- (func(MImports) = MImports ^ module_name is semidet :-
+ (func(MImports) = MImports ^ mai_module_name is semidet :-
contains_foreign_code(_) =
- MImports ^ has_foreign_code
+ MImports ^ mai_has_foreign_code
), ModuleImportsList),
HeaderTargets0 = make_target_file_list(HeaderModuleNames,
module_target_c_header(header_mih))
@@ -1030,10 +1031,10 @@
maybe_pic_object_file_extension(PIC, ObjExt, !IO),
globals.io_get_target(CompilationTarget, !IO),
- ModuleName = Imports ^ module_name,
+ ModuleName = Imports ^ mai_module_name,
(
CompilationTarget = target_asm,
- Imports ^ has_foreign_code = contains_foreign_code(Langs),
+ Imports ^ mai_has_foreign_code = contains_foreign_code(Langs),
set.member(lang_c, Langs)
->
module_name_to_file_name(
@@ -1045,7 +1046,7 @@
ForeignFiles0 = [foreign_code_file(lang_c, CCodeFileName, ObjFileName)]
;
CompilationTarget = target_il,
- Imports ^ has_foreign_code = contains_foreign_code(Langs)
+ Imports ^ mai_has_foreign_code = contains_foreign_code(Langs)
->
list.map_foldl(external_foreign_code_files_for_il(ModuleName),
set.to_sorted_list(Langs), ForeignFilesList, !IO),
@@ -1068,7 +1069,7 @@
ObjExt, do_not_create_dirs, FactTableObjFile),
{ FactTableForeignFile = foreign_code_file(lang_c,
FactTableCFile, FactTableObjFile) }
- ), Imports ^ fact_table_deps, FactTableForeignFiles, !IO),
+ ), Imports ^ mai_fact_table_deps, FactTableForeignFiles, !IO),
ForeignFiles = ForeignFiles0 ++ FactTableForeignFiles
;
( CompilationTarget = target_java
Index: compiler/make.program_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.program_target.m,v
retrieving revision 1.99
diff -u -b -r1.99 make.program_target.m
--- compiler/make.program_target.m 17 Jun 2009 07:07:42 -0000 1.99
+++ compiler/make.program_target.m 22 Jul 2009 06:39:09 -0000
@@ -296,7 +296,7 @@
get_module_dependencies(ModuleName, MaybeImports, !Info, !IO),
(
MaybeImports = yes(Imports),
- ModuleName = Imports ^ source_file_module_name
+ ModuleName = Imports ^ mai_source_file_module_name
->
!:TargetModules = [ModuleName | !.TargetModules]
;
@@ -321,7 +321,7 @@
),
(
CompilationTarget = target_asm,
- Imports ^ has_foreign_code = contains_foreign_code(Langs),
+ Imports ^ mai_has_foreign_code = contains_foreign_code(Langs),
set.member(lang_c, Langs)
->
ForeignObjectFileType = module_target_foreign_object(PIC, lang_c),
@@ -329,7 +329,7 @@
ForeignObjectTargets = [dep_target(ForeignObjectTarget)]
;
CompilationTarget = target_il,
- Imports ^ has_foreign_code = contains_foreign_code(Langs)
+ Imports ^ mai_has_foreign_code = contains_foreign_code(Langs)
->
ForeignObjectTargets = list.map(
(func(L) = dep_target(target_file(ModuleName,
@@ -350,7 +350,7 @@
dep_target(target_file(ModuleName,
module_target_fact_table_object(PIC, FactFile)))
),
- Imports ^ fact_table_deps),
+ Imports ^ mai_fact_table_deps),
ObjectTargets = FactObjectTargets ++ ForeignObjectTargets
;
( CompilationTarget = target_java
@@ -1039,27 +1039,28 @@
% dependent modules (modules which form a clique in the dependency graph)
% are returned adjacent in the list in arbitrary order.
%
-:- pred reverse_ordered_modules(map(module_name, maybe(module_imports))::in,
+:- pred reverse_ordered_modules(map(module_name,
+ maybe(module_and_imports))::in,
list(module_name)::in, list(module_name)::out) is det.
reverse_ordered_modules(ModuleDeps, Modules0, Modules) :-
- list.foldl2(add_module_relations(lookup_module_imports(ModuleDeps)),
+ list.foldl2(add_module_relations(lookup_module_and_imports(ModuleDeps)),
Modules0, digraph.init, _IntDepsGraph, digraph.init, ImplDepsGraph),
digraph.atsort(ImplDepsGraph, Order0),
list.reverse(Order0, Order1),
list.map(set.to_sorted_list, Order1, Order2),
list.condense(Order2, Modules).
-:- func lookup_module_imports(map(module_name, maybe(module_imports)),
- module_name) = module_imports.
+:- func lookup_module_and_imports(map(module_name, maybe(module_and_imports)),
+ module_name) = module_and_imports.
-lookup_module_imports(ModuleDeps, ModuleName) = ModuleImports :-
+lookup_module_and_imports(ModuleDeps, ModuleName) = ModuleImports :-
map.lookup(ModuleDeps, ModuleName, MaybeModuleImports),
(
MaybeModuleImports = yes(ModuleImports)
;
MaybeModuleImports = no,
- unexpected(this_file, "lookup_module_imports")
+ unexpected(this_file, "lookup_module_and_imports")
).
:- pred modules_needing_reanalysis(bool::in, list(module_name)::in,
@@ -1241,10 +1242,10 @@
AnyIntermod = yes,
% `.int0' files are imported by `.opt' files.
(
- Imports ^ children = [_ | _],
+ Imports ^ mai_children = [_ | _],
Exts = ["int0", "opt"]
;
- Imports ^ children = [],
+ Imports ^ mai_children = [],
Exts = ["opt"]
)
;
@@ -1520,7 +1521,7 @@
HighLevelCode = yes
;
Target = target_asm,
- Imports ^ has_foreign_code = contains_foreign_code(_)
+ Imports ^ mai_has_foreign_code = contains_foreign_code(_)
)
->
GradeIncDir = LibDir/"lib"/GradeDir/"inc",
@@ -1886,7 +1887,7 @@
get_module_dependencies(ModuleName, MaybeImports, !Info, !IO),
(
MaybeImports = yes(Imports),
- FactTableFiles = Imports ^ fact_table_deps
+ FactTableFiles = Imports ^ mai_fact_table_deps
;
MaybeImports = no,
FactTableFiles = []
Index: compiler/make.util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.util.m,v
retrieving revision 1.64
diff -u -b -r1.64 make.util.m
--- compiler/make.util.m 30 Apr 2009 04:37:27 -0000 1.64
+++ compiler/make.util.m 23 Jul 2009 06:00:10 -0000
@@ -1042,7 +1042,7 @@
get_module_dependencies(ModuleName, MaybeImports, !Info, !IO),
(
MaybeImports = yes(Imports),
- Imports ^ module_dir \= dir.this_directory
+ Imports ^ mai_module_dir \= dir.this_directory
->
MaybeTimestamp = ok(oldest_timestamp),
!:Info = !.Info ^ file_timestamps ^ elem(FileName)
@@ -1063,7 +1063,7 @@
get_module_dependencies(ModuleName, MaybeImports, !Info, !IO),
(
MaybeImports = yes(Imports),
- FileName = Imports ^ source_file_name
+ FileName = Imports ^ mai_source_file_name
;
MaybeImports = no,
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.528
diff -u -b -r1.528 make_hlds.m
--- compiler/make_hlds.m 4 Mar 2007 23:37:57 -0000 1.528
+++ compiler/make_hlds.m 22 Jul 2009 03:05:53 -0000
@@ -17,9 +17,7 @@
% (A,B,C) into conj([A,B,C]) form, convert all unifications into
% super-homogenous form, and introduce implicit quantification.
%
-% XXX we should record each error using module_info_incr_errors.
-%
-% WISHLIST - we should handle explicit module quantification
+% WISHLIST - we should handle explicit module quantification.
%
%-----------------------------------------------------------------------------%
@@ -30,6 +28,8 @@
:- import_module hlds.hlds_data.
:- import_module hlds.hlds_module.
:- import_module hlds.hlds_pred.
+:- import_module libs.
+:- import_module libs.globals.
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.equiv_type.
:- import_module parse_tree.error_util.
@@ -38,7 +38,6 @@
:- import_module parse_tree.prog_item.
:- import_module bool.
-:- import_module io.
:- import_module list.
:- import_module maybe.
:- import_module term.
@@ -47,20 +46,20 @@
:- type make_hlds_qual_info.
- % parse_tree_to_hlds(ParseTree, MQInfo, EqvMap, UsedModules,
- % HLDS, QualInfo, InvalidTypes, InvalidModes):
+ % parse_tree_to_hlds(Globals, ParseTree, MQInfo, EqvMap, UsedModules,
+ % QualInfo, InvalidTypes, InvalidModes, HLDS, Specs):
%
% Given MQInfo (returned by module_qual.m) and EqvMap and UsedModules
- % (returned by equiv_type.m), converts ParseTree to HLDS. Any errors found
- % are recorded in the HLDS num_errors field.
+ % (both returned by equiv_type.m), converts ParseTree to HLDS.
+ % Any errors found are returned in Specs.
% Returns InvalidTypes = yes if undefined types found.
- % Returns InvalidModes = yes if undefined or cyclic insts or modes
- % found. QualInfo is an abstract type that is then passed back to
+ % Returns InvalidModes = yes if undefined or cyclic insts or modes found.
+ % QualInfo is an abstract type that is then passed back to
% produce_instance_method_clauses (see below).
%
-:- pred parse_tree_to_hlds(compilation_unit::in, mq_info::in, eqv_map::in,
- used_modules::in, module_info::out, make_hlds_qual_info::out,
- bool::out, bool::out, io::di, io::uo) is det.
+:- pred parse_tree_to_hlds(globals::in, compilation_unit::in, mq_info::in,
+ eqv_map::in, used_modules::in, make_hlds_qual_info::out,
+ bool::out, bool::out, module_info::out, list(error_spec)::out) is det.
:- pred add_new_proc(inst_varset::in, arity::in, list(mer_mode)::in,
maybe(list(mer_mode))::in, maybe(list(is_live))::in,
@@ -140,10 +139,10 @@
:- type make_hlds_qual_info == hlds.make_hlds.qual_info.qual_info.
-parse_tree_to_hlds(Module, MQInfo0, EqvMap, UsedModules, ModuleInfo,
- QualInfo, InvalidTypes, InvalidModes, !IO) :-
- do_parse_tree_to_hlds(Module, MQInfo0, EqvMap, UsedModules, ModuleInfo,
- QualInfo, InvalidTypes, InvalidModes, !IO).
+parse_tree_to_hlds(Globals, ParseTree, MQInfo0, EqvMap, UsedModules,
+ QualInfo, InvalidTypes, InvalidModes, ModuleInfo, Specs) :-
+ do_parse_tree_to_hlds(Globals, ParseTree, MQInfo0, EqvMap, UsedModules,
+ QualInfo, InvalidTypes, InvalidModes, ModuleInfo, Specs).
add_new_proc(InstVarSet, Arity, ArgModes, MaybeDeclaredArgModes,
MaybeArgLives, MaybeDet, Context, IsAddressTaken, PredInfo0, PredInfo,
Index: compiler/make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.86
diff -u -b -r1.86 make_hlds_passes.m
--- compiler/make_hlds_passes.m 22 Jun 2009 03:31:29 -0000 1.86
+++ compiler/make_hlds_passes.m 22 Jul 2009 03:18:41 -0000
@@ -19,7 +19,6 @@
:- import_module parse_tree.prog_data.
:- import_module bool.
-:- import_module io.
:- import_module list.
:- import_module term.
@@ -31,20 +30,20 @@
:- type item_status
---> item_status(import_status, need_qualifier).
- % do_parse_tree_to_hlds(ParseTree, MQInfo, EqvMap, UsedModules
- % HLDS, QualInfo, InvalidTypes, InvalidModes):
+ % do_parse_tree_to_hlds(Globals, ParseTree, MQInfo, EqvMap, UsedModules,
+ % QualInfo, InvalidTypes, InvalidModes, HLDS, Specs):
%
% Given MQInfo (returned by module_qual.m) and EqvMap and UsedModules
- % (both returned by equiv_type.m), converts ParseTree to HLDS. Any errors
- % found are recorded in the HLDS num_errors field.
+ % (both returned by equiv_type.m), converts ParseTree to HLDS.
+ % Any errors found are returned in Specs.
% Returns InvalidTypes = yes if undefined types found.
- % Returns InvalidModes = yes if undefined or cyclic insts or modes
- % found. QualInfo is an abstract type that is then passed back to
+ % Returns InvalidModes = yes if undefined or cyclic insts or modes found.
+ % QualInfo is an abstract type that is then passed back to
% produce_instance_method_clauses (see below).
%
-:- pred do_parse_tree_to_hlds(compilation_unit::in, mq_info::in, eqv_map::in,
- used_modules::in, module_info::out, qual_info::out,
- bool::out, bool::out, io::di, io::uo) is det.
+:- pred do_parse_tree_to_hlds(globals::in, compilation_unit::in, mq_info::in,
+ eqv_map::in, used_modules::in, qual_info::out,
+ bool::out, bool::out, module_info::out, list(error_spec)::out) is det.
% The bool records whether any cyclic insts or modes were detected.
%
@@ -134,10 +133,9 @@
%-----------------------------------------------------------------------------%
-do_parse_tree_to_hlds(unit_module(Name, Items), MQInfo0, EqvMap, UsedModules,
- ModuleInfo, QualInfo, InvalidTypes, InvalidModes, !IO) :-
- some [!ModuleInfo, !Specs] (
- globals.io_get_globals(Globals, !IO),
+do_parse_tree_to_hlds(Globals, unit_module(Name, Items), MQInfo0, EqvMap,
+ UsedModules, QualInfo, InvalidTypes, InvalidModes,
+ !:ModuleInfo, !:Specs) :-
mq_info_get_partial_qualifier_info(MQInfo0, PQInfo),
module_info_init(Name, Items, Globals, PQInfo, no, !:ModuleInfo),
module_info_set_used_modules(UsedModules, !ModuleInfo),
@@ -145,10 +143,12 @@
add_item_list_decls_pass_1(Items,
item_status(status_local, may_be_unqualified), !ModuleInfo,
no, InvalidModes0, !Specs),
- globals.io_lookup_bool_option(statistics, Statistics, !IO),
+ globals.lookup_bool_option(Globals, statistics, Statistics),
+ trace [io(!IO)] (
maybe_write_string(Statistics, "% Processed all items in pass 1\n",
!IO),
- maybe_report_stats(Statistics, !IO),
+ maybe_report_stats(Statistics, !IO)
+ ),
add_item_list_decls_pass_2(Items,
item_status(status_local, may_be_unqualified),
@@ -190,29 +190,25 @@
% Balance any data structures that need it.
module_info_optimize(!ModuleInfo),
+ trace [io(!IO)] (
maybe_write_string(Statistics, "% Processed all items in pass 2\n",
!IO),
- maybe_report_stats(Statistics, !IO),
+ maybe_report_stats(Statistics, !IO)
+ ),
init_qual_info(MQInfo0, EqvMap, QualInfo0),
- add_item_list_pass_3(Items, status_local, !ModuleInfo,
- QualInfo0, QualInfo, !Specs),
+ add_item_list_pass_3(Items, status_local, !ModuleInfo, QualInfo0, QualInfo,
+ !Specs),
+ trace [io(!IO)] (
maybe_write_string(Statistics, "% Processed all items in pass 3\n",
- !IO),
+ !IO)
+ ),
qual_info_get_mq_info(QualInfo, MQInfo),
mq_info_get_type_error_flag(MQInfo, InvalidTypes3),
InvalidTypes = InvalidTypes1 `or` InvalidTypes2 `or` InvalidTypes3,
mq_info_get_mode_error_flag(MQInfo, InvalidModes1),
- InvalidModes = InvalidModes0 `or` InvalidModes1,
-
- module_info_get_globals(!.ModuleInfo, CurGlobals),
- write_error_specs(!.Specs, CurGlobals, 0, _NumWarnings, 0, NumErrors,
- !IO),
- module_info_incr_num_errors(NumErrors, !ModuleInfo),
-
- ModuleInfo = !.ModuleInfo
- ).
+ InvalidModes = InvalidModes0 `or` InvalidModes1.
:- pred add_builtin_type_ctor_special_preds(type_ctor::in,
module_info::in, module_info::out) is det.
@@ -223,8 +219,8 @@
term.context_init(Context),
Status = status_local,
construct_type(TypeCtor, [], Type),
- %
- % XXX we call `eagerly_add_special_preds' instead of `add_special_preds'
+
+ % XXX We call `eagerly_add_special_preds' instead of `add_special_preds'
% to bypass a call to `special_pred_is_generated_lazily' which calls
% `classify_type_ctor'. `classify_type_ctor' knows about unqualified
% builtin types, but not the qualified types like `builtin.int'/0 from
@@ -233,7 +229,7 @@
% it won't find it.
%
% The special preds for these types shouldn't be generated lazily anyway.
- %
+
eagerly_add_special_preds(TVarSet, Type, TypeCtor, Body, Context, Status,
!ModuleInfo).
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.498
diff -u -b -r1.498 mercury_compile.m
--- compiler/mercury_compile.m 21 Jul 2009 04:10:40 -0000 1.498
+++ compiler/mercury_compile.m 27 Jul 2009 03:52:59 -0000
@@ -29,6 +29,7 @@
:- pred real_main(io::di, io::uo) is det.
% main(Args).
+ % It is called from make.module_target.call_mercury_compile_main.
%
:- pred main(list(string)::in, io::di, io::uo) is det.
@@ -167,6 +168,7 @@
:- import_module check_hlds.unused_imports.
:- import_module check_hlds.xml_documentation.
:- import_module hlds.arg_info.
+:- import_module hlds.hlds_error_util.
:- import_module hlds.hlds_goal.
:- import_module hlds.hlds_module.
:- import_module hlds.hlds_out.
@@ -224,6 +226,7 @@
:- import_module pprint.
:- import_module set.
:- import_module string.
+:- import_module svmap.
:- import_module term.
:- import_module unit.
@@ -379,31 +382,42 @@
:- pred main_2(list(string)::in, options_variables::in, list(string)::in,
list(string)::in, bool::in, io::di, io::uo) is det.
-main_2(Errors @ [_ | _], _, _, _, _, !IO) :-
- usage_errors(Errors, !IO).
-main_2([], OptionVariables, OptionArgs, Args, Link, !IO) :-
- globals.io_get_globals(Globals, !IO),
- globals.lookup_bool_option(Globals, version, Version),
- globals.lookup_bool_option(Globals, help, Help),
- globals.lookup_bool_option(Globals, generate_source_file_mapping,
+main_2(Errors, OptionVariables, OptionArgs, Args, Link, !IO) :-
+ (
+ Errors = [_ | _],
+ usage_errors(Errors, !IO)
+ ;
+ Errors = [],
+ globals.io_get_globals(Globals0, !IO),
+ main_3(OptionVariables, OptionArgs, Args, Link,
+ Globals0, _Globals, !IO)
+ ).
+
+:- pred main_3(options_variables::in, list(string)::in, list(string)::in,
+ bool::in, globals::in, globals::out, io::di, io::uo) is det.
+
+main_3(OptionVariables, OptionArgs, Args, Link, !Globals, !IO) :-
+ globals.lookup_bool_option(!.Globals, version, Version),
+ globals.lookup_bool_option(!.Globals, help, Help),
+ globals.lookup_bool_option(!.Globals, generate_source_file_mapping,
GenerateMapping),
- globals.lookup_bool_option(Globals, output_grade_string,
+ globals.lookup_bool_option(!.Globals, output_grade_string,
OutputGrade),
- globals.lookup_bool_option(Globals, output_link_command,
+ globals.lookup_bool_option(!.Globals, output_link_command,
OutputLinkCommand),
- globals.lookup_bool_option(Globals, output_shared_lib_link_command,
+ globals.lookup_bool_option(!.Globals, output_shared_lib_link_command,
OutputShLibLinkCommand),
- globals.lookup_bool_option(Globals, filenames_from_stdin,
+ globals.lookup_bool_option(!.Globals, filenames_from_stdin,
FileNamesFromStdin),
- globals.lookup_bool_option(Globals, output_libgrades,
+ globals.lookup_bool_option(!.Globals, output_libgrades,
OutputLibGrades),
- globals.lookup_bool_option(Globals, output_cc, OutputCC),
- globals.lookup_bool_option(Globals, output_cflags, OutputCFlags),
- globals.lookup_bool_option(Globals, output_library_link_flags,
+ globals.lookup_bool_option(!.Globals, output_cc, OutputCC),
+ globals.lookup_bool_option(!.Globals, output_cflags, OutputCFlags),
+ globals.lookup_bool_option(!.Globals, output_library_link_flags,
OutputLibraryLinkFlags),
- globals.lookup_bool_option(Globals, make, Make),
- globals.lookup_maybe_string_option(Globals, generate_standalone_interface,
- GenerateStandaloneInt),
+ globals.lookup_bool_option(!.Globals, make, Make),
+ globals.lookup_maybe_string_option(!.Globals,
+ generate_standalone_interface, GenerateStandaloneInt),
( Version = yes ->
io.stdout_stream(Stdout, !IO),
io.set_output_stream(Stdout, OldOutputStream, !IO),
@@ -418,28 +432,28 @@
% When Mmake asks for the grade, it really wants
% the directory component to use. This is consistent
% with scripts/canonical_grade.
- grade_directory_component(Globals, Grade),
+ grade_directory_component(!.Globals, Grade),
io.stdout_stream(Stdout, !IO),
io.write_string(Stdout, Grade, !IO),
io.write_string(Stdout, "\n", !IO)
; OutputLinkCommand = yes ->
- globals.lookup_string_option(Globals, link_executable_command,
+ globals.lookup_string_option(!.Globals, link_executable_command,
LinkCommand),
io.stdout_stream(Stdout, !IO),
io.write_string(Stdout, LinkCommand, !IO),
io.write_string(Stdout, "\n", !IO)
; OutputShLibLinkCommand = yes ->
- globals.lookup_string_option(Globals, link_shared_lib_command,
+ globals.lookup_string_option(!.Globals, link_shared_lib_command,
LinkCommand),
io.stdout_stream(Stdout, !IO),
io.write_string(Stdout, LinkCommand, !IO),
io.write_string(Stdout, "\n", !IO)
; OutputLibGrades = yes ->
- globals.lookup_accumulating_option(Globals, libgrades, LibGrades),
+ globals.lookup_accumulating_option(!.Globals, libgrades, LibGrades),
io.stdout_stream(Stdout, !IO),
io.write_list(Stdout, LibGrades, "\n", io.write_string, !IO)
; OutputCC = yes ->
- globals.lookup_string_option(Globals, cc, CC),
+ globals.lookup_string_option(!.Globals, cc, CC),
io.stdout_stream(StdOut, !IO),
io.write_string(StdOut, CC ++ "\n", !IO)
; OutputCFlags = yes ->
@@ -479,7 +493,7 @@
usage(!IO)
;
process_all_args(OptionVariables, OptionArgs,
- Args, ModulesToLink, FactTableObjFiles, !IO),
+ Args, ModulesToLink, FactTableObjFiles, !Globals, !IO),
io.get_exit_status(ExitStatus, !IO),
( ExitStatus = 0 ->
(
@@ -488,7 +502,7 @@
->
file_name_to_module_name(FirstModule,
MainModuleName),
- globals.get_target(Globals, Target),
+ globals.get_target(!.Globals, Target),
(
Target = target_java,
% For Java, at the "link" step we just generate a shell
@@ -516,7 +530,8 @@
% (`--verbose-errors') option, give them a hint about it.
% Of course, we should only output the hint when we have further
% information to give the user.
- globals.lookup_bool_option(Globals, verbose_errors, VerboseErrors),
+ globals.lookup_bool_option(!.Globals, verbose_errors,
+ VerboseErrors),
globals.io_get_extra_error_info(ExtraErrorInfo, !IO),
(
VerboseErrors = no,
@@ -531,7 +546,7 @@
VerboseErrors = yes
)
),
- globals.lookup_bool_option(Globals, statistics, Statistics),
+ globals.lookup_bool_option(!.Globals, statistics, Statistics),
(
Statistics = yes,
io.report_stats("full_memory_stats", !IO)
@@ -542,10 +557,10 @@
:- pred process_all_args(options_variables::in, list(string)::in,
list(string)::in, list(string)::out, list(string)::out,
- io::di, io::uo) is det.
+ globals::in, globals::out, io::di, io::uo) is det.
process_all_args(OptionVariables, OptionArgs, Args, ModulesToLink,
- FactTableObjFiles, !IO) :-
+ FactTableObjFiles, !Globals, !IO) :-
% Because of limitations in the GCC back-end,
% we can only call the GCC back-end once (per process),
% to generate a single assembler file, rather than
@@ -553,11 +568,10 @@
% assembler files for each module.
% So if we're generating code using the GCC back-end,
% we need to call run_gcc_backend here at the top level.
- globals.io_get_globals(Globals, !IO),
- ( compiling_to_asm(Globals) ->
+ ( compiling_to_asm(!.Globals) ->
(
Args = [FirstArg | OtherArgs],
- globals.lookup_bool_option(Globals, smart_recompilation, Smart),
+ globals.lookup_bool_option(!.Globals, smart_recompilation, Smart),
(
Smart = yes,
(
@@ -566,7 +580,7 @@
% the gcc backend to avoid overwriting the output assembler
% file even if recompilation is found to be unnecessary.
process_args(OptionVariables, OptionArgs, Args,
- ModulesToLink, FactTableObjFiles, !IO)
+ ModulesToLink, FactTableObjFiles, !Globals, !IO)
;
OtherArgs = [_ | _],
Msg = "Sorry, not implemented: " ++
@@ -579,12 +593,14 @@
)
;
Smart = no,
+ globals.io_set_globals(!.Globals, !IO),
compile_using_gcc_backend(OptionVariables, OptionArgs,
string_to_file_or_module(FirstArg),
process_args_no_fact_table(OptionVariables, OptionArgs,
Args),
ModulesToLink, !IO),
- FactTableObjFiles = []
+ FactTableObjFiles = [],
+ globals.io_get_globals(!:Globals, !IO)
)
;
Args = [],
@@ -599,7 +615,7 @@
% If we're NOT using the GCC back-end, then we can just call
% process_args directly, rather than via GCC.
process_args(OptionVariables, OptionArgs, Args, ModulesToLink,
- FactTableObjFiles, !IO)
+ FactTableObjFiles, !Globals, !IO)
).
:- pred compiling_to_asm(globals::in) is semidet.
@@ -621,8 +637,8 @@
:- pred compile_using_gcc_backend(options_variables::in, list(string)::in,
file_or_module::in,
- frontend_callback(list(string))::in(frontend_callback),
- list(string)::out, io::di, io::uo) is det.
+ frontend_callback(list(string))::in(frontend_callback), list(string)::out,
+ io::di, io::uo) is det.
compile_using_gcc_backend(OptionVariables, OptionArgs, FirstFileOrModule,
CallBack, ModulesToLink, !IO) :-
@@ -769,32 +785,35 @@
process_args_no_fact_table(OptionVariables, OptionArgs, Args, ModulesToLink,
!IO) :-
+ globals.io_get_globals(Globals0, !IO),
process_args(OptionVariables, OptionArgs, Args, ModulesToLink,
- _FactTableObjFiles, !IO).
+ _FactTableObjFiles, Globals0, Globals, !IO),
+ globals.io_set_globals(Globals, !IO).
:- pred process_args(options_variables::in, list(string)::in, list(string)::in,
- list(string)::out, list(string)::out, io::di, io::uo) is det.
+ list(string)::out, list(string)::out,
+ globals::in, globals::out, io::di, io::uo) is det.
process_args(OptionVariables, OptionArgs, Args, ModulesToLink,
- FactTableObjFiles, !IO) :-
- globals.io_lookup_bool_option(filenames_from_stdin, FileNamesFromStdin,
- !IO),
+ FactTableObjFiles, !Globals, !IO) :-
+ globals.lookup_bool_option(!.Globals, filenames_from_stdin,
+ FileNamesFromStdin),
(
FileNamesFromStdin = yes,
process_stdin_arg_list(OptionVariables, OptionArgs,
- [], ModulesToLink, [], FactTableObjFiles, !IO)
+ [], ModulesToLink, [], FactTableObjFiles, !Globals, !IO)
;
FileNamesFromStdin = no,
process_arg_list(OptionVariables, OptionArgs,
- Args, ModulesToLink, FactTableObjFiles, !IO)
+ Args, ModulesToLink, FactTableObjFiles, !Globals, !IO)
).
-
:- pred process_stdin_arg_list(options_variables::in, list(string)::in,
list(string)::in, list(string)::out,
- list(string)::in, list(string)::out, io::di, io::uo) is det.
+ list(string)::in, list(string)::out,
+ globals::in, globals::out, io::di, io::uo) is det.
process_stdin_arg_list(OptionVariables, OptionArgs, !Modules,
- !FactTableObjFiles, !IO) :-
+ !FactTableObjFiles, !Globals, !IO) :-
(
!.Modules = [_ | _],
garbage_collect(!IO)
@@ -806,11 +825,11 @@
FileResult = ok(Line),
Arg = string.rstrip(Line),
process_arg(OptionVariables, OptionArgs, Arg, Module,
- FactTableObjFileList, !IO),
+ FactTableObjFileList, !Globals, !IO),
list.append(Module, !Modules),
list.append(FactTableObjFileList, !FactTableObjFiles),
process_stdin_arg_list(OptionVariables, OptionArgs,
- !Modules, !FactTableObjFiles, !IO)
+ !Modules, !FactTableObjFiles, !Globals, !IO)
;
FileResult = eof
;
@@ -823,33 +842,33 @@
:- pred process_arg_list(options_variables::in, list(string)::in,
list(string)::in, list(string)::out, list(string)::out,
- io::di, io::uo) is det.
+ globals::in, globals::out, io::di, io::uo) is det.
process_arg_list(OptionVariables, OptionArgs, Args, Modules, FactTableObjFiles,
- !IO) :-
+ !Globals, !IO) :-
process_arg_list_2(OptionVariables, OptionArgs, Args, ModulesList,
- FactTableObjFileLists, !IO),
+ FactTableObjFileLists, !Globals, !IO),
list.condense(ModulesList, Modules),
list.condense(FactTableObjFileLists, FactTableObjFiles).
:- pred process_arg_list_2(options_variables::in, list(string)::in,
list(string)::in, list(list(string))::out, list(list(string))::out,
- io::di, io::uo) is det.
+ globals::in, globals::out, io::di, io::uo) is det.
-process_arg_list_2(_, _, [], [], [], !IO).
+process_arg_list_2(_, _, [], [], [], !Globals, !IO).
process_arg_list_2(OptionVariables, OptionArgs, [Arg | Args],
- [Modules | ModulesList],
- [FactTableObjFiles | FactTableObjFileLists], !IO) :-
+ [Modules | ModulesTail], [FactTableObjFiles | FactTableObjFileTail],
+ !Globals, !IO) :-
process_arg(OptionVariables, OptionArgs, Arg, Modules, FactTableObjFiles,
- !IO),
+ !Globals, !IO),
(
Args = [_ | _],
garbage_collect(!IO)
;
Args = []
),
- process_arg_list_2(OptionVariables, OptionArgs, Args, ModulesList,
- FactTableObjFileLists, !IO).
+ process_arg_list_2(OptionVariables, OptionArgs, Args, ModulesTail,
+ FactTableObjFileTail, !Globals, !IO).
% Figure out whether the argument is a module name or a file name.
% Open the specified file or module, and process it.
@@ -858,19 +877,22 @@
% that should be linked into the final executable.
:- pred process_arg(options_variables::in, list(string)::in, string::in,
- list(string)::out, list(string)::out, io::di, io::uo) is det.
+ list(string)::out, list(string)::out,
+ globals::in, globals::out, io::di, io::uo) is det.
process_arg(OptionVariables, OptionArgs, Arg, ModulesToLink, FactTableObjFiles,
- !IO) :-
+ !Globals, !IO) :-
FileOrModule = string_to_file_or_module(Arg),
globals.io_lookup_bool_option(invoked_by_mmc_make, InvokedByMake, !IO),
(
InvokedByMake = no,
+ globals.io_set_globals(!.Globals, !IO),
build_with_module_options_args(
file_or_module_to_module_name(FileOrModule),
OptionVariables, OptionArgs, [],
process_arg_build(FileOrModule, OptionVariables, OptionArgs),
_, [], MaybePair, !IO),
+ globals.io_get_globals(!:Globals, !IO),
(
MaybePair = yes(ModulesToLink - FactTableObjFiles)
;
@@ -882,7 +904,7 @@
InvokedByMake = yes,
% `mmc --make' has already set up the options.
process_arg_2(OptionVariables, OptionArgs, FileOrModule,
- ModulesToLink, FactTableObjFiles, !IO)
+ ModulesToLink, FactTableObjFiles, !Globals, !IO)
).
:- pred process_arg_build(file_or_module::in, options_variables::in,
@@ -891,46 +913,48 @@
process_arg_build(FileOrModule, OptionVariables, OptionArgs, _, yes,
_, Modules - FactTableObjFiles, !IO) :-
+ globals.io_get_globals(Globals0, !IO),
process_arg_2(OptionVariables, OptionArgs, FileOrModule, Modules,
- FactTableObjFiles, !IO).
+ FactTableObjFiles, Globals0, Globals, !IO),
+ globals.io_set_globals(Globals, !IO).
:- pred process_arg_2(options_variables::in, list(string)::in,
file_or_module::in, list(string)::out, list(string)::out,
- io::di, io::uo) is det.
+ globals::in, globals::out, io::di, io::uo) is det.
process_arg_2(OptionVariables, OptionArgs, FileOrModule, ModulesToLink,
- FactTableObjFiles, !IO) :-
- globals.io_lookup_bool_option(generate_dependencies, GenerateDeps, !IO),
+ FactTableObjFiles, !Globals, !IO) :-
+ globals.lookup_bool_option(!.Globals, generate_dependencies, GenerateDeps),
(
GenerateDeps = yes,
ModulesToLink = [],
FactTableObjFiles = [],
(
FileOrModule = fm_file(FileName),
- generate_file_dependencies(FileName, !IO)
+ generate_file_dependencies(!.Globals, FileName, !IO)
;
FileOrModule = fm_module(ModuleName),
- generate_module_dependencies(ModuleName, !IO)
+ generate_module_dependencies(!.Globals, ModuleName, !IO)
)
;
GenerateDeps = no,
- globals.io_lookup_bool_option(generate_dependency_file,
- GenerateDepFile, !IO),
+ globals.lookup_bool_option(!.Globals, generate_dependency_file,
+ GenerateDepFile),
(
GenerateDepFile = yes,
ModulesToLink = [],
FactTableObjFiles = [],
(
FileOrModule = fm_file(FileName),
- generate_file_dependency_file(FileName, !IO)
+ generate_file_dependency_file(!.Globals, FileName, !IO)
;
FileOrModule = fm_module(ModuleName),
- generate_module_dependency_file(ModuleName, !IO)
+ generate_module_dependency_file(!.Globals, ModuleName, !IO)
)
;
GenerateDepFile = no,
process_module(OptionVariables, OptionArgs,
- FileOrModule, ModulesToLink, FactTableObjFiles, !IO)
+ FileOrModule, ModulesToLink, FactTableObjFiles, !Globals, !IO)
)
).
@@ -959,15 +983,19 @@
file_name_to_module_name(FileName, ModuleName).
file_or_module_to_module_name(fm_module(ModuleName)) = ModuleName.
-:- pred read_module_or_file(file_or_module::in, maybe_return_timestamp::in,
- module_name::out, file_name::out, maybe(timestamp)::out, list(item)::out,
- module_error::out, read_modules::in, read_modules::out,
- io::di, io::uo) is det.
-
-read_module_or_file(fm_module(ModuleName), ReturnTimestamp,
- ModuleName, FileName, MaybeTimestamp, Items, Error, !ReadModules,
- !IO) :-
- globals.io_lookup_bool_option(verbose, Verbose, !IO),
+:- pred read_module_or_file(file_or_module::in,
+ maybe_return_timestamp::in, module_name::out, file_name::out,
+ maybe(timestamp)::out, list(item)::out,
+ list(error_spec)::out, module_error::out,
+ have_read_module_map::in, have_read_module_map::out,
+ globals::in, globals::out, io::di, io::uo) is det.
+
+read_module_or_file(FileOrModuleName, ReturnTimestamp,
+ ModuleName, SourceFileName, MaybeTimestamp, Items, Specs, Error,
+ !HaveReadModuleMap, !Globals, !IO) :-
+ (
+ FileOrModuleName = fm_module(ModuleName),
+ globals.lookup_bool_option(!.Globals, verbose, Verbose),
maybe_write_string(Verbose, "% Parsing module `", !IO),
ModuleNameString = sym_name_to_string(ModuleName),
maybe_write_string(Verbose, ModuleNameString, !IO),
@@ -975,26 +1003,29 @@
(
% Avoid rereading the module if it was already read
% by recompilation_version.m.
- find_read_module(!.ReadModules, ModuleName, ".m", ReturnTimestamp,
- ItemsPrime, MaybeTimestampPrime, ErrorPrime, FileNamePrime)
+ find_read_module(!.HaveReadModuleMap, ModuleName, ".m",
+ ReturnTimestamp, ItemsPrime, SpecsPrime, ErrorPrime,
+ SourceFileNamePrime, MaybeTimestampPrime)
->
- map.delete(!.ReadModules, ModuleName - ".m", !:ReadModules),
- FileName = FileNamePrime,
+ svmap.delete(ModuleName - ".m", !HaveReadModuleMap),
Items = ItemsPrime,
+ Specs = SpecsPrime,
Error = ErrorPrime,
+ SourceFileName = SourceFileNamePrime,
MaybeTimestamp = MaybeTimestampPrime
;
% We don't search `--search-directories' for source files
% because that can result in the generated interface files
% being created in the wrong directory.
- read_module(ModuleName, ".m", "Reading module", do_not_search,
- ReturnTimestamp, Items, Error, FileName, MaybeTimestamp, !IO)
+ read_module(!.Globals, ModuleName, ".m", "Reading module",
+ do_not_search, ReturnTimestamp, Items, Specs, Error,
+ SourceFileName, MaybeTimestamp, !IO)
),
- globals.io_lookup_bool_option(statistics, Stats, !IO),
- maybe_report_stats(Stats, !IO).
-read_module_or_file(fm_file(FileName), ReturnTimestamp, ModuleName,
- SourceFileName, MaybeTimestamp, Items, Error, !ReadModules, !IO) :-
- globals.io_lookup_bool_option(verbose, Verbose, !IO),
+ globals.lookup_bool_option(!.Globals, statistics, Stats),
+ maybe_report_stats(Stats, !IO)
+ ;
+ FileOrModuleName = fm_file(FileName),
+ globals.lookup_bool_option(!.Globals, verbose, Verbose),
maybe_write_string(Verbose, "% Parsing file `", !IO),
maybe_write_string(Verbose, FileName, !IO),
maybe_write_string(Verbose, "' and imported interfaces...\n", !IO),
@@ -1003,32 +1034,37 @@
(
% Avoid rereading the module if it was already read
% by recompilation_version.m.
- find_read_module(!.ReadModules, DefaultModuleName, ".m",
- ReturnTimestamp, ItemsPrime, MaybeTimestampPrime, ErrorPrime, _)
+ find_read_module(!.HaveReadModuleMap, DefaultModuleName, ".m",
+ ReturnTimestamp, ItemsPrime, SpecsPrime, ErrorPrime,
+ _, MaybeTimestampPrime)
->
- map.delete(!.ReadModules, ModuleName - ".m", !:ReadModules),
+ svmap.delete(ModuleName - ".m", !HaveReadModuleMap),
ModuleName = DefaultModuleName,
Items = ItemsPrime,
+ Specs = SpecsPrime,
Error = ErrorPrime,
MaybeTimestamp = MaybeTimestampPrime
;
% We don't search `--search-directories' for source files
% because that can result in the generated interface files
% being created in the wrong directory.
- read_module_from_file(FileName, ".m", "Reading file", do_not_search,
- ReturnTimestamp, Items, Error, ModuleName, MaybeTimestamp, !IO),
+ read_module_from_file(FileName, ".m", "Reading file",
+ do_not_search, ReturnTimestamp, Items, Specs, Error,
+ ModuleName, MaybeTimestamp, !IO),
% XXX If the module name doesn't match the file name, the compiler
- % won't be able to find the `.used' file (the name of the `.used' file
- % is derived from the module name not the file name). This will be
- % fixed when mmake functionality is moved into the compiler.
+ % won't be able to find the `.used' file (the name of the `.used'
+ % file is derived from the module name not the file name).
+ % This will be fixed when mmake functionality is moved into
+ % the compiler.
- globals.io_lookup_bool_option(smart_recompilation, Smart, !IO),
+ globals.lookup_bool_option(!.Globals, smart_recompilation, Smart),
(
Smart = yes,
ModuleName \= DefaultModuleName
->
- globals.io_lookup_bool_option(warn_smart_recompilation, Warn, !IO),
+ globals.lookup_bool_option(!.Globals, warn_smart_recompilation,
+ Warn),
(
Warn = yes,
Pieces =
@@ -1044,14 +1080,16 @@
;
Warn = no
),
- globals.io_set_option(smart_recompilation, bool(no), !IO)
+ globals.set_option(smart_recompilation, bool(no), !Globals),
+ globals.io_set_globals(!.Globals, !IO)
;
true
)
),
- globals.io_lookup_bool_option(detailed_statistics, Stats, !IO),
+ globals.lookup_bool_option(!.Globals, detailed_statistics, Stats),
maybe_report_stats(Stats, !IO),
- string.append(FileName, ".m", SourceFileName).
+ string.append(FileName, ".m", SourceFileName)
+ ).
:- func version_numbers_return_timestamp(bool) = maybe_return_timestamp.
@@ -1060,31 +1098,30 @@
:- pred process_module(options_variables::in, list(string)::in,
file_or_module::in, list(string)::out, list(string)::out,
- io::di, io::uo) is det.
+ globals::in, globals::out, io::di, io::uo) is det.
process_module(OptionVariables, OptionArgs, FileOrModule, ModulesToLink,
- FactTableObjFiles, !IO) :-
- globals.io_get_globals(Globals, !IO),
- globals.lookup_bool_option(Globals, halt_at_syntax_errors, HaltSyntax),
- globals.lookup_bool_option(Globals, make_interface, MakeInterface),
- globals.lookup_bool_option(Globals, make_short_interface,
+ FactTableObjFiles, !Globals, !IO) :-
+ globals.lookup_bool_option(!.Globals, halt_at_syntax_errors, HaltSyntax),
+ globals.lookup_bool_option(!.Globals, make_interface, MakeInterface),
+ globals.lookup_bool_option(!.Globals, make_short_interface,
MakeShortInterface),
- globals.lookup_bool_option(Globals, make_private_interface,
+ globals.lookup_bool_option(!.Globals, make_private_interface,
MakePrivateInterface),
- globals.lookup_bool_option(Globals, convert_to_mercury,
+ globals.lookup_bool_option(!.Globals, convert_to_mercury,
ConvertToMercury),
- globals.lookup_bool_option(Globals, generate_item_version_numbers,
+ globals.lookup_bool_option(!.Globals, generate_item_version_numbers,
GenerateVersionNumbers),
(
( MakeInterface = yes ->
- ProcessModule = make_interface,
+ ProcessModule = call_make_interface(!.Globals),
ReturnTimestamp =
version_numbers_return_timestamp(GenerateVersionNumbers)
; MakeShortInterface = yes ->
- ProcessModule = make_short_interface,
+ ProcessModule = call_make_short_interface(!.Globals),
ReturnTimestamp = do_not_return_timestamp
; MakePrivateInterface = yes ->
- ProcessModule = make_private_interface,
+ ProcessModule = call_make_private_interface(!.Globals),
ReturnTimestamp =
version_numbers_return_timestamp(GenerateVersionNumbers)
;
@@ -1092,17 +1129,20 @@
)
->
read_module_or_file(FileOrModule, ReturnTimestamp,
- ModuleName, FileName, MaybeTimestamp, Items, Error,
- map.init, _, !IO),
+ ModuleName, FileName, MaybeTimestamp, Items, Specs0, Error,
+ map.init, _, !Globals, !IO),
( halt_at_module_error(HaltSyntax, Error) ->
true
;
- split_into_submodules(ModuleName, Items, SubModuleList, [], Specs),
+ split_into_submodules(ModuleName, Items, SubModuleList,
+ Specs0, Specs),
% XXX _NumErrors
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
+ write_error_specs(Specs, !.Globals, 0, _NumWarnings, 0, _NumErrors,
!IO),
- list.foldl(apply_process_module(ProcessModule,
- FileName, ModuleName, MaybeTimestamp), SubModuleList, !IO)
+ list.foldl(
+ apply_process_module(ProcessModule, FileName, ModuleName,
+ MaybeTimestamp),
+ SubModuleList, !IO)
),
ModulesToLink = [],
FactTableObjFiles = []
@@ -1110,7 +1150,10 @@
ConvertToMercury = yes
->
read_module_or_file(FileOrModule, do_not_return_timestamp,
- ModuleName, _, _, Items, Error, map.init, _, !IO),
+ ModuleName, _, _, Items, Specs, Error, map.init, _, !Globals, !IO),
+ % XXX _NumErrors
+ write_error_specs(Specs, !.Globals, 0, _NumWarnings, 0, _NumErrors,
+ !IO),
( halt_at_module_error(HaltSyntax, Error) ->
true
;
@@ -1121,9 +1164,8 @@
ModulesToLink = [],
FactTableObjFiles = []
;
- globals.lookup_bool_option(Globals, smart_recompilation,
- Smart),
- globals.get_target(Globals, Target),
+ globals.lookup_bool_option(!.Globals, smart_recompilation, Smart),
+ globals.get_target(!.Globals, Target),
(
Smart = yes,
(
@@ -1139,11 +1181,12 @@
file_name_to_module_name(FileName, ModuleName)
),
- find_smart_recompilation_target_files(ModuleName, Globals,
+ find_smart_recompilation_target_files(ModuleName, !.Globals,
FindTargetFiles),
- find_timestamp_files(ModuleName, Globals, FindTimestampFiles),
- recompilation.check.should_recompile(ModuleName, FindTargetFiles,
- FindTimestampFiles, ModulesToRecompile0, ReadModules, !IO),
+ find_timestamp_files(ModuleName, !.Globals, FindTimestampFiles),
+ recompilation.check.should_recompile(!.Globals, ModuleName,
+ FindTargetFiles, FindTimestampFiles, ModulesToRecompile0,
+ HaveReadModuleMap, !IO),
(
Target = target_asm,
ModulesToRecompile0 = some_modules([_ | _])
@@ -1157,7 +1200,7 @@
)
;
Smart = no,
- map.init(ReadModules),
+ map.init(HaveReadModuleMap),
ModulesToRecompile = all_modules
),
( ModulesToRecompile = some_modules([]) ->
@@ -1172,15 +1215,18 @@
Smart = yes
->
% See the comment in process_all_args.
+ globals.io_set_globals(!.Globals, !IO),
compile_using_gcc_backend(OptionVariables,
OptionArgs, FileOrModule,
process_module_2_no_fact_table(FileOrModule,
- ModulesToRecompile, ReadModules),
+ ModulesToRecompile, HaveReadModuleMap),
ModulesToLink, !IO),
- FactTableObjFiles = []
+ FactTableObjFiles = [],
+ globals.io_get_globals(!:Globals, !IO)
;
- process_module_2(FileOrModule, ModulesToRecompile, ReadModules,
- ModulesToLink, FactTableObjFiles, !IO)
+ process_module_2(FileOrModule, ModulesToRecompile,
+ HaveReadModuleMap, ModulesToLink, FactTableObjFiles,
+ !Globals, !IO)
)
)
).
@@ -1197,32 +1243,35 @@
ProcessModule(FileName, ModuleName, MaybeTimestamp, SubModule, !IO).
:- pred process_module_2_no_fact_table(file_or_module::in,
- modules_to_recompile::in, read_modules::in, list(string)::out,
+ modules_to_recompile::in, have_read_module_map::in, list(string)::out,
io::di, io::uo) is det.
process_module_2_no_fact_table(FileOrModule, MaybeModulesToRecompile,
- ReadModules0, ModulesToLink, !IO) :-
- process_module_2(FileOrModule, MaybeModulesToRecompile, ReadModules0,
- ModulesToLink, _FactTableObjFiles, !IO).
+ HaveReadModuleMap0, ModulesToLink, !IO) :-
+ globals.io_get_globals(Globals0, !IO),
+ process_module_2(FileOrModule, MaybeModulesToRecompile, HaveReadModuleMap0,
+ ModulesToLink, _FactTableObjFiles, Globals0, Globals, !IO),
+ globals.io_set_globals(Globals, !IO).
:- pred process_module_2(file_or_module::in, modules_to_recompile::in,
- read_modules::in, list(string)::out, list(string)::out,
- io::di, io::uo) is det.
+ have_read_module_map::in, list(string)::out, list(string)::out,
+ globals::in, globals::out, io::di, io::uo) is det.
-process_module_2(FileOrModule, MaybeModulesToRecompile, ReadModules0,
- ModulesToLink, FactTableObjFiles, !IO) :-
+process_module_2(FileOrModule, MaybeModulesToRecompile,
+ HaveReadModuleMap0, ModulesToLink, FactTableObjFiles, !Globals, !IO) :-
read_module_or_file(FileOrModule, do_return_timestamp,
- ModuleName, FileName, MaybeTimestamp, Items, Error,
- ReadModules0, ReadModules, !IO),
- globals.io_get_globals(Globals, !IO),
- globals.lookup_bool_option(Globals, halt_at_syntax_errors, HaltSyntax),
+ ModuleName, FileName, MaybeTimestamp, Items, Specs0, Error,
+ HaveReadModuleMap0, HaveReadModuleMap, !Globals, !IO),
+ globals.lookup_bool_option(!.Globals, halt_at_syntax_errors, HaltSyntax),
( halt_at_module_error(HaltSyntax, Error) ->
+ % XXX _NumErrors
+ write_error_specs(Specs0, !.Globals, 0, _NumWarnings, 0, _NumErrors,
+ !IO),
ModulesToLink = [],
FactTableObjFiles = []
;
- split_into_submodules(ModuleName, Items, SubModuleList0, [], Specs),
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
- !IO),
+ split_into_submodules(ModuleName, Items, SubModuleList0,
+ Specs0, Specs1),
(
MaybeModulesToRecompile = some_modules(ModulesToRecompile),
ToRecompile = (pred((SubModule - _)::in) is semidet :-
@@ -1236,9 +1285,9 @@
assoc_list.keys(SubModuleList0, NestedSubModules0),
list.delete_all(NestedSubModules0, ModuleName, NestedSubModules),
- find_timestamp_files(ModuleName, Globals, FindTimestampFiles),
+ find_timestamp_files(ModuleName, !.Globals, FindTimestampFiles),
- globals.lookup_bool_option(Globals, trace_prof, TraceProf),
+ globals.lookup_bool_option(!.Globals, trace_prof, TraceProf),
(
non_traced_mercury_builtin_module(ModuleName),
@@ -1252,22 +1301,26 @@
% on them. Predicates defined there should never be part of
% an execution trace anyway; they are effectively language
% primitives. (They may still be parts of stack traces.)
- globals.lookup_bool_option(Globals, trace_stack_layout, TSL),
- globals.get_trace_level(Globals, TraceLevel),
+ globals.lookup_bool_option(!.Globals, trace_stack_layout, TSL),
+ globals.get_trace_level(!.Globals, TraceLevel),
- globals.io_set_option(trace_stack_layout, bool(no), !IO),
- globals.io_set_trace_level_none(!IO),
-
- compile_all_submodules(FileName, ModuleName, NestedSubModules,
- MaybeTimestamp, ReadModules, FindTimestampFiles,
- SubModuleListToCompile, ModulesToLink, FactTableObjFiles, !IO),
-
- globals.io_set_option(trace_stack_layout, bool(TSL), !IO),
- globals.io_set_trace_level(TraceLevel, !IO)
- ;
- compile_all_submodules(FileName, ModuleName, NestedSubModules,
- MaybeTimestamp, ReadModules, FindTimestampFiles,
- SubModuleListToCompile, ModulesToLink, FactTableObjFiles, !IO)
+ globals.set_option(trace_stack_layout, bool(no), !Globals),
+ globals.set_trace_level_none(!Globals),
+ globals.io_set_globals(!.Globals, !IO),
+
+ compile_all_submodules(!.Globals, FileName, ModuleName,
+ NestedSubModules, MaybeTimestamp, HaveReadModuleMap,
+ FindTimestampFiles, SubModuleListToCompile, Specs1,
+ ModulesToLink, FactTableObjFiles, !IO),
+
+ globals.set_option(trace_stack_layout, bool(TSL), !Globals),
+ globals.set_trace_level(TraceLevel, !Globals),
+ globals.io_set_globals(!.Globals, !IO)
+ ;
+ compile_all_submodules(!.Globals, FileName, ModuleName,
+ NestedSubModules, MaybeTimestamp, HaveReadModuleMap,
+ FindTimestampFiles, SubModuleListToCompile, Specs1,
+ ModulesToLink, FactTableObjFiles, !IO)
)
).
@@ -1282,43 +1335,49 @@
%
% i.e. compile nested modules to a single C file.
-:- pred compile_all_submodules(string::in, module_name::in,
- list(module_name)::in, maybe(timestamp)::in, read_modules::in,
+:- pred compile_all_submodules(globals::in, string::in, module_name::in,
+ list(module_name)::in, maybe(timestamp)::in, have_read_module_map::in,
find_timestamp_file_names::in(find_timestamp_file_names),
- list(pair(module_name, list(item)))::in, list(string)::out,
- list(string)::out, io::di, io::uo) is det.
+ list(pair(module_name, list(item)))::in, list(error_spec)::in,
+ list(string)::out, list(string)::out, io::di, io::uo) is det.
-compile_all_submodules(FileName, SourceFileModuleName, NestedSubModules,
- MaybeTimestamp, ReadModules, FindTimestampFiles,
- SubModuleList, ModulesToLink, FactTableObjFiles, !IO) :-
- list.map_foldl(compile(FileName, SourceFileModuleName, NestedSubModules,
- MaybeTimestamp, ReadModules, FindTimestampFiles),
- SubModuleList, FactTableObjFileLists, !IO),
+compile_all_submodules(Globals, FileName, SourceFileModuleName,
+ NestedSubModules, MaybeTimestamp, HaveReadModuleMap,
+ FindTimestampFiles, SubModuleList, !.Specs,
+ ModulesToLink, FactTableObjFiles, !IO) :-
+ list.map_foldl2(
+ compile(Globals, FileName, SourceFileModuleName, NestedSubModules,
+ MaybeTimestamp, HaveReadModuleMap, FindTimestampFiles),
+ SubModuleList, FactTableObjFileLists, !Specs, !IO),
+ % XXX _NumErrors
+ write_error_specs(!.Specs, Globals, 0, _NumWarnings, 0, _NumErrors, !IO),
list.map(module_to_link, SubModuleList, ModulesToLink),
list.condense(FactTableObjFileLists, FactTableObjFiles).
-:- pred make_interface(file_name::in, module_name::in, maybe(timestamp)::in,
- pair(module_name, list(item))::in, io::di, io::uo) is det.
+:- pred call_make_interface(globals::in, file_name::in, module_name::in,
+ maybe(timestamp)::in, pair(module_name, list(item))::in, io::di, io::uo)
+ is det.
-make_interface(SourceFileName, SourceFileModuleName, MaybeTimestamp,
- ModuleName - Items, !IO) :-
- make_interface(SourceFileName, SourceFileModuleName,
+call_make_interface(Globals, SourceFileName, SourceFileModuleName,
+ MaybeTimestamp, ModuleName - Items, !IO) :-
+ make_interface(Globals, SourceFileName, SourceFileModuleName,
ModuleName, MaybeTimestamp, Items, !IO).
-:- pred make_short_interface(file_name::in, module_name::in,
+:- pred call_make_short_interface(globals::in, file_name::in, module_name::in,
maybe(timestamp)::in, pair(module_name, list(item))::in,
io::di, io::uo) is det.
-make_short_interface(SourceFileName, _, _, ModuleName - Items, !IO) :-
- make_short_interface(SourceFileName, ModuleName, Items, !IO).
+call_make_short_interface(Globals, SourceFileName, _, _, ModuleName - Items,
+ !IO) :-
+ make_short_interface(Globals, SourceFileName, ModuleName, Items, !IO).
-:- pred make_private_interface(file_name::in, module_name::in,
- maybe(timestamp)::in, pair(module_name, list(item))::in,
+:- pred call_make_private_interface(globals::in, file_name::in,
+ module_name::in, maybe(timestamp)::in, pair(module_name, list(item))::in,
io::di, io::uo) is det.
-make_private_interface(SourceFileName, SourceFileModuleName,
+call_make_private_interface(Globals, SourceFileName, SourceFileModuleName,
MaybeTimestamp, ModuleName - Items, !IO) :-
- make_private_interface(SourceFileName, SourceFileModuleName,
+ make_private_interface(Globals, SourceFileName, SourceFileModuleName,
ModuleName, MaybeTimestamp, Items, !IO).
:- pred halt_at_module_error(bool::in, module_error::in) is semidet.
@@ -1473,51 +1532,57 @@
% The initial arrangement has the stage numbers increasing by five
% so that new stages can be slotted in without too much trouble.
-:- pred compile(file_name::in, module_name::in, list(module_name)::in,
- maybe(timestamp)::in, read_modules::in,
+:- pred compile(globals::in, file_name::in, module_name::in,
+ list(module_name)::in, maybe(timestamp)::in, have_read_module_map::in,
find_timestamp_file_names::in(find_timestamp_file_names),
pair(module_name, list(item))::in, list(string)::out,
+ list(error_spec)::in, list(error_spec)::out,
io::di, io::uo) is det.
-compile(SourceFileName, SourceFileModuleName, NestedSubModules0,
- MaybeTimestamp, ReadModules, FindTimestampFiles,
- ModuleName - Items, FactTableObjFiles, !IO) :-
- check_for_no_exports(Items, ModuleName, !IO),
+compile(Globals, SourceFileName, SourceFileModuleName, NestedSubModules0,
+ MaybeTimestamp, HaveReadModuleMap, FindTimestampFiles,
+ ModuleName - Items, FactTableObjFiles, !Specs, !IO) :-
+ check_for_no_exports(Globals, Items, ModuleName, !Specs, !IO),
( ModuleName = SourceFileModuleName ->
NestedSubModules = NestedSubModules0
;
NestedSubModules = []
),
- grab_imported_modules(SourceFileName, SourceFileModuleName, ModuleName,
- NestedSubModules, ReadModules, MaybeTimestamp, Items, Module, Error2,
- !IO),
+ grab_imported_modules(Globals, SourceFileName, SourceFileModuleName,
+ ModuleName, NestedSubModules, HaveReadModuleMap, MaybeTimestamp,
+ Items, Module, !IO),
+ module_and_imports_get_results(Module, _, ImportedSpecs, Error),
+ !:Specs = ImportedSpecs ++ !.Specs,
(
- ( Error2 = no_module_errors
- ; Error2 = some_module_errors
+ ( Error = no_module_errors
+ ; Error = some_module_errors
),
- mercury_compile(Module, NestedSubModules, FindTimestampFiles,
- FactTableObjFiles, no_prev_dump, _, !IO)
+ mercury_compile(Globals, Module, NestedSubModules, FindTimestampFiles,
+ FactTableObjFiles, no_prev_dump, _, !Specs, !IO)
;
- Error2 = fatal_module_errors,
+ Error = fatal_module_errors,
FactTableObjFiles = []
).
-:- pred mercury_compile(module_imports::in, list(module_name)::in,
+:- pred mercury_compile(globals::in, module_and_imports::in,
+ list(module_name)::in,
find_timestamp_file_names::in(find_timestamp_file_names),
- list(string)::out, dump_info::in, dump_info::out, io::di, io::uo) is det.
+ list(string)::out, dump_info::in, dump_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-mercury_compile(Module, NestedSubModules, FindTimestampFiles,
- FactTableObjFiles, !DumpInfo, !IO) :-
- module_imports_get_module_name(Module, ModuleName),
+mercury_compile(Globals, Module, NestedSubModules, FindTimestampFiles,
+ FactTableObjFiles, !DumpInfo, !Specs, !IO) :-
+ module_and_imports_get_module_name(Module, ModuleName),
% If we are only typechecking or error checking, then we should not
% modify any files, this includes writing to .d files.
- globals.io_lookup_bool_option(typecheck_only, TypeCheckOnly, !IO),
- globals.io_lookup_bool_option(errorcheck_only, ErrorCheckOnly, !IO),
+ globals.lookup_bool_option(Globals, typecheck_only, TypeCheckOnly),
+ globals.lookup_bool_option(Globals, errorcheck_only, ErrorCheckOnly),
bool.or(TypeCheckOnly, ErrorCheckOnly, DontWriteDFile),
- pre_hlds_pass(Module, DontWriteDFile, HLDS1, QualInfo, MaybeTimestamps,
- UndefTypes, UndefModes, Errors1, !DumpInfo, !IO),
+ pre_hlds_pass(Globals, Module, DontWriteDFile, HLDS1, QualInfo,
+ MaybeTimestamps, UndefTypes, UndefModes, Errors1, !DumpInfo,
+ !Specs, !IO),
frontend_pass(QualInfo, UndefTypes, UndefModes, Errors1, Errors2,
- HLDS1, HLDS20, !DumpInfo, !IO),
+ HLDS1, HLDS20, !DumpInfo, !Specs, !IO),
(
Errors1 = no,
Errors2 = no
@@ -1823,14 +1888,14 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-:- pred pre_hlds_pass(module_imports::in, bool::in, module_info::out,
- make_hlds_qual_info::out, maybe(module_timestamps)::out,
+:- pred pre_hlds_pass(globals::in, module_and_imports::in, bool::in,
+ module_info::out, make_hlds_qual_info::out, maybe(module_timestamps)::out,
bool::out, bool::out, bool::out, dump_info::in, dump_info::out,
- io::di, io::uo) is det.
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-pre_hlds_pass(ModuleImports0, DontWriteDFile0, HLDS1, QualInfo,
- MaybeTimestamps, UndefTypes, UndefModes, FoundError, !DumpInfo, !IO) :-
- globals.io_get_globals(Globals, !IO),
+pre_hlds_pass(Globals, ModuleImports0, DontWriteDFile0, HLDS1, QualInfo,
+ MaybeTimestamps, UndefTypes, UndefModes, FoundError, !DumpInfo,
+ !Specs, !IO) :-
globals.lookup_bool_option(Globals, statistics, Stats),
globals.lookup_bool_option(Globals, verbose, Verbose),
globals.lookup_bool_option(Globals, invoked_by_mmc_make, MMCMake),
@@ -1842,7 +1907,7 @@
MakeOptInt),
DontWriteDFile = bool.or(DontWriteDFile1, MakeOptInt),
- module_imports_get_module_name(ModuleImports0, ModuleName),
+ module_and_imports_get_module_name(ModuleImports0, ModuleName),
(
DontWriteDFile = yes,
% The only time the TransOptDeps are required is when creating the
@@ -1856,9 +1921,14 @@
),
% Errors in .opt and .trans_opt files result in software errors.
- maybe_grab_optfiles(ModuleImports0, Verbose, MaybeTransOptDeps,
+ maybe_grab_optfiles(Globals, ModuleImports0, Verbose, MaybeTransOptDeps,
ModuleImports1, IntermodError, !IO),
+ % We pay attention to IntermodError instead of _Error. XXX Is this right?
+ module_and_imports_get_results(ModuleImports1, Items1, ItemSpecs, _Error),
+ !:Specs = ItemSpecs ++ !.Specs,
+ MaybeTimestamps = ModuleImports1 ^ mai_maybe_timestamps,
+
globals.lookup_string_option(Globals, event_set_file_name,
EventSetFileName),
( EventSetFileName = "" ->
@@ -1867,52 +1937,36 @@
EventSetErrors = no
;
read_event_set(EventSetFileName, EventSetName0, EventSpecMap0,
- EventSetErrorSpecs, !IO),
+ EventSetSpecs, !IO),
+ !:Specs = EventSetSpecs ++ !.Specs,
+ EventSetErrors = contains_errors(Globals, EventSetSpecs),
(
- EventSetErrorSpecs = [],
+ EventSetErrors = no,
EventSetName = EventSetName0,
- EventSpecMap1 = EventSpecMap0,
- EventSetErrors = no
+ EventSpecMap1 = EventSpecMap0
;
- EventSetErrorSpecs = [_ | _],
- EventSetName = "",
- EventSpecMap1 = map.init,
EventSetErrors = yes,
- % XXX _NumErrors
- write_error_specs(EventSetErrorSpecs, Globals,
- 0, _EventSpecNumWarnings, 0, _EventSpecNumErrors, !IO)
+ EventSetName = "",
+ EventSpecMap1 = map.init
)
),
- module_imports_get_items_list(ModuleImports1, Items1),
- MaybeTimestamps = ModuleImports1 ^ maybe_timestamps,
-
- invoke_module_qualify_items(Items1, Items2, EventSpecMap1, EventSpecMap2,
- ModuleName, EventSetFileName, Verbose, Stats, MQInfo0,
- MQUndefTypes, MQUndefModes, !IO),
+ invoke_module_qualify_items(Globals, Items1, Items2,
+ EventSpecMap1, EventSpecMap2, ModuleName, EventSetFileName,
+ Verbose, Stats, MQInfo0, MQUndefTypes, MQUndefModes, !Specs, !IO),
mq_info_get_recompilation_info(MQInfo0, RecompInfo0),
- expand_equiv_types(ModuleName, Verbose, Stats, Items2, Items,
+ expand_equiv_types(Globals, ModuleName, Verbose, Stats, Items2, Items,
EventSpecMap2, EventSpecMap, EqvMap, UsedModules,
- RecompInfo0, RecompInfo, ExpandSpecs, !IO),
+ RecompInfo0, RecompInfo, ExpandErrors, !Specs, !IO),
mq_info_set_recompilation_info(RecompInfo, MQInfo0, MQInfo),
- (
- ExpandSpecs = [],
- CircularTypes = no
- ;
- ExpandSpecs = [_ | _],
- CircularTypes = yes,
- % XXX _NumErrors
- write_error_specs(ExpandSpecs, Globals,
- 0, _ExpandNumWarnings, 0, _ExpandNumErrors, !IO)
- ),
EventSet = event_set(EventSetName, EventSpecMap),
- make_hlds(ModuleName, Items, EventSet, MQInfo, EqvMap, UsedModules,
- Verbose, Stats, HLDS0, QualInfo,
- MakeHLDSUndefTypes, MakeHLDSUndefModes, FoundError, !IO),
+ make_hlds(Globals, ModuleName, Items, EventSet, MQInfo, EqvMap,
+ UsedModules, Verbose, Stats, HLDS0, QualInfo,
+ MakeHLDSUndefTypes, MakeHLDSUndefModes, FoundError, !Specs, !IO),
- bool.or_list([MQUndefTypes, EventSetErrors, CircularTypes,
+ bool.or_list([MQUndefTypes, EventSetErrors, ExpandErrors,
MakeHLDSUndefTypes], UndefTypes),
bool.or(MQUndefModes, MakeHLDSUndefModes, UndefModes),
@@ -1945,33 +1999,34 @@
HLDS1 = HLDS0
).
-:- pred invoke_module_qualify_items(list(item)::in, list(item)::out,
- event_spec_map::in, event_spec_map::out,
+:- pred invoke_module_qualify_items(globals::in,
+ list(item)::in, list(item)::out, event_spec_map::in, event_spec_map::out,
module_name::in, string::in, bool::in, bool::in, mq_info::out,
- bool::out, bool::out, io::di, io::uo) is det.
+ bool::out, bool::out, list(error_spec)::in, list(error_spec)::out,
+ io::di, io::uo) is det.
-invoke_module_qualify_items(Items0, Items, EventSpecMap0, EventSpecMap,
+invoke_module_qualify_items(Globals, Items0, Items, EventSpecMap0, EventSpecMap,
ModuleName, EventSpecFileName, Verbose, Stats, MQInfo,
- UndefTypes, UndefModes, !IO) :-
+ UndefTypes, UndefModes, !Specs, !IO) :-
+ maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO),
maybe_write_string(Verbose, "% Module qualifying items...\n", !IO),
maybe_flush_output(Verbose, !IO),
- globals.io_get_globals(Globals, !IO),
module_name_to_file_name(ModuleName, ".m", do_not_create_dirs,
FileName, !IO),
module_qualify_items(Items0, Items, EventSpecMap0, EventSpecMap,
Globals, ModuleName, yes(FileName), EventSpecFileName, MQInfo,
- UndefTypes, UndefModes, [], Specs),
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors, !IO),
+ UndefTypes, UndefModes, [], QualifySpecs),
+ !:Specs = QualifySpecs ++ !.Specs,
+ maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO).
-:- pred maybe_grab_optfiles(module_imports::in, bool::in,
- maybe(list(module_name))::in, module_imports::out, bool::out,
+:- pred maybe_grab_optfiles(globals::in, module_and_imports::in, bool::in,
+ maybe(list(module_name))::in, module_and_imports::out, bool::out,
io::di, io::uo) is det.
-maybe_grab_optfiles(Imports0, Verbose, MaybeTransOptDeps, Imports, Error,
- !IO) :-
- globals.io_get_globals(Globals, !IO),
+maybe_grab_optfiles(Globals, Imports0, Verbose, MaybeTransOptDeps,
+ Imports, Error, !IO) :-
globals.lookup_bool_option(Globals, intermodule_optimization,
IntermodOpt),
globals.lookup_bool_option(Globals, use_opt_files, UseOptInt),
@@ -1991,7 +2046,7 @@
->
maybe_write_string(Verbose, "% Reading .opt files...\n", !IO),
maybe_flush_output(Verbose, !IO),
- grab_opt_files(Imports0, Imports1, Error1, !IO),
+ grab_opt_files(Globals, Imports0, Imports1, Error1, !IO),
maybe_write_string(Verbose, "% Done.\n", !IO)
;
Imports1 = Imports0,
@@ -2002,12 +2057,13 @@
MaybeTransOptDeps = yes(TransOptDeps),
% When creating the trans_opt file, only import the
% trans_opt files which are lower in the ordering.
- grab_trans_opt_files(TransOptDeps, Imports1, Imports, Error2, !IO)
+ grab_trans_opt_files(Globals, TransOptDeps, Imports1, Imports,
+ Error2, !IO)
;
MaybeTransOptDeps = no,
Imports = Imports1,
Error2 = no,
- module_imports_get_module_name(Imports, ModuleName),
+ module_and_imports_get_module_name(Imports, ModuleName),
globals.lookup_bool_option(Globals, warn_missing_trans_opt_deps,
WarnNoTransOptDeps),
(
@@ -2038,9 +2094,13 @@
% the .opt or .trans opt file, then import the trans_opt files
% for all the modules that are imported (or used), and for all
% ancestor modules.
- list.condense([Imports0 ^ parent_deps,
- Imports0 ^ int_deps, Imports0 ^ impl_deps], TransOptFiles),
- grab_trans_opt_files(TransOptFiles, Imports1, Imports, Error2, !IO)
+ TransOptFilesList =
+ [Imports0 ^ mai_parent_deps,
+ Imports0 ^ mai_int_deps,
+ Imports0 ^ mai_impl_deps],
+ list.condense(TransOptFilesList, TransOptFiles),
+ grab_trans_opt_files(Globals, TransOptFiles, Imports1, Imports,
+ Error2, !IO)
;
TransOpt = no,
Imports = Imports1,
@@ -2049,41 +2109,48 @@
),
bool.or(Error1, Error2, Error).
-:- pred expand_equiv_types(module_name::in, bool::in, bool::in,
+:- pred expand_equiv_types(globals::in, module_name::in, bool::in, bool::in,
list(item)::in, list(item)::out, event_spec_map::in, event_spec_map::out,
eqv_map::out, used_modules::out,
- maybe(recompilation_info)::in, maybe(recompilation_info)::out,
- list(error_spec)::out, io::di, io::uo) is det.
+ maybe(recompilation_info)::in, maybe(recompilation_info)::out, bool::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-expand_equiv_types(ModuleName, Verbose, Stats, Items0, Items,
+expand_equiv_types(Globals, ModuleName, Verbose, Stats, Items0, Items,
EventSpecMap0, EventSpecMap, EqvMap, UsedModules,
- RecompInfo0, RecompInfo, Specs, !IO) :-
- maybe_write_string(Verbose, "% Expanding equivalence types...", !IO),
+ RecompInfo0, RecompInfo, FoundError, !Specs, !IO) :-
+ maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO),
+ maybe_write_string(Verbose, "% Expanding equivalence types...\n", !IO),
maybe_flush_output(Verbose, !IO),
equiv_type.expand_eqv_types(ModuleName, Items0, Items,
EventSpecMap0, EventSpecMap, EqvMap, UsedModules,
- RecompInfo0, RecompInfo, Specs),
- maybe_write_string(Verbose, " done.\n", !IO),
+ RecompInfo0, RecompInfo, ExpandSpecs),
+ FoundError = contains_errors(Globals, ExpandSpecs),
+ !:Specs = ExpandSpecs ++ !.Specs,
+ maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO),
+ maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO).
-:- pred make_hlds(module_name::in, list(item)::in, event_set::in,
+:- pred make_hlds(globals::in, module_name::in, list(item)::in, event_set::in,
mq_info::in, eqv_map::in, used_modules::in, bool::in, bool::in,
module_info::out, make_hlds_qual_info::out,
- bool::out, bool::out, bool::out, io::di, io::uo) is det.
+ bool::out, bool::out, bool::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-make_hlds(Module, Items, EventSet, MQInfo, EqvMap, UsedModules,
- Verbose, Stats, !:HLDS, QualInfo,
- UndefTypes, UndefModes, FoundSemanticError, !IO) :-
+make_hlds(Globals, ModuleName, Items, EventSet, MQInfo, EqvMap, UsedModules,
+ Verbose, Stats, !:HLDS, QualInfo, UndefTypes, UndefModes,
+ FoundSemanticError, !Specs, !IO) :-
+ maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO),
maybe_write_string(Verbose, "% Converting parse tree to hlds...\n", !IO),
- Prog = unit_module(Module, Items),
- parse_tree_to_hlds(Prog, MQInfo, EqvMap, UsedModules, !:HLDS, QualInfo,
- UndefTypes, UndefModes, !IO),
+ ParseTree = unit_module(ModuleName, Items),
+ parse_tree_to_hlds(Globals, ParseTree, MQInfo, EqvMap, UsedModules,
+ QualInfo, UndefTypes, UndefModes, !:HLDS, MakeSpecs),
+ !:Specs = MakeSpecs ++ !.Specs,
module_info_set_event_set(EventSet, !HLDS),
- module_info_get_num_errors(!.HLDS, NumErrors),
io.get_exit_status(Status, !IO),
+ SpecsErrors = contains_errors(Globals, !.Specs),
(
( Status \= 0
- ; NumErrors > 0
+ ; SpecsErrors = yes
)
->
FoundSemanticError = yes,
@@ -2091,6 +2158,7 @@
;
FoundSemanticError = no
),
+ maybe_write_out_errors_no_module(Verbose, Globals, !Specs, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO).
@@ -2099,46 +2167,53 @@
:- pred frontend_pass(make_hlds_qual_info::in, bool::in, bool::in,
bool::in, bool::out, module_info::in, module_info::out,
- dump_info::in, dump_info::out, io::di, io::uo) is det.
+ dump_info::in, dump_info::out, list(error_spec)::in, list(error_spec)::out,
+ io::di, io::uo) is det.
frontend_pass(QualInfo0, FoundUndefTypeError, FoundUndefModeError, !FoundError,
- !HLDS, !DumpInfo, !IO) :-
+ !HLDS, !DumpInfo, !Specs, !IO) :-
% We can't continue after an undefined type error, since typecheck
% would get internal errors.
- globals.io_get_globals(Globals, !IO),
+ module_info_get_globals(!.HLDS, Globals),
globals.lookup_bool_option(Globals, verbose, Verbose),
(
FoundUndefTypeError = yes,
+ % We can't continue after an undefined type error, because if we did,
+ % typecheck could get internal errors.
!:FoundError = yes,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose,
"% Program contains undefined type error(s).\n", !IO),
io.set_exit_status(1, !IO)
;
FoundUndefTypeError = no,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "% Checking typeclasses...\n", !IO),
- check_typeclasses(!HLDS, QualInfo0, QualInfo, [], Specs),
+ check_typeclasses(!HLDS, QualInfo0, QualInfo, [], TypeClassSpecs),
+ !:Specs = TypeClassSpecs ++ !.Specs,
maybe_dump_hlds(!.HLDS, 5, "typeclass", !DumpInfo, !IO),
set_module_recomp_info(QualInfo, !HLDS),
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, NumErrors, !IO),
-
- % We can't continue after a typeclass error, since typecheck
- % can get internal errors.
- ( NumErrors > 0 ->
+ TypeClassErrors = contains_errors(Globals, TypeClassSpecs),
+ (
+ TypeClassErrors = yes,
+ % We can't continue after a typeclass error, because if we did,
+ % typecheck could get internal errors.
!:FoundError = yes
;
- frontend_pass_no_type_error(FoundUndefModeError, !FoundError,
- !HLDS, !DumpInfo, !IO)
+ TypeClassErrors = no,
+ frontend_pass_no_type_error(FoundUndefModeError,
+ !FoundError, !HLDS, !DumpInfo, !Specs, !IO)
)
).
:- pred frontend_pass_no_type_error(bool::in, bool::in, bool::out,
module_info::in, module_info::out, dump_info::in, dump_info::out,
- io::di, io::uo) is det.
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-frontend_pass_no_type_error(FoundUndefModeError, !FoundError, !HLDS, !DumpInfo,
- !IO) :-
- globals.io_get_globals(Globals, !IO),
+frontend_pass_no_type_error(FoundUndefModeError, !FoundError,
+ !HLDS, !DumpInfo, !Specs, !IO) :-
+ module_info_get_globals(!.HLDS, Globals),
globals.lookup_bool_option(Globals, verbose, Verbose),
globals.lookup_bool_option(Globals, statistics, Stats),
globals.lookup_bool_option(Globals, intermodule_optimization, IntermodOpt),
@@ -2160,8 +2235,10 @@
% to speed up compilation. This must be done after
% typeclass instances have been checked, since that
% fills in which pred_ids are needed by instance decls.
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "% Eliminating dead predicates... ", !IO),
dead_pred_elim(!HLDS),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "done.\n", !IO),
maybe_dump_hlds(!.HLDS, 10, "dead_pred_elim", !DumpInfo, !IO)
;
@@ -2172,12 +2249,11 @@
WarnInstsWithNoMatchingType),
(
WarnInstsWithNoMatchingType = yes,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose,
"% Checking that insts have matching types... ", !IO),
- check_hlds.inst_check.check_insts_have_matching_types(!.HLDS,
- [], InstSpecs),
- write_error_specs(InstSpecs, Globals,
- 0, _NumInstWarnings, 0, _NumInstErrors, !IO),
+ check_insts_have_matching_types(!.HLDS, !Specs),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "done.\n", !IO),
maybe_dump_hlds(!.HLDS, 12, "warn_insts_without_matching_type",
!DumpInfo, !IO)
@@ -2186,6 +2262,7 @@
),
% Next typecheck the clauses.
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "% Type-checking...\n", !IO),
maybe_write_string(Verbose, "% Type-checking clauses...\n", !IO),
(
@@ -2197,11 +2274,10 @@
typecheck_module(!HLDS, TypeCheckSpecs,
ExceededTypeCheckIterationLimit)
),
- write_error_specs(TypeCheckSpecs, Globals, 0, _NumTypeWarnings,
- 0, NumTypeErrors, !IO),
- maybe_report_stats(Stats, !IO),
- ( NumTypeErrors > 0 ->
- module_info_incr_num_errors(NumTypeErrors, !HLDS),
+ !:Specs = TypeCheckSpecs ++ !.Specs,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ FoundTypeError = contains_errors(Globals, TypeCheckSpecs),
+ (
FoundTypeError = yes,
maybe_write_string(Verbose,
"% Program contains type error(s).\n", !IO)
@@ -2209,6 +2285,7 @@
FoundTypeError = no,
maybe_write_string(Verbose, "% Program is type-correct.\n", !IO)
),
+ maybe_report_stats(Stats, !IO),
maybe_dump_hlds(!.HLDS, 15, "typecheck", !DumpInfo, !IO),
% We can't continue after an undefined inst/mode error, since
@@ -2226,13 +2303,14 @@
"or undefined mode error(s).\n", !IO),
io.set_exit_status(1, !IO)
; ExceededTypeCheckIterationLimit = yes ->
- % FoundTypeError will always be true here, so we've already
- % printed a message about the program containing type errors.
+ % FoundTypeError will always be true here, so if Verbose = yes,
+ % we've already printed a message about the program containing
+ % type errors.
!:FoundError = yes,
io.set_exit_status(1, !IO)
;
puritycheck(Verbose, Stats, !HLDS, FoundTypeError,
- FoundPostTypecheckError, !IO),
+ FoundPostTypecheckError, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 20, "puritycheck", !DumpInfo, !IO),
!:FoundError = !.FoundError `or` FoundTypeError,
@@ -2253,13 +2331,12 @@
% polymorphism before running mode analysis, and currently
% polymorphism may get internal errors if any of the predicates
% are not type-correct.
-
!:FoundError = yes
;
% Substitute implementation-defined literals before clauses are
% written out to `.opt' files.
subst_implementation_defined_literals(Verbose, Stats, !HLDS,
- !IO),
+ !Specs, !IO),
maybe_dump_hlds(!.HLDS, 25, "implementation_defined_literals",
!DumpInfo, !IO),
@@ -2268,7 +2345,8 @@
!.FoundError = no,
FoundUndefModeError = no
->
- maybe_write_optfile(MakeOptInt, !HLDS, !DumpInfo, !IO)
+ maybe_write_optfile(MakeOptInt, !HLDS, !DumpInfo, !Specs,
+ !IO)
;
true
),
@@ -2280,7 +2358,7 @@
% Now go ahead and do the rest of mode checking
% and determinism analysis.
frontend_pass_by_phases(!HLDS,
- FoundModeOrDetError, !DumpInfo, !IO),
+ FoundModeOrDetError, !DumpInfo, !Specs, !IO),
!:FoundError = !.FoundError `or` FoundModeOrDetError
)
)
@@ -2288,10 +2366,11 @@
).
:- pred maybe_write_optfile(bool::in, module_info::in, module_info::out,
- dump_info::in, dump_info::out, io::di, io::uo) is det.
+ dump_info::in, dump_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-maybe_write_optfile(MakeOptInt, !HLDS, !DumpInfo, !IO) :-
- globals.io_get_globals(Globals, !IO),
+maybe_write_optfile(MakeOptInt, !HLDS, !DumpInfo, !Specs, !IO) :-
+ module_info_get_globals(!.HLDS, Globals),
globals.lookup_bool_option(Globals, intermodule_optimization, IntermodOpt),
globals.lookup_bool_option(Globals, intermodule_analysis,
IntermodAnalysis),
@@ -2338,7 +2417,8 @@
; ReuseAnalysis = yes
)
->
- frontend_pass_by_phases(!HLDS, FoundModeError, !DumpInfo, !IO),
+ frontend_pass_by_phases(!HLDS, FoundModeError, !DumpInfo,
+ !Specs, !IO),
(
FoundModeError = no,
(
@@ -2570,23 +2650,26 @@
AnalysisInfo, _AnalysisInfo, !IO).
:- pred frontend_pass_by_phases(module_info::in, module_info::out,
- bool::out, dump_info::in, dump_info::out, io::di, io::uo) is det.
+ bool::out, dump_info::in, dump_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-frontend_pass_by_phases(!HLDS, FoundError, !DumpInfo, !IO) :-
+frontend_pass_by_phases(!HLDS, FoundError, !DumpInfo, !Specs, !IO) :-
module_info_get_globals(!.HLDS, Globals),
globals.lookup_bool_option(Globals, verbose, Verbose),
globals.lookup_bool_option(Globals, statistics, Stats),
- maybe_polymorphism(Verbose, Stats, !HLDS, !IO),
+ maybe_polymorphism(Verbose, Stats, !HLDS, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 30, "polymorphism", !DumpInfo, !IO),
- maybe_unused_imports(Verbose, Stats, !.HLDS, UnusedImportSpecs, !IO),
+ maybe_unused_imports(Verbose, Stats, !HLDS, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 31, "unused_imports", !DumpInfo, !IO),
+ % XXX Convert the mode constraints pass to use error_specs.
maybe_mode_constraints(Verbose, Stats, !HLDS, !IO),
maybe_dump_hlds(!.HLDS, 33, "mode_constraints", !DumpInfo, !IO),
- modecheck(Verbose, Stats, !HLDS, FoundModeError, SafeToContinue, !IO),
+ modecheck(Verbose, Stats, !HLDS, FoundModeError, SafeToContinue,
+ !Specs, !IO),
maybe_dump_hlds(!.HLDS, 35, "modecheck", !DumpInfo, !IO),
(
@@ -2600,42 +2683,31 @@
detect_cse(Verbose, Stats, !HLDS, !IO),
maybe_dump_hlds(!.HLDS, 45, "cse", !DumpInfo, !IO),
- check_determinism(Verbose, Stats, !HLDS, DetismSpecs, !IO),
+ check_determinism(Verbose, Stats, !HLDS, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 50, "determinism", !DumpInfo, !IO),
- Specs1 = UnusedImportSpecs ++ DetismSpecs,
- write_error_specs(Specs1, Globals, 0, _NumWarnings1, 0, NumErrors1,
- !IO),
- module_info_incr_num_errors(NumErrors1, !HLDS),
-
- check_unique_modes(Verbose, Stats, !HLDS, FoundUniqError, !IO),
+ check_unique_modes(Verbose, Stats, !HLDS, FoundUniqError, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 55, "unique_modes", !DumpInfo, !IO),
- check_stratification(Verbose, Stats, !HLDS, FoundStratError, !IO),
+ check_stratification(Verbose, Stats, !HLDS, FoundStratError,
+ !Specs, !IO),
maybe_dump_hlds(!.HLDS, 60, "stratification", !DumpInfo, !IO),
- process_try_goals(Verbose, Stats, !HLDS, FoundTryError, !IO),
+ process_try_goals(Verbose, Stats, !HLDS, FoundTryError, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 62, "try", !DumpInfo, !IO),
- maybe_simplify(yes, frontend, Verbose, Stats, !HLDS, SimplifySpecs,
- !IO),
+ maybe_simplify(yes, frontend, Verbose, Stats, !HLDS, !Specs, !IO),
maybe_dump_hlds(!.HLDS, 65, "frontend_simplify", !DumpInfo, !IO),
- % Once the other passes have all been converted to return error_specs,
- % we can write them out all at once.
- write_error_specs(SimplifySpecs, Globals, 0, _NumWarnings2,
- 0, NumErrors2, !IO),
- module_info_incr_num_errors(NumErrors2, !HLDS),
-
% Work out whether we encountered any errors.
+ module_info_get_num_errors(!.HLDS, NumErrors),
io.get_exit_status(ExitStatus, !IO),
(
FoundModeError = no,
FoundUniqError = no,
FoundStratError = no,
FoundTryError = no,
- NumErrors1 = 0,
- NumErrors2 = 0,
+ NumErrors = 0,
% Strictly speaking, we shouldn't need to check the exit status.
% But the values returned for FoundModeError etc. aren't always
% correct.
@@ -2786,7 +2858,7 @@
% propagation and we cannot do that once the term-size profiling or deep
% profiling transformations have been applied.
maybe_simplify(no, pre_prof_transforms, Verbose, Stats, !HLDS,
- SimplifySpecs, !IO),
+ [], SimplifySpecs, !IO),
expect(unify(contains_errors(Globals, SimplifySpecs), no), this_file,
"middle_pass: simplify has errors"),
maybe_dump_hlds(!.HLDS, 215, "pre_prof_transforms_simplify", !DumpInfo,
@@ -2880,7 +2952,8 @@
maybe_followcode(Verbose, Stats, !HLDS, !IO),
maybe_dump_hlds(!.HLDS, 320, "followcode", !DumpInfo, !IO),
- maybe_simplify(no, ll_backend, Verbose, Stats, !HLDS, SimplifySpecs, !IO),
+ maybe_simplify(no, ll_backend, Verbose, Stats, !HLDS,
+ [], SimplifySpecs, !IO),
expect(unify(contains_errors(Globals, SimplifySpecs), no), this_file,
"backend_pass_by_phases: simplify has errors"),
maybe_dump_hlds(!.HLDS, 325, "ll_backend_simplify", !DumpInfo, !IO),
@@ -3128,46 +3201,60 @@
%-----------------------------------------------------------------------------%
:- pred puritycheck(bool::in, bool::in, module_info::in, module_info::out,
- bool::in, bool::out, io::di, io::uo) is det.
+ bool::in, bool::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
puritycheck(Verbose, Stats, !HLDS, FoundTypeError, FoundPostTypecheckError,
- !IO) :-
- puritycheck(FoundTypeError, FoundPostTypecheckError, !HLDS, [], Specs),
+ !Specs, !IO) :-
+ puritycheck_module(FoundTypeError, FoundPostTypecheckError, !HLDS,
+ [], PuritySpecs),
+ !:Specs = PuritySpecs ++ !.Specs,
module_info_get_globals(!.HLDS, Globals),
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, NumErrors, !IO),
- ( NumErrors > 0 ->
- module_info_incr_num_errors(NumErrors, !HLDS),
+ PurityErrors = contains_errors(Globals, PuritySpecs),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ (
+ PurityErrors = yes,
maybe_write_string(Verbose,
"% Program contains purity error(s).\n", !IO)
;
+ PurityErrors = no,
maybe_write_string(Verbose,
"% Program is purity-correct.\n", !IO)
),
maybe_report_stats(Stats, !IO).
:- pred modecheck(bool::in, bool::in, module_info::in, module_info::out,
- bool::out, modes_safe_to_continue::out, io::di, io::uo) is det.
+ bool::out, modes_safe_to_continue::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-modecheck(Verbose, Stats, !HLDS, FoundModeError, SafeToContinue, !IO) :-
- module_info_get_num_errors(!.HLDS, NumErrors0),
- maybe_benchmark_modes(
- (pred(H0::in, {H, U}::out, !.IO::di, !:IO::uo) is det :-
- modecheck_module(H0, H1, U, Specs),
- module_info_get_globals(H1, Globals),
- write_error_specs(Specs, Globals,
- 0, _SpecsNumWarnings, 0, SpecsNumErrors, !IO),
- module_info_incr_num_errors(SpecsNumErrors, H1, H)
+modecheck(Verbose, Stats, !HLDS, FoundModeError, SafeToContinue,
+ !Specs, !IO) :-
+ module_info_get_globals(!.HLDS, Globals),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ globals.io_lookup_bool_option(benchmark_modes, BenchmarkModes, !IO),
+ (
+ BenchmarkModes = yes,
+ globals.io_lookup_int_option(benchmark_modes_repeat, Repeats, !IO),
+ promise_equivalent_solutions [!:HLDS, SafeToContinue, ModeSpecs, Time] (
+ benchmark_det(modecheck_module,
+ !.HLDS, {!:HLDS, SafeToContinue, ModeSpecs}, Repeats, Time)
),
- "modecheck", !.HLDS, {!:HLDS, SafeToContinue}, !IO),
- module_info_get_num_errors(!.HLDS, NumErrors),
- ( NumErrors = NumErrors0 ->
+ io.format("BENCHMARK modecheck, %d repeats: %d ms\n",
+ [i(Repeats), i(Time)], !IO)
+ ;
+ BenchmarkModes = no,
+ modecheck_module(!.HLDS, {!:HLDS, SafeToContinue, ModeSpecs})
+ ),
+ !:Specs = ModeSpecs ++ !.Specs,
+ FoundModeError = contains_errors(Globals, ModeSpecs),
+ (
FoundModeError = no,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "% Program is mode-correct.\n", !IO)
;
FoundModeError = yes,
- maybe_write_string(Verbose, "% Program contains mode error(s).\n",
- !IO),
- io.set_exit_status(1, !IO)
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ maybe_write_string(Verbose, "% Program contains mode error(s).\n", !IO)
),
maybe_report_stats(Stats, !IO).
@@ -3239,13 +3326,15 @@
).
:- pred check_determinism(bool::in, bool::in,
- module_info::in, module_info::out, list(error_spec)::out,
- io::di, io::uo) is det.
+ module_info::in, module_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-check_determinism(Verbose, Stats, !HLDS, Specs, !IO) :-
- determinism_pass(!HLDS, Specs),
+check_determinism(Verbose, Stats, !HLDS, !Specs, !IO) :-
+ determinism_pass(!HLDS, DetismSpecs),
+ !:Specs = DetismSpecs ++ !.Specs,
module_info_get_globals(!.HLDS, Globals),
- FoundError = contains_errors(Globals, Specs),
+ FoundError = contains_errors(Globals, DetismSpecs),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
(
FoundError = yes,
maybe_write_string(Verbose,
@@ -3260,8 +3349,7 @@
module_info::in, module_info::out, io::di, io::uo) is det.
maybe_analyse_mm_tabling(Verbose, Stats, !HLDS, !IO) :-
- globals.io_lookup_bool_option(analyse_mm_tabling, TablingAnalysis,
- !IO),
+ globals.io_lookup_bool_option(analyse_mm_tabling, TablingAnalysis, !IO),
(
TablingAnalysis = yes,
maybe_write_string(Verbose, "% Analysing minimal model tabling...\n",
@@ -3384,23 +3472,22 @@
).
:- pred check_unique_modes(bool::in, bool::in,
- module_info::in, module_info::out, bool::out, io::di, io::uo) is det.
+ module_info::in, module_info::out, bool::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-check_unique_modes(Verbose, Stats, !HLDS, FoundError, !IO) :-
+check_unique_modes(Verbose, Stats, !HLDS, FoundError, !Specs, !IO) :-
+ module_info_get_globals(!.HLDS, Globals),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose,
"% Checking for backtracking over unique modes...\n", !IO),
- module_info_get_num_errors(!.HLDS, NumErrors0),
- unique_modes_check_module(!HLDS, Specs),
- module_info_get_globals(!.HLDS, Globals),
- write_error_specs(Specs, Globals, 0, _SpecsNumWarnings, 0, SpecsNumErrors,
- !IO),
- module_info_incr_num_errors(SpecsNumErrors, !HLDS),
- module_info_get_num_errors(!.HLDS, NumErrors),
- ( NumErrors \= NumErrors0 ->
+ unique_modes_check_module(!HLDS, UniqueSpecs),
+ !:Specs = UniqueSpecs ++ !.Specs,
+ FoundError = contains_errors(Globals, UniqueSpecs),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ (
FoundError = yes,
maybe_write_string(Verbose,
- "% Program contains unique mode error(s).\n", !IO),
- io.set_exit_status(1, !IO)
+ "% Program contains unique mode error(s).\n", !IO)
;
FoundError = no,
maybe_write_string(Verbose, "% Program is unique-mode-correct.\n", !IO)
@@ -3408,9 +3495,10 @@
maybe_report_stats(Stats, !IO).
:- pred check_stratification(bool::in, bool::in,
- module_info::in, module_info::out, bool::out, io::di, io::uo) is det.
+ module_info::in, module_info::out, bool::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-check_stratification(Verbose, Stats, !HLDS, FoundError, !IO) :-
+check_stratification(Verbose, Stats, !HLDS, FoundError, !Specs, !IO) :-
module_info_get_stratified_preds(!.HLDS, StratifiedPreds),
globals.io_lookup_bool_option(warn_non_stratification, Warn, !IO),
(
@@ -3418,22 +3506,21 @@
; Warn = yes
)
->
+ module_info_get_globals(!.HLDS, Globals),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose,
"% Checking stratification...\n", !IO),
- io.get_exit_status(OldStatus, !IO),
- io.set_exit_status(0, !IO),
- stratify.check_stratification(!HLDS, [], Specs),
- module_info_get_globals(!.HLDS, Globals),
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, NumErrors, !IO),
- module_info_incr_num_errors(NumErrors, !HLDS),
- ( NumErrors > 0 ->
+ check_stratification(!HLDS, [], StratifySpecs),
+ !:Specs = StratifySpecs ++ !.Specs,
+ FoundError = contains_errors(Globals, StratifySpecs),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ (
FoundError = yes,
maybe_write_string(Verbose,
"% Program contains stratification error(s).\n", !IO)
;
FoundError = no,
- maybe_write_string(Verbose, "% done.\n", !IO),
- io.set_exit_status(OldStatus, !IO)
+ maybe_write_string(Verbose, "% done.\n", !IO)
),
maybe_report_stats(Stats, !IO)
;
@@ -3441,21 +3528,23 @@
).
:- pred process_try_goals(bool::in, bool::in,
- module_info::in, module_info::out, bool::out, io::di, io::uo) is det.
+ module_info::in, module_info::out, bool::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-process_try_goals(Verbose, Stats, !HLDS, FoundError, !IO) :-
- maybe_write_string(Verbose, "% Transforming try goals...\n", !IO),
- expand_try_goals_in_module(!HLDS, [], Specs),
+process_try_goals(Verbose, Stats, !HLDS, FoundError, !Specs, !IO) :-
module_info_get_globals(!.HLDS, Globals),
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, NumErrors, !IO),
- module_info_incr_num_errors(NumErrors, !HLDS),
- maybe_write_string(Verbose, "% done.\n", !IO),
- ( NumErrors > 0 ->
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ maybe_write_string(Verbose, "% Transforming try goals...\n", !IO),
+ expand_try_goals_in_module(!HLDS, [], TryExpandSpecs),
+ !:Specs = TryExpandSpecs ++ !.Specs,
+ FoundError = contains_errors(Globals, TryExpandSpecs),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
+ (
FoundError = yes,
- maybe_write_string(Verbose, "% Program contains error(s).\n", !IO),
- io.set_exit_status(1, !IO)
+ maybe_write_string(Verbose, "% Program contains error(s).\n", !IO)
;
- FoundError = no
+ FoundError = no,
+ maybe_write_string(Verbose, "% done.\n", !IO)
),
maybe_report_stats(Stats, !IO).
@@ -3521,10 +3610,11 @@
% This predicate set up and maybe run the simplification pass.
%
:- pred maybe_simplify(bool::in, simplify_pass::in, bool::in, bool::in,
- module_info::in, module_info::out, list(error_spec)::out,
+ module_info::in, module_info::out,
+ list(error_spec)::in, list(error_spec)::out,
io::di, io::uo) is det.
-maybe_simplify(Warn, SimplifyPass, Verbose, Stats, !HLDS, Specs, !IO) :-
+maybe_simplify(Warn, SimplifyPass, Verbose, Stats, !HLDS, !Specs, !IO) :-
module_info_get_globals(!.HLDS, Globals),
some [!SimpList] (
simplify.find_simplifications(Warn, Globals, Simplifications0),
@@ -3537,11 +3627,11 @@
list.cons(simp_do_once, !SimpList)
;
SimplifyPass = pre_prof_transforms,
- %
+
% We run the simplify pass before the profiling transformations,
% only if those transformations are being applied - otherwise we
% just leave things to the backend simplification passes.
- %
+
globals.lookup_bool_option(Globals, pre_prof_transforms_simplify,
Simplify215),
(
@@ -3587,17 +3677,28 @@
(
SimpList = [_ | _],
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "% Simplifying goals...\n", !IO),
maybe_flush_output(Verbose, !IO),
Simplifications = list_to_simplifications(SimpList),
process_all_nonimported_procs_errors(
update_pred_error(simplify_pred(Simplifications)),
- !HLDS, [], Specs, !IO),
+ !HLDS, [], SimplifySpecs, !IO),
+ (
+ SimplifyPass = frontend,
+ !:Specs = SimplifySpecs ++ !.Specs,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO)
+ ;
+ ( SimplifyPass = ll_backend
+ ; SimplifyPass = ml_backend
+ ; SimplifyPass = post_untuple
+ ; SimplifyPass = pre_prof_transforms
+ )
+ ),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO)
;
- SimpList = [],
- Specs = []
+ SimpList = []
).
%-----------------------------------------------------------------------------%
@@ -3833,10 +3934,13 @@
%-----------------------------------------------------------------------------%
-:- pred subst_implementation_defined_literals(bool::in, bool::in, module_info::in,
- module_info::out, io::di, io::uo) is det.
+:- pred subst_implementation_defined_literals(bool::in, bool::in,
+ module_info::in, module_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-subst_implementation_defined_literals(Verbose, Stats, !HLDS, !IO) :-
+subst_implementation_defined_literals(Verbose, Stats, !HLDS, !Specs, !IO) :-
+ module_info_get_globals(!.HLDS, Globals),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose,
"% Substituting implementation-defined literals...\n", !IO),
maybe_flush_output(Verbose, !IO),
@@ -3845,10 +3949,12 @@
maybe_report_stats(Stats, !IO).
:- pred maybe_polymorphism(bool::in, bool::in,
- module_info::in, module_info::out, io::di, io::uo) is det.
+ module_info::in, module_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-maybe_polymorphism(Verbose, Stats, !HLDS, !IO) :-
+maybe_polymorphism(Verbose, Stats, !HLDS, !Specs, !IO) :-
module_info_get_globals(!.HLDS, Globals),
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
globals.lookup_bool_option(Globals, polymorphism, Polymorphism),
(
Polymorphism = yes,
@@ -3883,24 +3989,26 @@
).
:- pred maybe_unused_imports(bool::in, bool::in,
- module_info::in, list(error_spec)::out, io::di, io::uo) is det.
+ module_info::in, module_info::out,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-maybe_unused_imports(Verbose, Stats, HLDS, Specs, !IO) :-
- module_info_get_globals(HLDS, Globals),
+maybe_unused_imports(Verbose, Stats, !HLDS, !Specs, !IO) :-
+ module_info_get_globals(!.HLDS, Globals),
globals.lookup_bool_option(Globals, warn_unused_imports,
WarnUnusedImports),
(
WarnUnusedImports = yes,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, "% Checking for unused imports...", !IO),
- unused_imports(HLDS, Specs, !IO),
+ unused_imports(!.HLDS, UnusedImportSpecs, !IO),
+ !:Specs = UnusedImportSpecs ++ !.Specs,
+ maybe_write_out_errors(Verbose, Globals, !HLDS, !Specs, !IO),
maybe_write_string(Verbose, " done.\n", !IO),
maybe_report_stats(Stats, !IO)
;
- WarnUnusedImports = no,
- Specs = []
+ WarnUnusedImports = no
).
-
:- pred maybe_type_ctor_infos(bool::in, bool::in,
module_info::in, module_info::out, io::di, io::uo) is det.
@@ -3967,8 +4075,8 @@
maybe_flush_output(Verbose, !IO),
untuple_arguments(!HLDS, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
- maybe_simplify(no, post_untuple, Verbose, Stats, !HLDS, SimplifySpecs,
- !IO),
+ maybe_simplify(no, post_untuple, Verbose, Stats, !HLDS,
+ [], SimplifySpecs, !IO),
expect(unify(contains_errors(Globals, SimplifySpecs), no), this_file,
"maybe_untuple_arguments: simplify has errors"),
maybe_report_stats(Stats, !IO)
@@ -5038,7 +5146,8 @@
globals.lookup_bool_option(Globals, verbose, Verbose),
globals.lookup_bool_option(Globals, statistics, Stats),
- maybe_simplify(no, ml_backend, Verbose, Stats, !HLDS, SimplifySpecs, !IO),
+ maybe_simplify(no, ml_backend, Verbose, Stats, !HLDS, [], SimplifySpecs,
+ !IO),
expect(unify(contains_errors(Globals, SimplifySpecs), no), this_file,
"ml_backend: simplify has errors"),
maybe_dump_hlds(!.HLDS, 405, "ml_backend_simplify", !DumpInfo, !IO),
@@ -5570,12 +5679,13 @@
% Read each of the command line arguments from the given input file.
% Note lines which consist purely of whitespace are ignored.
%
-:- pred expand_file_into_arg_list(io.input_stream::in, io.res(list(string))::out,
- io::di, io::uo) is det.
+:- pred expand_file_into_arg_list(io.input_stream::in,
+ io.res(list(string))::out, io::di, io::uo) is det.
expand_file_into_arg_list(S, Res, !IO) :-
io.read_line_as_string(S, LineRes, !IO),
- ( LineRes = ok(Line),
+ (
+ LineRes = ok(Line),
expand_file_into_arg_list(S, Res0, !IO),
( Res0 = ok(Lines),
StrippedLine = strip(Line),
@@ -5587,9 +5697,11 @@
; Res0 = error(_E),
Res = Res0
)
- ; LineRes = eof,
+ ;
+ LineRes = eof,
Res = ok([])
- ; LineRes = error(E),
+ ;
+ LineRes = error(E),
Res = error(E)
).
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.379
diff -u -b -r1.379 modes.m
--- compiler/modes.m 21 Jul 2009 02:08:49 -0000 1.379
+++ compiler/modes.m 21 Jul 2009 10:26:34 -0000
@@ -160,8 +160,8 @@
% was halted prematurely due to an error, and that we should therefore
% not perform determinism-checking, because we might get internal errors.
%
-:- pred modecheck_module(module_info::in, module_info::out,
- modes_safe_to_continue::out, list(error_spec)::out) is det.
+:- pred modecheck_module(module_info::in,
+ {module_info, modes_safe_to_continue, list(error_spec)}::out) is det.
% Mode-check or unique-mode-check the code of all the predicates
% in a module.
@@ -418,14 +418,14 @@
%-----------------------------------------------------------------------------%
-modecheck_module(!ModuleInfo, SafeToContinue, Specs) :-
- module_info_get_globals(!.ModuleInfo, Globals),
+modecheck_module(ModuleInfo0, {ModuleInfo, SafeToContinue, Specs}) :-
+ module_info_get_globals(ModuleInfo0, Globals),
trace [io(!IO)] (
globals.lookup_bool_option(Globals, verbose, Verbose),
maybe_write_string(Verbose, "% Mode-checking clauses...\n", !IO)
),
- check_pred_modes(check_modes, may_change_called_proc, !ModuleInfo,
- SafeToContinue, Specs),
+ check_pred_modes(check_modes, may_change_called_proc,
+ ModuleInfo0, ModuleInfo, SafeToContinue, Specs),
trace [io(!IO)] (
globals.lookup_bool_option(Globals, statistics, Statistics),
maybe_report_stats(Statistics, !IO)
Index: compiler/module_imports.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_imports.m,v
retrieving revision 1.5
diff -u -b -r1.5 module_imports.m
--- compiler/module_imports.m 10 Mar 2009 05:00:28 -0000 1.5
+++ compiler/module_imports.m 22 Jul 2009 13:41:46 -0000
@@ -20,6 +20,7 @@
:- import_module libs.globals.
:- import_module libs.timestamp.
:- import_module mdbcomp.prim_data.
+:- import_module parse_tree.error_util.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.prog_item.
:- import_module parse_tree.prog_io. % for module_error;
@@ -44,7 +45,7 @@
need_qualifier :: need_qualifier
).
- % The `module_imports' structure holds information about
+ % The `module_and_imports' structure holds information about
% a module and the modules that it imports.
%
% Note that we build this structure up as we go along.
@@ -61,115 +62,128 @@
% modules and imported modules to their respective lists as we process
% the interface files for those imported or ancestor modules.
%
-:- type module_imports
- ---> module_imports(
+:- type module_and_imports
+ ---> module_and_imports(
% The source file.
- source_file_name :: file_name,
+ mai_source_file_name :: file_name,
% The name of the top-level module in the source file
% containing the module that we are compiling.
- source_file_module_name :: module_name,
+ mai_source_file_module_name :: module_name,
% The module (or sub-module) that we are compiling.
- module_name :: module_name,
+ mai_module_name :: module_name,
% The list of ancestor modules it inherits.
- parent_deps :: list(module_name),
+ mai_parent_deps :: list(module_name),
% The list of modules it directly imports in the interface
% (imports via ancestors count as direct).
- int_deps :: list(module_name),
+ mai_int_deps :: list(module_name),
% The list of modules it directly imports in the
% implementation.
- impl_deps :: list(module_name),
+ mai_impl_deps :: list(module_name),
% The list of modules it indirectly imports.
- indirect_deps :: list(module_name),
+ mai_indirect_deps :: list(module_name),
- children :: list(module_name),
+ mai_children :: list(module_name),
% The list of its public children, i.e. child modules that
% it includes in the interface section.
- public_children :: list(module_name),
+ mai_public_children :: list(module_name),
% The modules included in the same source file. This field
% is only set for the top-level module in each file.
- nested_children :: list(module_name),
+ mai_nested_children :: list(module_name),
% The list of filenames for fact tables in this module.
- fact_table_deps :: list(string),
+ mai_fact_table_deps :: list(string),
% Whether or not the module contains foreign code, and if yes,
% which languages they use.
- has_foreign_code :: contains_foreign_code,
+ mai_has_foreign_code :: contains_foreign_code,
% The `:- pragma foreign_import_module' declarations.
- foreign_import_modules :: foreign_import_module_info_list,
+ mai_foreign_import_modules :: foreign_import_module_info_list,
% Does the module contain any `:- pragma foreign_export'
% declarations?
- contains_foreign_export :: contains_foreign_export,
+ mai_contains_foreign_export :: contains_foreign_export,
% The contents of the module and its imports.
- items :: cord(item),
+ mai_items_cord :: cord(item),
% Whether an error has been encountered when reading in
% this module.
- error :: module_error,
+ mai_specs :: list(error_spec),
+ mai_error :: module_error,
% If we are doing smart recompilation, we need to keep
% the timestamps of the modules read in.
- maybe_timestamps :: maybe(module_timestamps),
+ mai_maybe_timestamps :: maybe(module_timestamps),
% Does this module contain main/2?
- has_main :: has_main,
+ mai_has_main :: has_main,
% The directory containing the module source.
- module_dir :: dir_name
+ mai_module_dir :: dir_name
).
-:- pred module_imports_get_source_file_name(module_imports::in, file_name::out)
- is det.
-:- pred module_imports_get_module_name(module_imports::in, module_name::out)
- is det.
-:- pred module_imports_get_impl_deps(module_imports::in,
+:- pred module_and_imports_get_source_file_name(module_and_imports::in,
+ file_name::out) is det.
+:- pred module_and_imports_get_module_name(module_and_imports::in,
+ module_name::out) is det.
+:- pred module_and_imports_get_impl_deps(module_and_imports::in,
list(module_name)::out) is det.
-:- pred module_imports_get_items(module_imports::in, cord(item)::out) is det.
-:- pred module_imports_get_items_list(module_imports::in, list(item)::out)
- is det.
-:- pred module_imports_get_error(module_imports::in, module_error::out) is det.
-
-:- pred module_imports_set_items(cord(item)::in,
- module_imports::in, module_imports::out) is det.
-:- pred module_imports_set_items_list(list(item)::in,
- module_imports::in, module_imports::out) is det.
-:- pred module_imports_set_error(module_error::in,
- module_imports::in, module_imports::out) is det.
% Set the interface dependencies.
%
-:- pred module_imports_set_int_deps(list(module_name)::in,
- module_imports::in, module_imports::out) is det.
+:- pred module_and_imports_set_int_deps(list(module_name)::in,
+ module_and_imports::in, module_and_imports::out) is det.
% Set the implementation dependencies.
%
-:- pred module_imports_set_impl_deps(list(module_name)::in,
- module_imports::in, module_imports::out) is det.
+:- pred module_and_imports_set_impl_deps(list(module_name)::in,
+ module_and_imports::in, module_and_imports::out) is det.
% Set the indirect dependencies.
%
-:- pred module_imports_set_indirect_deps(list(module_name)::in,
- module_imports::in, module_imports::out) is det.
+:- pred module_and_imports_set_indirect_deps(list(module_name)::in,
+ module_and_imports::in, module_and_imports::out) is det.
+
+:- pred module_and_imports_set_error(module_error::in,
+ module_and_imports::in, module_and_imports::out) is det.
+
+:- pred module_and_imports_add_specs(list(error_spec)::in,
+ module_and_imports::in, module_and_imports::out) is det.
+
+:- pred module_and_imports_add_interface_error(module_error::in,
+ module_and_imports::in, module_and_imports::out) is det.
+
+ % Add items to the end of the list.
+ %
+:- pred module_and_imports_add_items(cord(item)::in,
+ module_and_imports::in, module_and_imports::out) is det.
+
+ % Return the results recorded in the module_and_imports structure.
+ %
+ % There is no predicate to return *just* the items, since that would
+ % allow callers to forget to retrieve and then print the error
+ % specifications.
+ %
+:- pred module_and_imports_get_results(module_and_imports::in,
+ list(item)::out, list(error_spec)::out, module_error::out) is det.
%-----------------------------------------------------------------------------%
% init_dependencies(FileName, SourceFileModuleName, NestedModuleNames,
- % Error, Globals, ModuleName - Items, ModuleImports).
+ % Specs, Error, Globals, ModuleName - Items, ModuleImports).
%
:- pred init_dependencies(file_name::in, module_name::in,
- list(module_name)::in, module_error::in, globals::in,
- pair(module_name, list(item))::in, module_imports::out) is det.
+ list(module_name)::in, list(error_spec)::in, module_error::in, globals::in,
+ pair(module_name, list(item))::in, module_and_imports::out) is det.
%-----------------------------------------------------------------------------%
@@ -249,26 +263,49 @@
%-----------------------------------------------------------------------------%
-module_imports_get_source_file_name(Module, Module ^ source_file_name).
-module_imports_get_module_name(Module, Module ^ module_name).
-module_imports_get_impl_deps(Module, Module ^ impl_deps).
-module_imports_get_items(Module, Module ^ items).
-module_imports_get_items_list(Module, cord.list(Module ^ items)).
-module_imports_get_error(Module, Module ^ error).
-module_imports_set_items(Items, Module, Module ^ items := Items).
-module_imports_set_items_list(Items, Module, Module ^ items := Cord) :-
- Cord = cord.from_list(Items).
-module_imports_set_error(Error, Module, Module ^ error := Error).
-module_imports_set_int_deps(IntDeps, Module, Module ^ int_deps := IntDeps).
-module_imports_set_impl_deps(ImplDeps, Module,
- Module ^ impl_deps := ImplDeps).
-module_imports_set_indirect_deps(IndirectDeps, Module,
- Module ^ indirect_deps := IndirectDeps).
+module_and_imports_get_source_file_name(Module, Module ^ mai_source_file_name).
+module_and_imports_get_module_name(Module, Module ^ mai_module_name).
+module_and_imports_get_impl_deps(Module, Module ^ mai_impl_deps).
+
+module_and_imports_set_int_deps(IntDeps, !Module) :-
+ !Module ^ mai_int_deps := IntDeps.
+module_and_imports_set_impl_deps(ImplDeps, !Module) :-
+ !Module ^ mai_impl_deps := ImplDeps.
+module_and_imports_set_indirect_deps(IndirectDeps, !Module) :-
+ !Module ^ mai_indirect_deps := IndirectDeps.
+module_and_imports_set_error(Error, !Module) :-
+ !Module ^ mai_error := Error.
+
+module_and_imports_add_specs(NewSpecs, !Module) :-
+ Specs0 = !.Module ^ mai_specs,
+ Specs = NewSpecs ++ Specs0,
+ !Module ^ mai_specs := Specs.
+
+module_and_imports_add_items(NewItems, !Module) :-
+ Items0 = !.Module ^ mai_items_cord,
+ Items = Items0 ++ NewItems,
+ !Module ^ mai_items_cord := Items.
+
+module_and_imports_add_interface_error(InterfaceError, !Module) :-
+ (
+ InterfaceError = no_module_errors
+ ;
+ ( InterfaceError = some_module_errors
+ ; InterfaceError = fatal_module_errors
+ ),
+ % XXX What if Error0 = fatal_module_errors?
+ !Module ^ mai_error := some_module_errors
+ ).
+
+module_and_imports_get_results(Module, Items, Specs, Error) :-
+ Items = cord.list(Module ^ mai_items_cord),
+ Specs = Module ^ mai_specs,
+ Error = Module ^ mai_error.
%-----------------------------------------------------------------------------%
init_dependencies(FileName, SourceFileModuleName, NestedModuleNames,
- Error, Globals, ModuleName - Items, ModuleImports) :-
+ Specs, Error, Globals, ModuleName - Items, ModuleImports) :-
ParentDeps = get_ancestors(ModuleName),
get_dependencies(Items, ImplImportDeps0, ImplUseDeps0),
@@ -341,12 +378,12 @@
HasMain = no_main
),
- ModuleImports = module_imports(FileName, SourceFileModuleName,
+ ModuleImports = module_and_imports(FileName, SourceFileModuleName,
ModuleName, ParentDeps, InterfaceDeps,
ImplementationDeps, IndirectDeps, IncludeDeps,
InterfaceIncludeDeps, NestedDeps, FactTableDeps,
ContainsForeignCode, ForeignImports, ContainsPragmaExport,
- cord.empty, Error, no, HasMain, dir.this_directory).
+ cord.empty, Specs, Error, no, HasMain, dir.this_directory).
%-----------------------------------------------------------------------------%
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.453
diff -u -b -r1.453 modules.m
--- compiler/modules.m 16 Jan 2009 02:31:26 -0000 1.453
+++ compiler/modules.m 24 Jul 2009 05:57:01 -0000
@@ -49,7 +49,6 @@
:- import_module parse_tree.module_imports.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.prog_item.
-:- import_module parse_tree.prog_io.
:- import_module parse_tree.read_modules.
:- import_module assoc_list.
@@ -61,7 +60,7 @@
%-----------------------------------------------------------------------------%
- % make_private_interface(SourceFileName, SourceFileModuleName,
+ % make_private_interface(Globals, SourceFileName, SourceFileModuleName,
% ModuleName, MaybeTimestamp, Items):
%
% Given a source file name and module name, the timestamp of the source
@@ -70,23 +69,25 @@
% declarations in the module, including those in the `implementation'
% section; it is used when compiling sub-modules.)
%
-:- pred make_private_interface(file_name::in, module_name::in, module_name::in,
- maybe(timestamp)::in, list(item)::in, io::di, io::uo) is det.
+:- pred make_private_interface(globals::in, file_name::in,
+ module_name::in, module_name::in, maybe(timestamp)::in, list(item)::in,
+ io::di, io::uo) is det.
- % make_interface(SourceFileName, SourceFileModuleName,
+ % make_interface(Globals, SourceFileName, SourceFileModuleName,
% ModuleName, MaybeTimestamp, Items):
%
% Given a source file name and module name, the timestamp of the source
% file, and the list of items in that module, output the long (`.int')
% and short (`.int2') interface files for the module.
%
-:- pred make_interface(file_name::in, module_name::in, module_name::in,
- maybe(timestamp)::in, list(item)::in, io::di, io::uo) is det.
+:- pred make_interface(globals::in, file_name::in,
+ module_name::in, module_name::in, maybe(timestamp)::in, list(item)::in,
+ io::di, io::uo) is det.
% Output the unqualified short interface file to <module>.int3.
%
-:- pred make_short_interface(file_name::in, module_name::in, list(item)::in,
- io::di, io::uo) is det.
+:- pred make_short_interface(globals::in, file_name::in, module_name::in,
+ list(item)::in, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
@@ -101,8 +102,8 @@
% Append the specified module declaration to the list of items in Module0
% to give Module.
%
-:- pred append_pseudo_decl(module_defn::in, module_imports::in,
- module_imports::out) is det.
+:- pred append_pseudo_decl(module_defn::in,
+ module_and_imports::in, module_and_imports::out) is det.
% replace_section_decls(IntStatusItem, ImpStatusItem, !Items):
%
@@ -135,9 +136,9 @@
%-----------------------------------------------------------------------------%
- % grab_imported_modules(SourceFileName, SourceFileModuleName,
- % ModuleName, NestedSubModules, ReadModules, ModuleTimestamp, Items,
- % Module, Error):
+ % grab_imported_modules(Globals, SourceFileName, SourceFileModuleName,
+ % ModuleName, NestedSubModules, HaveReadModuleMap, ModuleTimestamp,
+ % Items, Module, !IO):
%
% Given a source file name and the top-level module name in that file,
% the current module name, the nested sub-modules in the file if this
@@ -145,44 +146,45 @@
% and the list of items in the current module, read in the private
% interface files for all the parent modules, the long interface files
% for all the imported modules, and the short interface files for all
- % the indirectly imported modules, and return a `module_imports' structure
- % containing the relevant information. ReadModules contains the interface
- % files read during recompilation checking.
- %
-:- pred grab_imported_modules(file_name::in, module_name::in, module_name::in,
- list(module_name)::in, read_modules::in, maybe(timestamp)::in,
- list(item)::in, module_imports::out, module_error::out,
- io::di, io::uo) is det.
+ % the indirectly imported modules, and return a `module_and_imports'
+ % structure containing the relevant information. HaveReadModuleMap contains
+ % the interface files read during recompilation checking.
+ %
+:- pred grab_imported_modules(globals::in, file_name::in,
+ module_name::in, module_name::in, list(module_name)::in,
+ have_read_module_map::in, maybe(timestamp)::in, list(item)::in,
+ module_and_imports::out, io::di, io::uo) is det.
- % grab_unqual_imported_modules(SourceFileName, SourceFileModuleName,
- % ModuleName, Items, Module, Error):
+ % grab_unqual_imported_modules(Globals, SourceFileName,
+ % SourceFileModuleName, ModuleName, Items, Module, !IO):
%
% Similar to grab_imported_modules, but only reads in the unqualified
% short interfaces (.int3s), and the .int0 files for parent modules,
% instead of reading the long interfaces and qualified short interfaces
% (.int and int2s). Does not set the `PublicChildren' or `FactDeps'
- % fields of the module_imports structure.
+ % fields of the module_and_imports structure.
%
-:- pred grab_unqual_imported_modules(file_name::in, module_name::in,
- module_name::in, list(item)::in, module_imports::out, module_error::out,
+:- pred grab_unqual_imported_modules(globals::in, file_name::in,
+ module_name::in, module_name::in, list(item)::in, module_and_imports::out,
io::di, io::uo) is det.
- % process_module_private_interfaces(Ancestors,
- % IntStatusItem, ImpStatusItem, !DirectImports, !DirectUses, !Module):
+ % process_module_private_interfaces(Globals, Ancestors,
+ % IntStatusItem, ImpStatusItem, !DirectImports, !DirectUses,
+ % !Module, !IO):
%
% Read the complete private interfaces for modules in Ancestors, and
% append any imports/uses in the ancestors to the corresponding previous
% lists.
%
-:- pred process_module_private_interfaces(read_modules::in,
- list(module_name)::in, item::in, item::in,
+:- pred process_module_private_interfaces(globals::in,
+ have_read_module_map::in, list(module_name)::in, item::in, item::in,
list(module_name)::in, list(module_name)::out,
list(module_name)::in, list(module_name)::out,
- module_imports::in, module_imports::out, io::di, io::uo) is det.
+ module_and_imports::in, module_and_imports::out, io::di, io::uo) is det.
- % process_module_long_interfaces(ReadModules, NeedQualifier, Imports,
- % Ext, IntStatusItem, ImpStatusItem, !IndirectImports,
- % !ImplIndirectImports, !Module):
+ % process_module_long_interfaces(Globals, HaveReadModuleMap, NeedQualifier,
+ % Imports, Ext, IntStatusItem, ImpStatusItem,
+ % !IndirectImports, !ImplIndirectImports, !Module, !IO):
%
% Read the long interfaces for modules in Imports (unless they've already
% been read in) from files with filename extension Ext, and append any
@@ -193,13 +195,13 @@
% Replace the `:- implementation' declarations with ImpStatusItem, which
% should set the import_status of the following items.
%
-:- pred process_module_long_interfaces(read_modules::in, need_qualifier::in,
- list(module_name)::in, string::in, item::in, item::in,
+:- pred process_module_long_interfaces(globals::in, have_read_module_map::in,
+ need_qualifier::in, list(module_name)::in, string::in, item::in, item::in,
list(module_name)::in, list(module_name)::out,
list(module_name)::in, list(module_name)::out,
- module_imports::in, module_imports::out, io::di, io::uo) is det.
+ module_and_imports::in, module_and_imports::out, io::di, io::uo) is det.
- % process_module_short_interfaces_transitively(ReadModules,
+ % process_module_short_interfaces_transitively(Globals, HaveReadModuleMap,
% IndirectImports, Ext, IntStatusItem, ImpStatusItem,
% !ImpIndirectImports, !Module):
%
@@ -212,13 +214,14 @@
% `:- implementation' declarations with ImpStatusItem, which should set
% the import_status of the following items.
%
-:- pred process_module_short_interfaces_transitively(read_modules::in,
- list(module_name)::in, string::in, item::in, item::in,
- list(module_name)::in, list(module_name)::out,
- module_imports::in, module_imports::out, io::di, io::uo) is det.
-
- % process_module_short_interfaces_and_impls_transitively(ReadModules,
- % IndirectImports, Ext, IntStatusItem, ImpStatusItem, !Module):
+:- pred process_module_short_interfaces_transitively(globals::in,
+ have_read_module_map::in, list(module_name)::in, string::in,
+ item::in, item::in, list(module_name)::in, list(module_name)::out,
+ module_and_imports::in, module_and_imports::out, io::di, io::uo) is det.
+
+ % process_module_short_interfaces_and_impls_transitively(Globals,
+ % HaveReadModuleMap, IndirectImports, Ext, IntStatusItem, ImpStatusItem,
+ % !Module):
%
% Read the short interfaces for modules in IndirectImports (unless they've
% already been read in) and any modules that those modules import
@@ -229,11 +232,12 @@
% Replace the `:- implementation' declarations with ImpStatusItem,
% which should set the import_status of the following items.
%
-:- pred process_module_short_interfaces_and_impls_transitively(
- read_modules::in, list(module_name)::in, string::in, item::in, item::in,
- module_imports::in, module_imports::out, io::di, io::uo) is det.
+:- pred process_module_short_interfaces_and_impls_transitively(globals::in,
+ have_read_module_map::in, list(module_name)::in, string::in,
+ item::in, item::in, module_and_imports::in, module_and_imports::out,
+ io::di, io::uo) is det.
- % process_module_short_interfaces(ReadModules,
+ % process_module_short_interfaces(Globals, HaveReadModuleMap,
% IntStatusItem, ImpStatusItem, Modules, Ext,
% !IndirectImports, !ImpIndirectImports, !Module):
%
@@ -247,11 +251,11 @@
% `:- implementation' declarations with ImpStatusItem, which should set
% the import_status of the following items.
%
-:- pred process_module_short_interfaces(read_modules::in,
+:- pred process_module_short_interfaces(globals::in, have_read_module_map::in,
list(module_name)::in, string::in, item::in, item::in,
list(module_name)::in, list(module_name)::out,
list(module_name)::in, list(module_name)::out,
- module_imports::in, module_imports::out, io::di, io::uo) is det.
+ module_and_imports::in, module_and_imports::out, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
@@ -266,7 +270,7 @@
%-----------------------------------------------------------------------------%
- % generate_module_dependencies(ModuleName):
+ % generate_module_dependencies(Globals, ModuleName, !IO):
%
% Generate the per-program makefile dependencies (`.dep') file for a
% program whose top-level module is `ModuleName'. This involves first
@@ -274,28 +278,32 @@
% at it, we also save the per-module makefile dependency (`.d') files
% for all those modules.
%
-:- pred generate_module_dependencies(module_name::in, io::di, io::uo) is det.
+:- pred generate_module_dependencies(globals::in, module_name::in,
+ io::di, io::uo) is det.
- % generate_file_dependencies(FileName):
+ % generate_file_dependencies(Globals, FileName, !IO):
%
% Same as generate_module_dependencies, but takes a file name instead of
% a module name.
%
-:- pred generate_file_dependencies(file_name::in, io::di, io::uo) is det.
+:- pred generate_file_dependencies(globals::in, file_name::in,
+ io::di, io::uo) is det.
- % generate_module_dependency_file(ModuleName):
+ % generate_module_dependency_file(Globals, ModuleName, !IO):
%
% Generate the per module makefile dependency ('.d') file for the
% given module.
%
-:- pred generate_module_dependency_file(module_name::in, io::di, io::uo) is det.
+:- pred generate_module_dependency_file(globals::in, module_name::in,
+ io::di, io::uo) is det.
- % generate_file_dependency_file(FileName):
+ % generate_file_dependency_file(Globals, FileName, !IO):
%
% Same as generate_module_dependency_file, but takes a file name instead of
% a module name.
%
-:- pred generate_file_dependency_file(file_name::in, io::di, io::uo) is det.
+:- pred generate_file_dependency_file(globals::in, file_name::in,
+ io::di, io::uo) is det.
% add_module_relations(LookupModuleImports, ModuleName,
% !IntDepsRel, !ImplDepsRel)
@@ -304,12 +312,13 @@
% and ImplDepsRel respectively. Dependencies are found using the
% LookupModuleImports function.
%
-:- pred add_module_relations(lookup_module_imports::lookup_module_imports,
+:- pred add_module_relations(
+ lookup_module_and_imports::lookup_module_and_imports,
module_name::in, digraph(module_name)::in, digraph(module_name)::out,
digraph(module_name)::in, digraph(module_name)::out) is det.
-:- type lookup_module_imports == (func(module_name) = module_imports).
-:- mode lookup_module_imports == in(func(in) = out is det).
+:- type lookup_module_and_imports == (func(module_name) = module_and_imports).
+:- mode lookup_module_and_imports == in(func(in) = out is det).
%-----------------------------------------------------------------------------%
%
@@ -349,8 +358,8 @@
% and if so, and --warn-nothing-exported is set, it reports
% a warning.
%
-:- pred check_for_no_exports(list(item)::in, module_name::in,
- io::di, io::uo) is det.
+:- pred check_for_no_exports(globals::in, list(item)::in, module_name::in,
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -365,14 +374,15 @@
:- import_module parse_tree.deps_map.
:- import_module parse_tree.file_names.
:- import_module parse_tree.mercury_to_mercury.
+:- import_module parse_tree.module_cmds.
:- import_module parse_tree.module_qual.
:- import_module parse_tree.prog_foreign.
+:- import_module parse_tree.prog_io.
:- import_module parse_tree.prog_mutable.
:- import_module parse_tree.prog_out.
:- import_module parse_tree.prog_type.
:- import_module parse_tree.prog_util.
:- import_module parse_tree.source_file_map.
-:- import_module parse_tree.module_cmds.
:- import_module parse_tree.write_deps_file.
:- import_module recompilation.version.
@@ -404,28 +414,36 @@
% these to qualify all the declarations as much as possible. Then write
% out the .int0 file.
%
-make_private_interface(SourceFileName, SourceFileModuleName, ModuleName,
- MaybeTimestamp, Items0, !IO) :-
- grab_unqual_imported_modules(SourceFileName, SourceFileModuleName,
- ModuleName, Items0, Module, Error, !IO),
+make_private_interface(Globals, SourceFileName, SourceFileModuleName,
+ ModuleName, MaybeTimestamp, Items0, !IO) :-
+ grab_unqual_imported_modules(Globals, SourceFileName, SourceFileModuleName,
+ ModuleName, Items0, Module, !IO),
% Check whether we succeeded.
- % XXX zs: why does this code not check for fatal_module_errors?
- ( Error = some_module_errors ->
+ % XXX zs: why is fatal_module_errors with no_module_errors instead of
+ % some_module_errors?
+ module_and_imports_get_results(Module, Items1, Specs0, Error),
+ (
+ Error = some_module_errors,
module_name_to_file_name(ModuleName, ".int0", do_not_create_dirs,
FileName, !IO),
+ % XXX _NumErrors
+ write_error_specs(Specs0, Globals, 0, _NumWarnings, 0, _NumErrors,
+ !IO),
io.write_strings(["Error reading interface files.\n",
"`", FileName, "' not written.\n"], !IO)
;
+ ( Error = no_module_errors
+ ; Error = fatal_module_errors
+ ),
% Module-qualify all items.
- module_imports_get_items_list(Module, Items1),
- globals.io_get_globals(Globals, !IO),
module_name_to_file_name(ModuleName, ".m", do_not_create_dirs,
FileName, !IO),
module_qualify_items(Items1, Items2, map.init, _, Globals, ModuleName,
- yes(FileName), "", _, _, _, [], Specs),
+ yes(FileName), "", _, _, _, Specs0, Specs),
(
Specs = [_ | _],
+ % XXX _NumErrors
write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
!IO),
io.write_strings(["`", FileName, "' not written.\n"], !IO)
@@ -447,7 +465,7 @@
handle_mutables_in_private_interface(ModuleName, Items4, Items5),
list.map(make_any_instances_abstract, Items5, Items6),
list.reverse(Items6, Items),
- write_interface_file(SourceFileName, ModuleName,
+ write_interface_file(Globals, SourceFileName, ModuleName,
".int0", MaybeTimestamp,
[make_pseudo_decl(md_interface) | Items], !IO),
touch_interface_datestamp(ModuleName, ".date0", !IO)
@@ -522,19 +540,25 @@
% to qualify all items in the interface as much as possible. Then write out
% the .int and .int2 files.
%
-make_interface(SourceFileName, SourceFileModuleName, ModuleName,
+make_interface(Globals, SourceFileName, SourceFileModuleName, ModuleName,
MaybeTimestamp, Items0, !IO) :-
some [!InterfaceItems] (
get_interface(ModuleName, yes, Items0, !:InterfaceItems),
% Get the .int3 files for imported modules.
- grab_unqual_imported_modules(SourceFileName, SourceFileModuleName,
- ModuleName, !.InterfaceItems, Module0, Error, !IO),
+ grab_unqual_imported_modules(Globals, SourceFileName,
+ SourceFileModuleName, ModuleName, !.InterfaceItems, Module0, !IO),
% Check whether we succeeded.
- module_imports_get_items_list(Module0, !:InterfaceItems),
- % XXX zs: why does this code not check for fatal_module_errors?
- ( Error = some_module_errors ->
+ module_and_imports_get_results(Module0, !:InterfaceItems,
+ Specs0, Error),
+ % XXX zs: why is fatal_module_errors with no_module_errors instead of
+ % some_module_errors?
+ (
+ Error = some_module_errors,
+ % XXX _NumErrors
+ write_error_specs(Specs0, Globals, 0, _NumWarnings, 0, _NumErrors,
+ !IO),
module_name_to_file_name(ModuleName, ".int", do_not_create_dirs,
IntFileName, !IO),
module_name_to_file_name(ModuleName, ".int2", do_not_create_dirs,
@@ -543,12 +567,14 @@
"`", IntFileName, "' and ",
"`", Int2FileName, "' not written.\n"], !IO)
;
+ ( Error = no_module_errors
+ ; Error = fatal_module_errors
+ ),
% Module-qualify all items.
- globals.io_get_globals(Globals, !IO),
module_name_to_file_name(ModuleName, ".m", do_not_create_dirs,
FileName, !IO),
module_qualify_items(!InterfaceItems, map.init, _, Globals,
- ModuleName, yes(FileName), "", _, _, _, [], Specs),
+ ModuleName, yes(FileName), "", _, _, _, Specs0, Specs),
% We want to finish writing the interface file (and keep
% the exit status at zero) if we found some warnings.
@@ -570,24 +596,25 @@
strip_assertions(!InterfaceItems),
strip_unnecessary_impl_defns(!InterfaceItems),
check_for_clauses_in_interface(!InterfaceItems, [],
- InterfaceSpecs),
+ InterfaceSpecs0),
% XXX _NumErrors
- write_error_specs( InterfaceSpecs, Globals,
+ check_int_for_no_exports(!.InterfaceItems, ModuleName,
+ InterfaceSpecs0, InterfaceSpecs, !IO),
+ write_error_specs(InterfaceSpecs, Globals,
0, _NumWarnings2, 0, _NumErrors2, !IO),
- check_int_for_no_exports(!.InterfaceItems, ModuleName, !IO),
order_items(!InterfaceItems),
- write_interface_file(SourceFileName, ModuleName, ".int",
- MaybeTimestamp, !.InterfaceItems, !IO),
+ write_interface_file(Globals, SourceFileName, ModuleName,
+ ".int", MaybeTimestamp, !.InterfaceItems, !IO),
get_short_interface(!.InterfaceItems, int2,
ShortInterfaceItems),
- write_interface_file(SourceFileName, ModuleName, ".int2",
- MaybeTimestamp, ShortInterfaceItems, !IO),
+ write_interface_file(Globals, SourceFileName, ModuleName,
+ ".int2", MaybeTimestamp, ShortInterfaceItems, !IO),
touch_interface_datestamp(ModuleName, ".date", !IO)
)
)
).
-make_short_interface(SourceFileName, ModuleName, Items0, !IO) :-
+make_short_interface(Globals, SourceFileName, ModuleName, Items0, !IO) :-
% This qualifies everything as much as it can given the information
% in the current module and writes out the .int3 file.
@@ -600,14 +627,13 @@
check_for_clauses_in_interface(InterfaceItems1, InterfaceItems,
!Specs),
get_short_interface(InterfaceItems, int3, ShortInterfaceItems0),
- globals.io_get_globals(Globals, !IO),
module_qualify_items(ShortInterfaceItems0, ShortInterfaceItems,
map.init, _, Globals, ModuleName, no, "", _, _, _, !Specs),
% XXX _NumErrors
write_error_specs(!.Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
!IO),
% XXX why do we do this even if there are some errors?
- write_interface_file(SourceFileName, ModuleName, ".int3",
+ write_interface_file(Globals, SourceFileName, ModuleName, ".int3",
no, ShortInterfaceItems, !IO),
touch_interface_datestamp(ModuleName, ".date3", !IO)
).
@@ -1547,29 +1573,27 @@
Allowed = yes
).
-check_for_no_exports(Items, ModuleName, !IO) :-
- globals.io_lookup_bool_option(warn_nothing_exported, ExportWarning, !IO),
+check_for_no_exports(Globals, Items, ModuleName, !Specs, !IO) :-
+ globals.lookup_bool_option(Globals, warn_nothing_exported, ExportWarning),
(
ExportWarning = no
;
ExportWarning = yes,
get_interface(ModuleName, no, Items, InterfaceItems),
- check_int_for_no_exports(InterfaceItems, ModuleName, !IO)
+ check_int_for_no_exports(InterfaceItems, ModuleName, !Specs, !IO)
).
- % Given a module name and a list of the items in that module's
- % interface, this procedure checks if the module doesn't export
- % anything, and if so, and --warn-nothing-exported is set, it reports
- % a warning.
- %
- % XXX Should return an error spec.
+ % Given a module name and a list of the items in that module's interface,
+ % this procedure checks if the module doesn't export anything, and if so,
+ % and --warn-nothing-exported is set, it returns a warning.
%
:- pred check_int_for_no_exports(list(item)::in, module_name::in,
- io::di, io::uo) is det.
+ list(error_spec)::in, list(error_spec)::out, io::di, io::uo) is det.
-check_int_for_no_exports([], ModuleName, !IO) :-
- warn_no_exports(ModuleName, !IO).
-check_int_for_no_exports([Item | Items], ModuleName, !IO) :-
+check_int_for_no_exports([], ModuleName, !Specs, !IO) :-
+ generate_no_exports_warning(ModuleName, WarnSpec, !IO),
+ !:Specs = [WarnSpec | !.Specs].
+check_int_for_no_exports([Item | Items], ModuleName, !Specs, !IO) :-
(
(
Item = item_nothing(_)
@@ -1580,17 +1604,22 @@
)
->
% Nothing useful - keep searching.
- check_int_for_no_exports(Items, ModuleName, !IO)
+ check_int_for_no_exports(Items, ModuleName, !Specs, !IO)
;
% We found something useful - don't issue the warning.
true
).
-:- pred warn_no_exports(module_name::in, io::di, io::uo) is det.
+:- pred generate_no_exports_warning(module_name::in, error_spec::out,
+ io::di, io::uo) is det.
-warn_no_exports(ModuleName, !IO) :-
+generate_no_exports_warning(ModuleName, Spec, !IO) :-
+ % XXX The FileName should be passed down to here; we shouldn't have to
+ % compute it again.
module_name_to_file_name(ModuleName, ".m", do_not_create_dirs,
FileName, !IO),
+ % XXX We should use the module declaration's context, not the arbitrary
+ % line number 1.
Context = context_init(FileName, 1),
Severity = severity_conditional(warn_nothing_exported, yes,
severity_warning, no),
@@ -1608,28 +1637,27 @@
fixed("or `:- mode'"), words("declaration.")])
]),
Msg = simple_msg(Context, [Component]),
- Spec = error_spec(Severity, phase_term_to_parse_tree, [Msg]),
- globals.io_get_globals(Globals, !IO),
- % XXX _NumErrors
- write_error_spec(Spec, Globals, 0, _NumWarnings, 0, _NumErrors, !IO).
+ Spec = error_spec(Severity, phase_term_to_parse_tree, [Msg]).
%-----------------------------------------------------------------------------%
-:- pred write_interface_file(file_name::in, module_name::in, string::in,
- maybe(timestamp)::in, list(item)::in, io::di, io::uo) is det.
+:- pred write_interface_file(globals::in, file_name::in, module_name::in,
+ string::in, maybe(timestamp)::in, list(item)::in, io::di, io::uo) is det.
-write_interface_file(_SourceFileName, ModuleName, Suffix, MaybeTimestamp,
- InterfaceItems0, !IO) :-
+write_interface_file(Globals0, _SourceFileName, ModuleName, Suffix,
+ MaybeTimestamp, InterfaceItems0, !IO) :-
% Create (e.g.) `foo.int.tmp'.
string.append(Suffix, ".tmp", TmpSuffix),
module_name_to_file_name(ModuleName, Suffix, do_create_dirs,
OutputFileName, !IO),
module_name_to_file_name(ModuleName, TmpSuffix, do_not_create_dirs,
TmpOutputFileName, !IO),
- globals.io_lookup_bool_option(line_numbers, LineNumbers, !IO),
- globals.io_set_option(line_numbers, bool(no), !IO),
- globals.io_lookup_bool_option(generate_item_version_numbers,
- GenerateVersionNumbers, !IO),
+
+ globals.set_option(line_numbers, bool(no), Globals0, Globals),
+ globals.io_set_globals(Globals, !IO),
+
+ globals.lookup_bool_option(Globals, generate_item_version_numbers,
+ GenerateVersionNumbers),
(
GenerateVersionNumbers = yes,
% Find the timestamp of the current module.
@@ -1637,13 +1665,17 @@
MaybeTimestamp = yes(Timestamp),
% Read in the previous version of the file.
- read_module_ignore_errors(ModuleName, Suffix,
+ read_module_ignore_errors(Globals, ModuleName, Suffix,
"Reading old interface for module",
do_search, do_not_return_timestamp, OldItems, OldError,
_OldIntFileName, _OldTimestamp, !IO),
- ( OldError = no_module_errors ->
+ (
+ OldError = no_module_errors,
MaybeOldItems = yes(OldItems)
;
+ ( OldError = some_module_errors
+ ; OldError = fatal_module_errors
+ ),
% If we can't read in the old file, the timestamps will
% all be set to the modification time of the source file.
MaybeOldItems = no
@@ -1677,15 +1709,16 @@
InterfaceItems = InterfaceItems0
),
convert_to_mercury(ModuleName, TmpOutputFileName, InterfaceItems, !IO),
- globals.io_set_option(line_numbers, bool(LineNumbers), !IO),
+ % Reset the options to what they were.
+ globals.io_set_globals(Globals0, !IO),
update_interface(OutputFileName, !IO).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-grab_imported_modules(SourceFileName, SourceFileModuleName, ModuleName,
- NestedChildren, ReadModules, MaybeTimestamp, Items0, !:Module,
- Error, !IO) :-
+grab_imported_modules(Globals, SourceFileName, SourceFileModuleName,
+ ModuleName, NestedChildren, HaveReadModuleMap, MaybeTimestamp, Items0,
+ !:Module, !IO) :-
% Find out which modules this one depends on.
AncestorModules = get_ancestors(ModuleName),
get_dependencies_int_imp(Items0, IntImportedModules0, IntUsedModules0,
@@ -1721,9 +1754,9 @@
MaybeTimestamps = no
),
- init_module_imports(SourceFileName, SourceFileModuleName, ModuleName,
- Items0, PublicChildren, NestedChildren, FactDeps,
- MaybeTimestamps, !:Module),
+ init_module_and_imports(SourceFileName, SourceFileModuleName,
+ ModuleName, Items0, !.Specs, PublicChildren, NestedChildren,
+ FactDeps, MaybeTimestamps, !:Module),
% If this module has any separately-compiled sub-modules, then
% we need to make everything in the implementation of this module
@@ -1738,15 +1771,14 @@
;
Children = [_ | _],
split_clauses_and_decls(ImplItems, Clauses, ImplDecls),
- list.condense(
- [[make_pseudo_decl(md_interface) | InterfaceItems],
- [make_pseudo_decl(md_private_interface) | ImplDecls],
- [make_pseudo_decl(md_implementation) | Clauses]], Items1),
- module_imports_set_items_list(Items1, !Module)
+ Items1 =
+ [make_pseudo_decl(md_interface) | InterfaceItems] ++
+ [make_pseudo_decl(md_private_interface) | ImplDecls] ++
+ [make_pseudo_decl(md_implementation) | Clauses],
+ !Module ^ mai_items_cord := cord.from_list(Items1)
),
% Add `builtin' and `private_builtin' to the list of imported modules.
- globals.io_get_globals(Globals, !IO),
add_implicit_imports(Items1, Globals,
IntImportedModules1, IntImportedModules2,
IntUsedModules1, IntUsedModules2),
@@ -1756,7 +1788,8 @@
% Uses of the items declared in ancestor modules do not need
% module qualifiers. Modules imported by ancestors are considered
% to be visible in the current module.
- process_module_private_interfaces(ReadModules, AncestorModules,
+ process_module_private_interfaces(Globals, HaveReadModuleMap,
+ AncestorModules,
make_pseudo_decl(
md_imported(import_locn_ancestor_private_interface)),
make_pseudo_decl(md_abstract_imported),
@@ -1767,8 +1800,8 @@
% Uses of these items do not need module qualifiers.
IntIndirectImports0 = [],
IntImpIndirectImports0 = [],
- process_module_long_interfaces(ReadModules, may_be_unqualified,
- IntImportedModules, ".int",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ may_be_unqualified, IntImportedModules, ".int",
make_pseudo_decl(md_imported(import_locn_interface)),
make_pseudo_decl(md_abstract_imported),
IntIndirectImports0, IntIndirectImports1,
@@ -1777,8 +1810,8 @@
ImpIndirectImports0 = [],
ImpImpIndirectImports0 = [],
- process_module_long_interfaces(ReadModules, may_be_unqualified,
- ImpImportedModules, ".int",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ may_be_unqualified, ImpImportedModules, ".int",
make_pseudo_decl(md_imported(import_locn_implementation)),
make_pseudo_decl(md_abstract_imported),
ImpIndirectImports0, ImpIndirectImports1,
@@ -1786,15 +1819,15 @@
!Module, !IO),
% Process the modules imported using `use_module' .
- process_module_long_interfaces(ReadModules, must_be_qualified,
- IntUsedModules, ".int",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ must_be_qualified, IntUsedModules, ".int",
make_pseudo_decl(md_used(import_locn_interface)),
make_pseudo_decl(md_abstract_imported),
IntIndirectImports1, IntIndirectImports,
IntImpIndirectImports1, IntImpIndirectImports2,
!Module, !IO),
- process_module_long_interfaces(ReadModules, must_be_qualified,
- ImpUsedModules, ".int",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ must_be_qualified, ImpUsedModules, ".int",
make_pseudo_decl(md_used(import_locn_implementation)),
make_pseudo_decl(md_abstract_imported),
ImpIndirectImports1, ImpIndirectImports,
@@ -1805,13 +1838,13 @@
% The short interfaces are treated as if they are imported
% using `use_module'.
append_pseudo_decl(md_transitively_imported, !Module),
- process_module_short_interfaces_transitively(ReadModules,
- IntIndirectImports, ".int2",
+ process_module_short_interfaces_transitively(Globals,
+ HaveReadModuleMap, IntIndirectImports, ".int2",
make_pseudo_decl(md_used(import_locn_interface)),
make_pseudo_decl(md_abstract_imported),
IntImpIndirectImports2, IntImpIndirectImports, !Module, !IO),
- process_module_short_interfaces_transitively(ReadModules,
- ImpIndirectImports, ".int2",
+ process_module_short_interfaces_transitively(Globals,
+ HaveReadModuleMap, ImpIndirectImports, ".int2",
make_pseudo_decl(md_used(import_locn_implementation)),
make_pseudo_decl(md_abstract_imported),
ImpImpIndirectImports2, ImpImpIndirectImports, !Module, !IO),
@@ -1820,26 +1853,22 @@
% implementation of indirectly imported modules. The items in these
% modules shouldn't be visible to typechecking -- they are used for
% fully expanding equivalence types after the semantic checking passes.
- process_module_short_interfaces_and_impls_transitively(
- ReadModules, IntImpIndirectImports, ".int2",
+ process_module_short_interfaces_and_impls_transitively(Globals,
+ HaveReadModuleMap, IntImpIndirectImports, ".int2",
make_pseudo_decl(md_abstract_imported),
make_pseudo_decl(md_abstract_imported),
!Module, !IO),
- process_module_short_interfaces_and_impls_transitively(
- ReadModules, ImpImpIndirectImports, ".int2",
+ process_module_short_interfaces_and_impls_transitively(Globals,
+ HaveReadModuleMap, ImpImpIndirectImports, ".int2",
make_pseudo_decl(md_abstract_imported),
make_pseudo_decl(md_abstract_imported),
!Module, !IO),
- module_imports_get_items_list(!.Module, Items),
+ module_and_imports_get_results(!.Module, Items, _, _),
check_imports_accessibility(ModuleName,
IntImportedModules ++ IntUsedModules ++
- ImpImportedModules ++ ImpUsedModules, Items, !Specs),
-
- write_error_specs(!.Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
- !IO),
-
- module_imports_get_error(!.Module, Error)
+ ImpImportedModules ++ ImpUsedModules, Items, [], AccessSpecs),
+ module_and_imports_add_specs(AccessSpecs, !Module)
).
% grab_unqual_imported_modules:
@@ -1847,45 +1876,44 @@
% Like grab_imported_modules, but gets the `.int3' files
% instead of the `.int' and `.int2' files.
%
-grab_unqual_imported_modules(SourceFileName, SourceFileModuleName, ModuleName,
- Items0, !:Module, Error, !IO) :-
+grab_unqual_imported_modules(Globals, SourceFileName, SourceFileModuleName,
+ ModuleName, Items0, !:Module, !IO) :-
% Find out which modules this one depends on.
ParentDeps = get_ancestors(ModuleName),
get_dependencies_int_imp(Items0, IntImportDeps0, IntUseDeps0,
ImpImportDeps, ImpUseDeps),
% Construct the initial module import structure.
- init_module_imports(SourceFileName, SourceFileModuleName, ModuleName,
- Items0, [], [], [], no, !:Module),
+ init_module_and_imports(SourceFileName, SourceFileModuleName, ModuleName,
+ Items0, [], [], [], [], no, !:Module),
% Add `builtin' and `private_builtin' to the imported modules.
- globals.io_get_globals(Globals, !IO),
add_implicit_imports(Items0, Globals,
IntImportDeps0, IntImportDeps, IntUseDeps0, IntUseDeps),
% Get the .int3s and .int0s that the current module depends on.
- map.init(ReadModules),
+ map.init(HaveReadModuleMap),
% First the .int0s for parent modules.
- process_module_private_interfaces(ReadModules, ParentDeps,
+ process_module_private_interfaces(Globals, HaveReadModuleMap, ParentDeps,
make_pseudo_decl(md_imported(import_locn_ancestor_private_interface)),
make_pseudo_decl(md_abstract_imported),
[], ParentImportDeps, [], ParentUseDeps, !Module, !IO),
% Then the .int3s for `:- import'-ed modules.
- process_module_long_interfaces(ReadModules, may_be_unqualified,
- ParentImportDeps, ".int3",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ may_be_unqualified, ParentImportDeps, ".int3",
make_pseudo_decl(md_imported(import_locn_ancestor)),
make_pseudo_decl(md_abstract_imported),
[], IntIndirectImportDeps0, [], _, !Module, !IO),
- process_module_long_interfaces(ReadModules, may_be_unqualified,
- IntImportDeps, ".int3",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ may_be_unqualified, IntImportDeps, ".int3",
make_pseudo_decl(md_imported(import_locn_interface)),
make_pseudo_decl(md_abstract_imported),
IntIndirectImportDeps0, IntIndirectImportDeps1,
[], _, !Module, !IO),
- process_module_long_interfaces(ReadModules, may_be_unqualified,
- ImpImportDeps, ".int3",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ may_be_unqualified, ImpImportDeps, ".int3",
make_pseudo_decl(md_imported(import_locn_implementation)),
make_pseudo_decl(md_abstract_imported),
[], ImpIndirectImportDeps0,
@@ -1893,20 +1921,20 @@
% Then (after appropriate `:- used' decls) the .int3s for `:- use'-ed
% modules.
- process_module_long_interfaces(ReadModules, may_be_unqualified,
- ParentUseDeps, ".int3",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ may_be_unqualified, ParentUseDeps, ".int3",
make_pseudo_decl(md_imported(import_locn_ancestor)),
make_pseudo_decl(md_abstract_imported),
IntIndirectImportDeps1, IntIndirectImportDeps2,
[], _, !Module, !IO),
- process_module_long_interfaces(ReadModules, must_be_qualified,
- IntUseDeps, ".int3",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ must_be_qualified, IntUseDeps, ".int3",
make_pseudo_decl(md_used(import_locn_interface)),
make_pseudo_decl(md_abstract_imported),
IntIndirectImportDeps2, IntIndirectImportDeps,
[], _, !Module, !IO),
- process_module_long_interfaces(ReadModules, must_be_qualified,
- ImpUseDeps, ".int3",
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ must_be_qualified, ImpUseDeps, ".int3",
make_pseudo_decl(md_used(import_locn_implementation)),
make_pseudo_decl(md_abstract_imported),
ImpIndirectImportDeps0, ImpIndirectImportDeps,
@@ -1914,38 +1942,29 @@
% Then (after appropriate `:- used' decl) the .int3s for indirectly
% imported modules.
- process_module_short_interfaces_transitively(ReadModules,
+ process_module_short_interfaces_transitively(Globals, HaveReadModuleMap,
IntIndirectImportDeps, ".int3",
make_pseudo_decl(md_used(import_locn_interface)),
make_pseudo_decl(md_abstract_imported),
[], _, !Module, !IO),
- process_module_short_interfaces_transitively(ReadModules,
+ process_module_short_interfaces_transitively(Globals, HaveReadModuleMap,
ImpIndirectImportDeps, ".int3",
make_pseudo_decl(md_used(import_locn_implementation)),
make_pseudo_decl(md_abstract_imported),
[], _, !Module, !IO),
- some [!Specs] (
- !:Specs = [],
-
- module_imports_get_items_list(!.Module, Items),
+ module_and_imports_get_results(!.Module, Items, _, _),
check_imports_accessibility(ModuleName,
IntImportDeps ++ IntUseDeps ++ ImpImportDeps ++ ImpUseDeps,
- Items, !Specs),
-
- write_error_specs(!.Specs, Globals, 0, _NumWarnings, 0, _NumErrors,
- !IO),
-
- module_imports_get_error(!.Module, Error)
- ).
+ Items, [], AccessSpecs),
+ module_and_imports_add_specs(AccessSpecs, !Module).
%-----------------------------------------------------------------------------%
-append_pseudo_decl(PseudoDecl, Module0, Module) :-
- Items0 = Module0 ^ items,
- Items = snoc(Items0, make_pseudo_decl(PseudoDecl)),
- Module = Module0 ^ items := Items.
+append_pseudo_decl(PseudoDecl, !Module) :-
+ module_and_imports_add_items(cord.singleton(make_pseudo_decl(PseudoDecl)),
+ !Module).
make_pseudo_decl(PseudoDecl) = Item :-
ItemModuleDefn = item_module_defn_info(PseudoDecl, term.context_init, -1),
@@ -2184,40 +2203,40 @@
%-----------------------------------------------------------------------------%
-generate_module_dependencies(ModuleName, !IO) :-
+generate_module_dependencies(Globals, ModuleName, !IO) :-
map.init(DepsMap),
- generate_dependencies(output_all_dependencies, do_not_search, ModuleName,
- DepsMap, !IO).
+ generate_dependencies(Globals, output_all_dependencies, do_not_search,
+ ModuleName, DepsMap, !IO).
-generate_file_dependencies(FileName, !IO) :-
- build_deps_map(FileName, ModuleName, DepsMap, !IO),
- generate_dependencies(output_all_dependencies, do_not_search, ModuleName,
- DepsMap, !IO).
+generate_file_dependencies(Globals, FileName, !IO) :-
+ build_deps_map(Globals, FileName, ModuleName, DepsMap, !IO),
+ generate_dependencies(Globals, output_all_dependencies, do_not_search,
+ ModuleName, DepsMap, !IO).
-generate_module_dependency_file(ModuleName, !IO) :-
+generate_module_dependency_file(Globals, ModuleName, !IO) :-
map.init(DepsMap),
- generate_dependencies(output_d_file_only, do_search, ModuleName,
+ generate_dependencies(Globals, output_d_file_only, do_search, ModuleName,
DepsMap, !IO).
-generate_file_dependency_file(FileName, !IO) :-
- build_deps_map(FileName, ModuleName, DepsMap, !IO),
- generate_dependencies(output_d_file_only, do_search, ModuleName,
+generate_file_dependency_file(Globals, FileName, !IO) :-
+ build_deps_map(Globals, FileName, ModuleName, DepsMap, !IO),
+ generate_dependencies(Globals, output_d_file_only, do_search, ModuleName,
DepsMap, !IO).
-:- pred build_deps_map(file_name::in, module_name::out, deps_map::out,
- io::di, io::uo) is det.
+:- pred build_deps_map(globals::in, file_name::in,
+ module_name::out, deps_map::out, io::di, io::uo) is det.
-build_deps_map(FileName, ModuleName, DepsMap, !IO) :-
+build_deps_map(Globals, FileName, ModuleName, DepsMap, !IO) :-
% Read in the top-level file (to figure out its module name).
read_module_from_file(FileName, ".m", "Reading file", do_not_search,
- do_not_return_timestamp, Items, Error, ModuleName, _, !IO),
+ do_not_return_timestamp, Items, Specs0, Error, ModuleName, _, !IO),
SourceFileName = FileName ++ ".m",
- split_into_submodules(ModuleName, Items, SubModuleList, [], Specs),
- globals.io_get_globals(Globals, !IO),
+ split_into_submodules(ModuleName, Items, SubModuleList, Specs0, Specs),
+ % XXX _NumErrors
write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors, !IO),
assoc_list.keys(SubModuleList, SubModuleNames),
list.map(init_dependencies(SourceFileName, ModuleName, SubModuleNames,
- Error, Globals), SubModuleList, ModuleImportsList),
+ [], Error, Globals), SubModuleList, ModuleImportsList),
map.init(DepsMap0),
list.foldl(insert_into_deps_map, ModuleImportsList, DepsMap0, DepsMap).
@@ -2225,29 +2244,34 @@
---> output_d_file_only
; output_all_dependencies.
-:- pred generate_dependencies(generate_dependencies_mode::in, maybe_search::in,
- module_name::in, deps_map::in, io::di, io::uo) is det.
+:- pred generate_dependencies(globals::in, generate_dependencies_mode::in,
+ maybe_search::in, module_name::in, deps_map::in, io::di, io::uo) is det.
-generate_dependencies(Mode, Search, ModuleName, DepsMap0, !IO) :-
+generate_dependencies(Globals, Mode, Search, ModuleName, DepsMap0, !IO) :-
% First, build up a map of the dependencies.
- generate_deps_map(ModuleName, Search, DepsMap0, DepsMap, !IO),
+ generate_deps_map(Globals, ModuleName, Search, DepsMap0, DepsMap, !IO),
% Check whether we could read the main `.m' file.
map.lookup(DepsMap, ModuleName, ModuleDep),
ModuleDep = deps(_, ModuleImports),
- module_imports_get_error(ModuleImports, Error),
- ( Error = fatal_module_errors ->
+ Error = ModuleImports ^ mai_error,
+ (
+ Error = fatal_module_errors,
ModuleString = sym_name_to_string(ModuleName),
string.append_list(["can't read source file for module `",
ModuleString, "'."], Message),
report_error(Message, !IO)
;
+ ( Error = no_module_errors
+ ; Error = some_module_errors
+ ),
(
Mode = output_d_file_only
;
Mode = output_all_dependencies,
- module_imports_get_source_file_name(ModuleImports, SourceFileName),
+ module_and_imports_get_source_file_name(ModuleImports,
+ SourceFileName),
generate_dependencies_write_dv_file(SourceFileName, ModuleName,
DepsMap, !IO),
generate_dependencies_write_dep_file(SourceFileName, ModuleName,
@@ -2471,7 +2495,6 @@
set.to_sorted_list(SCC0, SCC),
io.write_list(Stream, SCC, "\n", prog_out.write_sym_name, !IO).
-% ZZZ
% generate_dependencies_write_d_files(Modules, IntDepsRel, ImplDepsRel,
% IndirectDepsRel, IndirectOptDepsRel, TransOptOrder, DepsMap, !IO):
%
@@ -2500,9 +2523,9 @@
% Look up the interface/implementation/indirect dependencies
% for this module from the respective dependency graphs,
- % and save them in the module_imports structure.
+ % and save them in the module_and_imports structure.
- module_imports_get_module_name(!.Module, ModuleName),
+ module_and_imports_get_module_name(!.Module, ModuleName),
get_dependencies_from_graph(IndirectOptDepsGraph, ModuleName,
IndirectOptDeps),
globals.io_lookup_bool_option(intermodule_optimization, Intermod,
@@ -2537,11 +2560,11 @@
(func(ThisDep) = foreign_import_module_info(Lang, ThisDep,
term.context_init)),
IndirectOptDeps),
- !:Module = !.Module ^ foreign_import_modules := ForeignImports,
+ !Module ^ mai_foreign_import_modules := ForeignImports,
- module_imports_set_int_deps(IntDeps, !Module),
- module_imports_set_impl_deps(ImplDeps, !Module),
- module_imports_set_indirect_deps(IndirectDeps, !Module),
+ module_and_imports_set_int_deps(IntDeps, !Module),
+ module_and_imports_set_impl_deps(ImplDeps, !Module),
+ module_and_imports_set_indirect_deps(IndirectDeps, !Module),
% Compute the trans-opt dependencies for this module. To avoid
% the possibility of cycles, each module is only allowed to depend
@@ -2561,12 +2584,15 @@
% Note that even if a fatal error occured for one of the files
% that the current Module depends on, a .d file is still produced,
% even though it probably contains incorrect information.
- module_imports_get_error(!.Module, Error),
- ( Error \= fatal_module_errors ->
+ Error = !.Module ^ mai_error,
+ (
+ ( Error = no_module_errors
+ ; Error = some_module_errors
+ ),
write_dependency_file(!.Module, set.list_to_set(IndirectOptDeps),
yes(TransOptDeps), !IO)
;
- true
+ Error = fatal_module_errors
),
generate_dependencies_write_d_files(Deps, IntDepsGraph, ImplDepsGraph,
IndirectDepsGraph, IndirectOptDepsGraph, TransOptOrder, DepsMap,
@@ -2598,31 +2624,31 @@
deps_list_to_deps_graph([Deps | DepsList], DepsMap, !IntDepsGraph,
!ImplDepsGraph) :-
Deps = deps(_, ModuleImports),
- ModuleError = ModuleImports ^ error,
+ ModuleError = ModuleImports ^ mai_error,
( ModuleError \= fatal_module_errors ->
- module_imports_to_deps_graph(ModuleImports,
- lookup_module_imports(DepsMap), !IntDepsGraph, !ImplDepsGraph)
+ module_and_imports_to_deps_graph(ModuleImports,
+ lookup_module_and_imports(DepsMap), !IntDepsGraph, !ImplDepsGraph)
;
true
),
deps_list_to_deps_graph(DepsList, DepsMap, !IntDepsGraph, !ImplDepsGraph).
-:- func lookup_module_imports(deps_map, module_name) = module_imports.
+:- func lookup_module_and_imports(deps_map, module_name) = module_and_imports.
-lookup_module_imports(DepsMap, ModuleName) = ModuleImports :-
+lookup_module_and_imports(DepsMap, ModuleName) = ModuleImports :-
map.lookup(DepsMap, ModuleName, deps(_, ModuleImports)).
add_module_relations(LookupModuleImports, ModuleName, !IntDepsGraph,
!ImplDepsGraph) :-
ModuleImports = LookupModuleImports(ModuleName),
- module_imports_to_deps_graph(ModuleImports, LookupModuleImports,
+ module_and_imports_to_deps_graph(ModuleImports, LookupModuleImports,
!IntDepsGraph, !ImplDepsGraph).
-:- pred module_imports_to_deps_graph(module_imports::in,
- lookup_module_imports::lookup_module_imports,
+:- pred module_and_imports_to_deps_graph(module_and_imports::in,
+ lookup_module_and_imports::lookup_module_and_imports,
deps_graph::in, deps_graph::out, deps_graph::in, deps_graph::out) is det.
-module_imports_to_deps_graph(ModuleImports, LookupModuleImports,
+module_and_imports_to_deps_graph(ModuleImports, LookupModuleImports,
!IntDepsGraph, !ImplDepsGraph) :-
% Add interface dependencies to the interface deps graph.
%
@@ -2638,8 +2664,8 @@
% conservative than they need to be in that case. However, that should
% not be a major problem.
- ModuleName = ModuleImports ^ module_name,
- ParentDeps = ModuleImports ^ parent_deps,
+ ModuleName = ModuleImports ^ mai_module_name,
+ ParentDeps = ModuleImports ^ mai_parent_deps,
digraph.add_vertex(ModuleName, IntModuleKey, !IntDepsGraph),
add_int_deps(IntModuleKey, ModuleImports, !IntDepsGraph),
add_parent_impl_deps_list(LookupModuleImports, IntModuleKey, ParentDeps,
@@ -2660,18 +2686,18 @@
% Add interface dependencies to the interface deps graph.
%
-:- pred add_int_deps(deps_graph_key::in, module_imports::in,
+:- pred add_int_deps(deps_graph_key::in, module_and_imports::in,
deps_graph::in, deps_graph::out) is det.
add_int_deps(ModuleKey, ModuleImports, !DepsGraph) :-
AddDep = add_dep(ModuleKey),
- list.foldl(AddDep, ModuleImports ^ parent_deps, !DepsGraph),
- list.foldl(AddDep, ModuleImports ^ int_deps, !DepsGraph).
+ list.foldl(AddDep, ModuleImports ^ mai_parent_deps, !DepsGraph),
+ list.foldl(AddDep, ModuleImports ^ mai_int_deps, !DepsGraph).
% Add direct implementation dependencies for a module to the
% implementation deps graph.
%
-:- pred add_impl_deps(deps_graph_key::in, module_imports::in,
+:- pred add_impl_deps(deps_graph_key::in, module_and_imports::in,
deps_graph::in, deps_graph::out) is det.
add_impl_deps(ModuleKey, ModuleImports, !DepsGraph) :-
@@ -2679,13 +2705,14 @@
% interface dependencies, so first we add the interface deps.
add_int_deps(ModuleKey, ModuleImports, !DepsGraph),
% then we add the impl deps
- module_imports_get_impl_deps(ModuleImports, ImplDeps),
+ module_and_imports_get_impl_deps(ModuleImports, ImplDeps),
list.foldl(add_dep(ModuleKey), ImplDeps, !DepsGraph).
% Add parent implementation dependencies for the given Parent module
% to the impl. deps graph values for the given ModuleKey.
%
-:- pred add_parent_impl_deps(lookup_module_imports::lookup_module_imports,
+:- pred add_parent_impl_deps(
+ lookup_module_and_imports::lookup_module_and_imports,
deps_graph_key::in, module_name::in, deps_graph::in, deps_graph::out)
is det.
@@ -2693,7 +2720,8 @@
ParentModuleImports = LookupModuleImports(Parent),
add_impl_deps(ModuleKey, ParentModuleImports, !DepsGraph).
-:- pred add_parent_impl_deps_list(lookup_module_imports::lookup_module_imports,
+:- pred add_parent_impl_deps_list(
+ lookup_module_and_imports::lookup_module_and_imports,
deps_graph_key::in, list(module_name)::in, deps_graph::in, deps_graph::out)
is det.
@@ -2741,104 +2769,114 @@
module_needs_header(DepsMap, Module) :-
map.lookup(DepsMap, Module, deps(_, ModuleImports)),
- ModuleImports ^ has_foreign_code = contains_foreign_code(Langs),
+ ModuleImports ^ mai_has_foreign_code = contains_foreign_code(Langs),
set.member(lang_c, Langs).
%-----------------------------------------------------------------------------%
-process_module_private_interfaces(_, [], _, _, !DirectImports,
+process_module_private_interfaces(_, _, [], _, _, !DirectImports,
!DirectUses, !Module, !IO).
-process_module_private_interfaces(ReadModules, [Ancestor | Ancestors],
- IntStatusItem, ImpStatusItem, !DirectImports,
+process_module_private_interfaces(Globals, HaveReadModuleMap,
+ [Ancestor | Ancestors], IntStatusItem, ImpStatusItem, !DirectImports,
!DirectUses, !Module, !IO) :-
- ModuleName = !.Module ^ module_name,
- ModAncestors0 = !.Module ^ parent_deps,
+ ModuleName = !.Module ^ mai_module_name,
+ ModAncestors0 = !.Module ^ mai_parent_deps,
( Ancestor = ModuleName ->
unexpected(this_file, "process_module_private_interfaces: " ++
"module is its own ancestor?")
; list.member(Ancestor, ModAncestors0) ->
- % we've already read it
- process_module_private_interfaces(ReadModules,
+ % We've already read it.
+ process_module_private_interfaces(Globals, HaveReadModuleMap,
Ancestors, IntStatusItem, ImpStatusItem,
!DirectImports, !DirectUses, !Module, !IO)
;
- ModItems0 = !.Module ^ items,
- ModError0 = !.Module ^ error,
- maybe_return_timestamp(!.Module ^ maybe_timestamps, ReturnTimestamp),
- maybe_read_module(ReadModules, Ancestor, ".int0",
- "Reading private interface for module", do_search,
- ReturnTimestamp, PrivateIntItems, PrivateIntError,
+ maybe_return_timestamp(!.Module ^ mai_maybe_timestamps,
+ ReturnTimestamp),
+ maybe_read_module(Globals, HaveReadModuleMap, Ancestor, ".int0",
+ "Reading private interface for module", do_search, ReturnTimestamp,
+ PrivateIntItems0, PrivateIntSpecs, PrivateIntError,
_AncestorFileName, MaybeTimestamp, !IO),
maybe_record_timestamp(Ancestor, ".int0", may_be_unqualified,
MaybeTimestamp, !Module),
replace_section_decls(IntStatusItem, ImpStatusItem,
- PrivateIntItems, Items),
- maybe_add_int_error(PrivateIntError, ModError0, ModError),
+ PrivateIntItems0, PrivateIntItems),
+
+ module_and_imports_add_items(cord.from_list(PrivateIntItems), !Module),
+ module_and_imports_add_specs(PrivateIntSpecs, !Module),
+ module_and_imports_add_interface_error(PrivateIntError, !Module),
globals.io_lookup_bool_option(detailed_statistics, Statistics, !IO),
maybe_report_stats(Statistics, !IO),
- ( PrivateIntError = fatal_module_errors ->
+ (
+ PrivateIntError = fatal_module_errors,
ModAncestors = ModAncestors0
;
+ ( PrivateIntError = no_module_errors
+ ; PrivateIntError = some_module_errors
+ ),
ModAncestors = [Ancestor | ModAncestors0]
),
- get_dependencies(Items, AncDirectImports, AncDirectUses),
+ get_dependencies(PrivateIntItems, AncDirectImports, AncDirectUses),
!:DirectImports = !.DirectImports ++ AncDirectImports,
!:DirectUses = !.DirectUses ++ AncDirectUses,
- ModItems = ModItems0 ++ cord.from_list(Items),
- !:Module = !.Module ^ items := ModItems,
- !:Module = !.Module ^ parent_deps := ModAncestors,
- !:Module = !.Module ^ error := ModError,
- process_module_private_interfaces(ReadModules, Ancestors,
- IntStatusItem, ImpStatusItem,
+ !Module ^ mai_parent_deps := ModAncestors,
+
+ process_module_private_interfaces(Globals, HaveReadModuleMap,
+ Ancestors, IntStatusItem, ImpStatusItem,
!DirectImports, !DirectUses, !Module, !IO)
).
%-----------------------------------------------------------------------------%
-process_module_long_interfaces(_, _, [], _Ext, _, _,
+process_module_long_interfaces(_, _, _, [], _Ext, _, _,
!IndirectImports, !ImplIndirectImports, !Module, !IO).
-process_module_long_interfaces(ReadModules, NeedQualifier, [Import | Imports],
- Ext, IntStatusItem, ImpStatusItem, !IndirectImports,
- !ImplIndirectImports, !Module, !IO) :-
- ModuleName = !.Module ^ module_name,
- ModImplementationImports0 = !.Module ^ impl_deps,
+process_module_long_interfaces(Globals, HaveReadModuleMap, NeedQualifier,
+ [Import | Imports], Ext, IntStatusItem, ImpStatusItem,
+ !IndirectImports, !ImplIndirectImports, !Module, !IO) :-
+ ModuleName = !.Module ^ mai_module_name,
+ ModImplementationImports0 = !.Module ^ mai_impl_deps,
(
% Have we already read it?
( Import = ModuleName
- ; list.member(Import, !.Module ^ parent_deps)
- ; list.member(Import, !.Module ^ int_deps)
+ ; list.member(Import, !.Module ^ mai_parent_deps)
+ ; list.member(Import, !.Module ^ mai_int_deps)
; list.member(Import, ModImplementationImports0)
)
->
- process_module_long_interfaces(ReadModules, NeedQualifier,
- Imports, Ext, IntStatusItem, ImpStatusItem,
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ NeedQualifier, Imports, Ext, IntStatusItem, ImpStatusItem,
!IndirectImports, !ImplIndirectImports, !Module, !IO)
;
- ModItems0 = !.Module ^ items,
- ModError0 = !.Module ^ error,
- maybe_return_timestamp(!.Module ^ maybe_timestamps, ReturnTimestamp),
- maybe_read_module(ReadModules, Import, Ext,
+ maybe_return_timestamp(!.Module ^ mai_maybe_timestamps,
+ ReturnTimestamp),
+ maybe_read_module(Globals, HaveReadModuleMap, Import, Ext,
"Reading interface for module", do_search, ReturnTimestamp,
- LongIntItems, LongIntError, _LongIntFileName,
+ LongIntItems0, LongIntSpecs, LongIntError, _LongIntFileName,
MaybeTimestamp, !IO),
- get_dependencies_int_imp(LongIntItems,
+ get_dependencies_int_imp(LongIntItems0,
IndirectImports1, IndirectUses1,
ImplIndirectImports1, ImplIndirectUses1),
replace_section_decls(IntStatusItem, ImpStatusItem,
- LongIntItems, Items),
- maybe_add_int_error(LongIntError, ModError0, ModError),
+ LongIntItems0, LongIntItems),
+
+ module_and_imports_add_items(cord.from_list(LongIntItems), !Module),
+ module_and_imports_add_specs(LongIntSpecs, !Module),
+ module_and_imports_add_interface_error(LongIntError, !Module),
globals.io_lookup_bool_option(detailed_statistics, Statistics, !IO),
maybe_report_stats(Statistics, !IO),
- ( LongIntError = fatal_module_errors ->
+ (
+ LongIntError = fatal_module_errors,
ModImplementationImports = ModImplementationImports0
;
+ ( LongIntError = no_module_errors
+ ; LongIntError = some_module_errors
+ ),
maybe_record_timestamp(Import, Ext, NeedQualifier, MaybeTimestamp,
!Module),
ModImplementationImports = [Import | ModImplementationImports0]
@@ -2847,13 +2885,10 @@
++ IndirectUses1,
!:ImplIndirectImports = !.ImplIndirectImports
++ ImplIndirectImports1 ++ ImplIndirectUses1,
- ModItems = ModItems0 ++ cord.from_list(Items),
- !:Module = !.Module ^ impl_deps := ModImplementationImports,
- !:Module = !.Module ^ items := ModItems,
- !:Module = !.Module ^ error := ModError,
+ !Module ^ mai_impl_deps := ModImplementationImports,
- process_module_long_interfaces(ReadModules, NeedQualifier,
- Imports, Ext, IntStatusItem, ImpStatusItem,
+ process_module_long_interfaces(Globals, HaveReadModuleMap,
+ NeedQualifier, Imports, Ext, IntStatusItem, ImpStatusItem,
!IndirectImports, !ImplIndirectImports, !Module, !IO)
).
@@ -2954,67 +2989,72 @@
%-----------------------------------------------------------------------------%
-process_module_short_interfaces_and_impls_transitively(ReadModules,
- Imports, Ext, IntStatusItem, ImpStatusItem, !Module, !IO) :-
- process_module_short_interfaces_transitively(ReadModules, Imports, Ext,
- IntStatusItem, ImpStatusItem, [], ImpIndirectImports, !Module, !IO),
+process_module_short_interfaces_and_impls_transitively(Globals,
+ HaveReadModuleMap, Imports, Ext, IntStatusItem, ImpStatusItem,
+ !Module, !IO) :-
+ process_module_short_interfaces_transitively(Globals, HaveReadModuleMap,
+ Imports, Ext, IntStatusItem, ImpStatusItem, [], ImpIndirectImports,
+ !Module, !IO),
(
ImpIndirectImports = []
;
ImpIndirectImports = [_ | _],
- process_module_short_interfaces_and_impls_transitively(
- ReadModules, ImpIndirectImports, Ext,
+ process_module_short_interfaces_and_impls_transitively(Globals,
+ HaveReadModuleMap, ImpIndirectImports, Ext,
IntStatusItem, ImpStatusItem, !Module, !IO)
).
-process_module_short_interfaces_transitively(ReadModules, Imports, Ext,
- IntStatusItem, ImpStatusItem, !ImpIndirectImports, !Module, !IO) :-
- process_module_short_interfaces(ReadModules, Imports, Ext,
+process_module_short_interfaces_transitively(Globals, HaveReadModuleMap,
+ Imports, Ext, IntStatusItem, ImpStatusItem, !ImpIndirectImports,
+ !Module, !IO) :-
+ process_module_short_interfaces(Globals, HaveReadModuleMap, Imports, Ext,
IntStatusItem, ImpStatusItem, [], IndirectImports,
!ImpIndirectImports, !Module, !IO),
(
IndirectImports = []
;
IndirectImports = [_ | _],
- process_module_short_interfaces_transitively(ReadModules,
- IndirectImports, Ext, IntStatusItem, ImpStatusItem,
- !ImpIndirectImports, !Module, !IO)
+ process_module_short_interfaces_transitively(Globals,
+ HaveReadModuleMap, IndirectImports, Ext,
+ IntStatusItem, ImpStatusItem, !ImpIndirectImports, !Module, !IO)
).
-process_module_short_interfaces(_, [], _, _, _, !IndirectImports,
+process_module_short_interfaces(_, _, [], _, _, _, !IndirectImports,
!ImpIndirectImports, !Module, !IO).
-process_module_short_interfaces(ReadModules, [Import | Imports], Ext,
- IntStatusItem, ImpStatusItem, !IndirectImports,
+process_module_short_interfaces(Globals, HaveReadModuleMap, [Import | Imports],
+ Ext, IntStatusItem, ImpStatusItem, !IndirectImports,
!ImpIndirectImports, !Module, !IO) :-
- ModIndirectImports0 = !.Module ^ indirect_deps,
+ ModIndirectImports0 = !.Module ^ mai_indirect_deps,
(
% check if the imported module has already been imported
- ( Import = !.Module ^ module_name
- ; list.member(Import, !.Module ^ parent_deps)
- ; list.member(Import, !.Module ^ int_deps)
- ; list.member(Import, !.Module ^ impl_deps)
+ ( Import = !.Module ^ mai_module_name
+ ; list.member(Import, !.Module ^ mai_parent_deps)
+ ; list.member(Import, !.Module ^ mai_int_deps)
+ ; list.member(Import, !.Module ^ mai_impl_deps)
; list.member(Import, ModIndirectImports0)
)
->
- process_module_short_interfaces(ReadModules, Imports, Ext,
- IntStatusItem, ImpStatusItem, !IndirectImports,
+ process_module_short_interfaces(Globals, HaveReadModuleMap, Imports,
+ Ext, IntStatusItem, ImpStatusItem, !IndirectImports,
!ImpIndirectImports, !Module, !IO)
;
- ModItems0 = !.Module ^ items,
- ModError0 = !.Module ^ error,
- maybe_return_timestamp(!.Module ^ maybe_timestamps, ReturnTimestamp),
- maybe_read_module(ReadModules, Import, Ext,
+ maybe_return_timestamp(!.Module ^ mai_maybe_timestamps,
+ ReturnTimestamp),
+ maybe_read_module(Globals, HaveReadModuleMap, Import, Ext,
"Reading short interface for module", do_search,
- ReturnTimestamp, ShortIntItems, ShortIntError,
+ ReturnTimestamp, ShortIntItems0, ShortIntSpecs, ShortIntError,
_ImportFileName, MaybeTimestamp, !IO),
maybe_record_timestamp(Import, Ext, must_be_qualified,
MaybeTimestamp, !Module),
- get_dependencies_int_imp(ShortIntItems, IntImports1, IntUses1,
+ get_dependencies_int_imp(ShortIntItems0, IntImports1, IntUses1,
ImpImports1, ImpUses1),
replace_section_decls(IntStatusItem, ImpStatusItem,
- ShortIntItems, Items),
- maybe_add_int_error(ShortIntError, ModError0, ModError),
+ ShortIntItems0, ShortIntItems),
+
+ module_and_imports_add_items(cord.from_list(ShortIntItems), !Module),
+ module_and_imports_add_specs(ShortIntSpecs, !Module),
+ module_and_imports_add_interface_error(ShortIntError, !Module),
globals.io_lookup_bool_option(detailed_statistics, Statistics, !IO),
maybe_report_stats(Statistics, !IO),
@@ -3022,12 +3062,10 @@
ModIndirectImports = [Import | ModIndirectImports0],
!:IndirectImports = !.IndirectImports ++ IntImports1 ++ IntUses1,
!:ImpIndirectImports = !.ImpIndirectImports ++ ImpImports1 ++ ImpUses1,
- ModItems = ModItems0 ++ cord.from_list(Items),
- !:Module = !.Module ^ indirect_deps := ModIndirectImports,
- !:Module = !.Module ^ items := ModItems,
- !:Module = !.Module ^ error := ModError,
- process_module_short_interfaces(ReadModules, Imports, Ext,
- IntStatusItem, ImpStatusItem, !IndirectImports,
+ !Module ^ mai_indirect_deps := ModIndirectImports,
+
+ process_module_short_interfaces(Globals, HaveReadModuleMap, Imports,
+ Ext, IntStatusItem, ImpStatusItem, !IndirectImports,
!ImpIndirectImports, !Module, !IO)
).
@@ -3053,16 +3091,6 @@
Item = Item0
).
-:- pred maybe_add_int_error(module_error::in, module_error::in,
- module_error::out) is det.
-
-maybe_add_int_error(InterfaceError, ModError0, ModError) :-
- ( InterfaceError \= no_module_errors ->
- ModError = some_module_errors
- ;
- ModError = ModError0
- ).
-
%-----------------------------------------------------------------------------%
get_children(Items, IncludeDeps) :-
@@ -3400,23 +3428,23 @@
maybe_add_foreign_import_module(ModuleName,
InterfaceItems0, InterfaceItems).
-:- pred init_module_imports(file_name::in, module_name::in, module_name::in,
- list(item)::in, list(module_name)::in, list(module_name)::in,
- list(string)::in, maybe(module_timestamps)::in, module_imports::out)
- is det.
+:- pred init_module_and_imports(file_name::in,
+ module_name::in, module_name::in, list(item)::in, list(error_spec)::in,
+ list(module_name)::in, list(module_name)::in, list(string)::in,
+ maybe(module_timestamps)::in, module_and_imports::out) is det.
-init_module_imports(SourceFileName, SourceFileModuleName, ModuleName,
- Items0, PublicChildren, NestedChildren, FactDeps,
+init_module_and_imports(SourceFileName, SourceFileModuleName, ModuleName,
+ Items0, Specs, PublicChildren, NestedChildren, FactDeps,
MaybeTimestamps, Module) :-
- % XXX The reason why init_module_imports is here and not in
+ % XXX The reason why init_module_and_imports is here and not in
% module_imports.m is this call. This should be fixed, preferably
- % by changing the module_imports structure.
+ % by changing the module_and_imports structure.
maybe_add_foreign_import_module(ModuleName, Items0, Items),
ItemsCord = cord.from_list(Items),
- Module = module_imports(SourceFileName, SourceFileModuleName,
+ Module = module_and_imports(SourceFileName, SourceFileModuleName,
ModuleName, [], [], [], [], [], PublicChildren,
NestedChildren, FactDeps, contains_foreign_code_unknown, [],
- contains_no_foreign_export, ItemsCord, no_module_errors,
+ contains_no_foreign_export, ItemsCord, Specs, no_module_errors,
MaybeTimestamps, no_main, dir.this_directory).
:- pred maybe_add_foreign_import_module(module_name::in,
@@ -4337,22 +4365,23 @@
maybe_return_timestamp(no, do_not_return_timestamp).
:- pred maybe_record_timestamp(module_name::in, string::in, need_qualifier::in,
- maybe(timestamp)::in, module_imports::in, module_imports::out) is det.
+ maybe(timestamp)::in, module_and_imports::in, module_and_imports::out)
+ is det.
-maybe_record_timestamp(ModuleName, Suffix, NeedQualifier,
- MaybeTimestamp, !Module) :-
+maybe_record_timestamp(ModuleName, Suffix, NeedQualifier, MaybeTimestamp,
+ !Module) :-
(
- !.Module ^ maybe_timestamps = yes(Timestamps0),
+ !.Module ^ mai_maybe_timestamps = yes(Timestamps0),
(
MaybeTimestamp = yes(Timestamp),
TimestampInfo = module_timestamp(Suffix, Timestamp, NeedQualifier),
map.set(Timestamps0, ModuleName, TimestampInfo, Timestamps),
- !:Module = !.Module ^ maybe_timestamps := yes(Timestamps)
+ !Module ^ mai_maybe_timestamps := yes(Timestamps)
;
MaybeTimestamp = no
)
;
- !.Module ^ maybe_timestamps = no
+ !.Module ^ mai_maybe_timestamps = no
).
%-----------------------------------------------------------------------------%
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.297
diff -u -b -r1.297 prog_io.m
--- compiler/prog_io.m 3 Dec 2008 05:06:03 -0000 1.297
+++ compiler/prog_io.m 22 Jul 2009 04:10:31 -0000
@@ -74,9 +74,9 @@
---> do_return_timestamp
; do_not_return_timestamp.
- % read_module(OpenFile, FileName, DefaultModuleName, ReturnTimestamp,
- % MaybeFileInfo, ActualModuleName, Program, Specs, Error,
- % MaybeModuleTimestamp, !IO):
+ % actually_read_module(OpenFile, FileName, DefaultModuleName,
+ % ReturnTimestamp, MaybeFileInfo, ActualModuleName, Items,
+ % Specs, Error, MaybeModuleTimestamp, !IO):
%
% Reads and parses the file opened by OpenFile using the default module
% name DefaultModuleName. If ReturnTimestamp is `yes', attempt to return
@@ -87,24 +87,24 @@
% directory name) returned by OpenFile. ActualModuleName is the module name
% specified in the `:- module' declaration, if any, or the
% DefaultModuleName if there is no `:- module' declaration.
- % Specs is a list of warning/error messages. Program is the parse tree.
+ % Specs is a list of warning/error messages. Items is the parse tree.
%
-:- pred read_module(open_file(FileInfo)::in(open_file),
+:- pred actually_read_module(open_file(FileInfo)::in(open_file),
module_name::in, maybe_return_timestamp::in, maybe(FileInfo)::out,
module_name::out, list(item)::out, list(error_spec)::out,
module_error::out, maybe(io.res(timestamp))::out, io::di, io::uo) is det.
-:- pred read_module_if_changed(open_file(FileInfo)::in(open_file),
+:- pred actually_read_module_if_changed(open_file(FileInfo)::in(open_file),
module_name::in, timestamp::in, maybe(FileInfo)::out, module_name::out,
list(item)::out, list(error_spec)::out, module_error::out,
maybe(io.res(timestamp))::out, io::di, io::uo) is det.
- % Same as read_module, but use intermod_directories instead of
+ % Same as actually_read_module, but use intermod_directories instead of
% search_directories when searching for the file.
% Also report an error if the actual module name doesn't match
% the expected module name.
%
-:- pred read_opt_file(file_name::in, module_name::in, list(item)::out,
+:- pred actually_read_opt_file(file_name::in, module_name::in, list(item)::out,
list(error_spec)::out, module_error::out, io::di, io::uo) is det.
% check_module_has_expected_name(FileName, ExpectedName, ActualName):
@@ -215,21 +215,24 @@
%-----------------------------------------------------------------------------%
-read_module(OpenFile, DefaultModuleName, ReturnTimestamp, FileData,
+actually_read_module(OpenFile, DefaultModuleName, ReturnTimestamp, FileData,
ModuleName, Items, Specs, Error, MaybeModuleTimestamp, !IO) :-
- read_module_2(OpenFile, DefaultModuleName, no, ReturnTimestamp,
+ actually_read_module_2(OpenFile, DefaultModuleName, no, ReturnTimestamp,
FileData, ModuleName, Items, Specs, Error, MaybeModuleTimestamp, !IO).
-read_module_if_changed(OpenFile, DefaultModuleName, OldTimestamp, FileData,
- ModuleName, Items, Specs, Error, MaybeModuleTimestamp, !IO) :-
- read_module_2(OpenFile, DefaultModuleName, yes(OldTimestamp),
+actually_read_module_if_changed(OpenFile, DefaultModuleName, OldTimestamp,
+ FileData, ModuleName, Items, Specs, Error, MaybeModuleTimestamp,
+ !IO) :-
+ actually_read_module_2(OpenFile, DefaultModuleName, yes(OldTimestamp),
do_return_timestamp,
FileData, ModuleName, Items, Specs, Error,MaybeModuleTimestamp, !IO).
-read_opt_file(FileName, DefaultModuleName, Items, Specs, Error, !IO) :-
+actually_read_opt_file(FileName, DefaultModuleName, Items, Specs, Error,
+ !IO) :-
globals.io_lookup_accumulating_option(intermod_directories, Dirs, !IO),
- read_module_2(search_for_file(Dirs, FileName), DefaultModuleName, no,
- do_not_return_timestamp, _, ModuleName, Items, Specs, Error, _, !IO),
+ actually_read_module_2(search_for_file(Dirs, FileName), DefaultModuleName,
+ no, do_not_return_timestamp, _, ModuleName, Items, Specs, Error, _,
+ !IO),
check_module_has_expected_name(FileName, DefaultModuleName, ModuleName,
!IO).
@@ -252,13 +255,13 @@
% and then reverse them afterwards. (Using difference lists would require
% late-input modes.)
%
-:- pred read_module_2(open_file(T)::in(open_file), module_name::in,
+:- pred actually_read_module_2(open_file(T)::in(open_file), module_name::in,
maybe(timestamp)::in, maybe_return_timestamp::in, maybe(T)::out,
module_name::out, list(item)::out, list(error_spec)::out,
module_error::out, maybe(io.res(timestamp))::out, io::di, io::uo) is det.
-read_module_2(OpenFile, DefaultModuleName, MaybeOldTimestamp, ReturnTimestamp,
- MaybeFileData, ModuleName, Items, Specs, Error,
+actually_read_module_2(OpenFile, DefaultModuleName, MaybeOldTimestamp,
+ ReturnTimestamp, MaybeFileData, ModuleName, Items, Specs, Error,
MaybeModuleTimestamp, !IO) :-
io.input_stream(OldInputStream, !IO),
OpenFile(OpenResult, !IO),
@@ -287,7 +290,7 @@
% XXX Currently smart recompilation won't work
% if ModuleName \= DefaultModuleName.
% In that case, smart recompilation will be disabled
- % and read_module should never be passed an old timestamp.
+ % and actually_read_module should never be passed an old timestamp.
ModuleName = DefaultModuleName,
Items = [],
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.129
diff -u -b -r1.129 purity.m
--- compiler/purity.m 11 Jun 2009 07:00:18 -0000 1.129
+++ compiler/purity.m 21 Jul 2009 04:42:32 -0000
@@ -146,7 +146,8 @@
% would cause problems for later passes (if so, we stop compilation after
% this pass).
%
-:- pred puritycheck(bool::in, bool::out, module_info::in, module_info::out,
+:- pred puritycheck_module(bool::in, bool::out,
+ module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
% Rerun purity checking on a procedure after an optimization pass has
@@ -209,7 +210,7 @@
% Public Predicates
%
-puritycheck(FoundTypeError, PostTypecheckError, !ModuleInfo, !Specs) :-
+puritycheck_module(FoundTypeError, PostTypecheckError, !ModuleInfo, !Specs) :-
module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_bool_option(Globals, statistics, Statistics),
globals.lookup_bool_option(Globals, verbose, Verbose),
Index: compiler/read_modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/read_modules.m,v
retrieving revision 1.1
diff -u -b -r1.1 read_modules.m
--- compiler/read_modules.m 21 Jul 2008 03:10:13 -0000 1.1
+++ compiler/read_modules.m 22 Jul 2009 09:28:40 -0000
@@ -14,8 +14,10 @@
:- interface.
:- import_module libs.file_util.
+:- import_module libs.globals.
:- import_module libs.timestamp.
:- import_module mdbcomp.prim_data.
+:- import_module parse_tree.error_util.
:- import_module parse_tree.file_names.
:- import_module parse_tree.module_imports.
:- import_module parse_tree.prog_item.
@@ -32,18 +34,20 @@
% recompilation_check.m records each file read to avoid reading it again.
% The string is the suffix of the file name.
%
-:- type read_modules == map(pair(module_name, string), read_module).
+:- type have_read_module_map ==
+ map(pair(module_name, string), have_read_module).
-:- type read_module
- ---> read_module(
+:- type have_read_module
+ ---> have_read_module(
module_timestamp,
list(item),
+ list(error_spec),
module_error,
file_name
).
- % read_module(ModuleName, Extension, Descr, Search, ReturnTimestamp,
- % Items, Error, SourceFileName, MaybeTimestamp):
+ % read_module(Globals, ModuleName, Extension, Descr, Search,
+ % ReturnTimestamp, Items, Specs, Error, SourceFileName, MaybeTimestamp):
%
% Given a module name and a file extension (e.g. `.m', `.int', or `int2'),
% read in the list of items in that file.
@@ -62,12 +66,13 @@
% N.B. This reads a module given the module name. If you want to read
% a module given the file name, use `read_module_from_file'.
%
-:- pred read_module(module_name::in, string::in, string::in, maybe_search::in,
- maybe_return_timestamp::in, list(item)::out, module_error::out,
- file_name::out, maybe(timestamp)::out, io::di, io::uo) is det.
+:- pred read_module(globals::in, module_name::in, string::in, string::in,
+ maybe_search::in, maybe_return_timestamp::in, list(item)::out,
+ list(error_spec)::out, module_error::out, file_name::out,
+ maybe(timestamp)::out, io::di, io::uo) is det.
- % read_module_if_changed(ModuleName, Extension, Descr, Search,
- % OldTimestamp, Items, Error, SourceFileName, MaybeTimestamp):
+ % read_module_if_changed(Globals, ModuleName, Extension, Descr, Search,
+ % OldTimestamp, Items, Specs, Error, SourceFileName, MaybeTimestamp):
%
% If the timestamp of the file specified by the given module name and
% file extension is newer than OldTimestamp, read the file, returning
@@ -78,19 +83,20 @@
% `yes(OldTimestamp)'. If the file could not be read, MaybeTimestamp
% will be `no'.
%
-:- pred read_module_if_changed(module_name::in, string::in, string::in,
- maybe_search::in, timestamp::in, list(item)::out, module_error::out,
- file_name::out, maybe(timestamp)::out, io::di, io::uo) is det.
+:- pred read_module_if_changed(globals::in, module_name::in,
+ string::in, string::in, maybe_search::in, timestamp::in, list(item)::out,
+ list(error_spec)::out, module_error::out, file_name::out,
+ maybe(timestamp)::out, io::di, io::uo) is det.
- % Similar to read_mod, but doesn't return error messages.
+ % Similar to read_module, but doesn't return error messages.
%
-:- pred read_module_ignore_errors(module_name::in, string::in, string::in,
- maybe_search::in, maybe_return_timestamp::in, list(item)::out,
- module_error::out, file_name::out, maybe(timestamp)::out, io::di, io::uo)
- is det.
+:- pred read_module_ignore_errors(globals::in, module_name::in,
+ string::in, string::in, maybe_search::in, maybe_return_timestamp::in,
+ list(item)::out, module_error::out, file_name::out, maybe(timestamp)::out,
+ io::di, io::uo) is det.
% read_module_from_file(SourceFileName, Extension, Descr, Search,
- % ReturnTimestamp, Items, Error, ModuleName, MaybeTimestamp):
+ % ReturnTimestamp, Items, Specs, Error, ModuleName, MaybeTimestamp):
%
% Given a file name and a file extension (e.g. `.m', `.int', or `int2'),
% read in the list of items in that file.
@@ -105,24 +111,26 @@
%
:- pred read_module_from_file(file_name::in, string::in, string::in,
maybe_search::in, maybe_return_timestamp::in, list(item)::out,
- module_error::out, module_name::out, maybe(timestamp)::out, io::di, io::uo)
- is det.
+ list(error_spec)::out, module_error::out, module_name::out,
+ maybe(timestamp)::out, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
-:- pred maybe_read_module(read_modules::in, module_name::in, string::in,
- string::in, maybe_search::in, maybe_return_timestamp::in, list(item)::out,
+:- pred maybe_read_module(globals::in, have_read_module_map::in,
+ module_name::in, string::in, string::in, maybe_search::in,
+ maybe_return_timestamp::in, list(item)::out, list(error_spec)::out,
module_error::out, file_name::out, maybe(timestamp)::out, io::di, io::uo)
is det.
- % find_read_module(ReadModules, ModuleName, Suffix, ReturnTimestamp,
- % Items, MaybeTimestamp, Error, FileName)
+ % find_read_module(HaveReadModuleMap, ModuleName, Suffix,
+ % ReturnTimestamp, Items, Specs, Error, FileName, MaybeTimestamp)
%
% Check whether a file was read during recompilation checking.
%
-:- pred find_read_module(read_modules::in, module_name::in, string::in,
- maybe_return_timestamp::in, list(item)::out, maybe(timestamp)::out,
- module_error::out, file_name::out) is semidet.
+:- pred find_read_module(have_read_module_map::in, module_name::in,
+ string::in, maybe_return_timestamp::in, list(item)::out,
+ list(error_spec)::out, module_error::out,
+ file_name::out, maybe(timestamp)::out) is semidet.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -144,29 +152,32 @@
---> ignore_errors
; do_not_ignore_errors.
-read_module(ModuleName, Extension, Descr, Search, ReturnTimestamp,
- Items, Error, FileName, MaybeTimestamp, !IO) :-
- do_read_module(do_not_ignore_errors, ModuleName, Extension, Descr, Search,
- no, ReturnTimestamp, Items, Error, FileName, MaybeTimestamp, !IO).
-
-read_module_if_changed(ModuleName, Extension, Descr, Search, OldTimestamp,
- Items, Error, FileName, MaybeTimestamp, !IO) :-
- do_read_module(do_not_ignore_errors, ModuleName, Extension, Descr, Search,
- yes(OldTimestamp), do_return_timestamp, Items, Error,
+read_module(Globals, ModuleName, Extension, Descr, Search, ReturnTimestamp,
+ Items, Specs, Error, FileName, MaybeTimestamp, !IO) :-
+ do_read_module(Globals, do_not_ignore_errors, ModuleName, Extension,
+ Descr, Search, no, ReturnTimestamp, Items, Specs, Error,
FileName, MaybeTimestamp, !IO).
-read_module_ignore_errors(ModuleName, Extension, Descr, Search,
+read_module_if_changed(Globals, ModuleName, Extension, Descr, Search,
+ OldTimestamp, Items, Specs, Error, FileName, MaybeTimestamp, !IO) :-
+ do_read_module(Globals, do_not_ignore_errors, ModuleName, Extension,
+ Descr, Search, yes(OldTimestamp), do_return_timestamp, Items, Specs,
+ Error, FileName, MaybeTimestamp, !IO).
+
+read_module_ignore_errors(Globals, ModuleName, Extension, Descr, Search,
ReturnTimestamp, Items, Error, FileName, MaybeTimestamp, !IO) :-
- do_read_module(ignore_errors, ModuleName, Extension, Descr, Search,
- no, ReturnTimestamp, Items, Error, FileName, MaybeTimestamp, !IO).
+ do_read_module(Globals, ignore_errors, ModuleName, Extension,
+ Descr, Search, no, ReturnTimestamp, Items, _Specs, Error,
+ FileName, MaybeTimestamp, !IO).
-:- pred do_read_module(maybe_ignore_errors::in, module_name::in,
+:- pred do_read_module(globals::in, maybe_ignore_errors::in, module_name::in,
string::in, string::in, maybe_search::in, maybe(timestamp)::in,
- maybe_return_timestamp::in, list(item)::out, module_error::out,
- file_name::out, maybe(timestamp)::out, io::di, io::uo) is det.
+ maybe_return_timestamp::in, list(item)::out, list(error_spec)::out,
+ module_error::out, file_name::out, maybe(timestamp)::out, io::di, io::uo)
+ is det.
-do_read_module(IgnoreErrors, ModuleName, Extension, Descr, Search,
- MaybeOldTimestamp, ReturnTimestamp, Items, Error, FileName,
+do_read_module(Globals, IgnoreErrors, ModuleName, Extension, Descr, Search,
+ MaybeOldTimestamp, ReturnTimestamp, Items, Specs, Error, FileName,
MaybeTimestamp, !IO) :-
(
Search = do_search,
@@ -203,13 +214,13 @@
),
(
MaybeOldTimestamp = yes(OldTimestamp),
- prog_io.read_module_if_changed(OpenFile, ModuleName, OldTimestamp,
- MaybeFileName, ActualModuleName, Items, Specs, Error,
+ actually_read_module_if_changed(OpenFile, ModuleName, OldTimestamp,
+ MaybeFileName, ActualModuleName, Items, Specs0, Error,
MaybeTimestamp0, !IO)
;
MaybeOldTimestamp = no,
- prog_io.read_module(OpenFile, ModuleName, ReturnTimestamp,
- MaybeFileName, ActualModuleName, Items, Specs, Error,
+ actually_read_module(OpenFile, ModuleName, ReturnTimestamp,
+ MaybeFileName, ActualModuleName, Items, Specs0, Error,
MaybeTimestamp0, !IO)
),
@@ -225,6 +236,7 @@
check_timestamp(FileName0, MaybeTimestamp0, MaybeTimestamp, !IO),
(
IgnoreErrors = ignore_errors,
+ Specs = [], % override Specs0
(
Error = fatal_module_errors,
Items = []
@@ -238,23 +250,26 @@
(
Error = fatal_module_errors,
maybe_write_string(VeryVerbose, "fatal error(s).\n", !IO),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals,
+ Specs0, Specs, !IO),
io.set_exit_status(1, !IO)
;
Error = some_module_errors,
maybe_write_string(VeryVerbose, "parse error(s).\n", !IO),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals,
+ Specs0, Specs, !IO),
io.set_exit_status(1, !IO)
;
Error = no_module_errors,
- maybe_write_string(VeryVerbose, "successful parse.\n", !IO)
- ),
- globals.io_get_globals(Globals, !IO),
- % XXX _NumWarnings _NumErrors
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors, !IO)
+ maybe_write_string(VeryVerbose, "successful parse.\n", !IO),
+ Specs = Specs0
+ )
).
read_module_from_file(FileName, Extension, Descr, Search, ReturnTimestamp,
- Items, Error, ModuleName, MaybeTimestamp, !IO) :-
- globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+ Items, Specs, Error, ModuleName, MaybeTimestamp, !IO) :-
+ globals.io_get_globals(Globals, !IO),
+ globals.lookup_bool_option(Globals, very_verbose, VeryVerbose),
maybe_write_string(VeryVerbose, "% ", !IO),
maybe_write_string(VeryVerbose, Descr, !IO),
maybe_write_string(VeryVerbose, " `", !IO),
@@ -270,31 +285,33 @@
file_name_to_module_name(BaseFileName, DefaultModuleName),
(
Search = do_search,
- globals.io_lookup_accumulating_option(search_directories,
- SearchDirs, !IO)
+ globals.lookup_accumulating_option(Globals, search_directories,
+ SearchDirs)
;
Search = do_not_search,
SearchDirs = [dir.this_directory]
),
OpenFile = search_for_file(SearchDirs, FullFileName),
- prog_io.read_module(OpenFile, DefaultModuleName, ReturnTimestamp,
- _, ModuleName, Items, Specs, Error, MaybeTimestamp0, !IO),
+ actually_read_module(OpenFile, DefaultModuleName, ReturnTimestamp,
+ _, ModuleName, Items, Specs0, Error, MaybeTimestamp0, !IO),
check_timestamp(FullFileName, MaybeTimestamp0, MaybeTimestamp, !IO),
(
Error = fatal_module_errors,
maybe_write_string(VeryVerbose, "fatal error(s).\n", !IO),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals, Specs0, Specs,
+ !IO),
io.set_exit_status(1, !IO)
;
Error = some_module_errors,
maybe_write_string(VeryVerbose, "parse error(s).\n", !IO),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals, Specs0, Specs,
+ !IO),
io.set_exit_status(1, !IO)
;
Error = no_module_errors,
- maybe_write_string(VeryVerbose, "successful parse.\n", !IO)
- ),
- globals.io_get_globals(Globals, !IO),
- % XXX _NumWarnings _NumErrors
- write_error_specs(Specs, Globals, 0, _NumWarnings, 0, _NumErrors, !IO).
+ maybe_write_string(VeryVerbose, "successful parse.\n", !IO),
+ Specs = Specs0
+ ).
:- pred check_timestamp(file_name::in, maybe(io.res(timestamp))::in,
maybe(timestamp)::out, io::di, io::uo) is det.
@@ -321,25 +338,30 @@
%-----------------------------------------------------------------------------%
-maybe_read_module(ReadModules, ModuleName, Extension, Descr, Search,
- ReturnTimestamp, Items, Error, FileName, MaybeTimestamp, !IO) :-
- (
- find_read_module(ReadModules, ModuleName, Extension, ReturnTimestamp,
- ItemsPrime, MaybeTimestampPrime, ErrorPrime, FileNamePrime)
+maybe_read_module(Globals, HaveReadModuleMap, ModuleName, Extension, Descr,
+ Search, ReturnTimestamp, Items, Specs, Error, FileName, MaybeTimestamp,
+ !IO) :-
+ (
+ find_read_module(HaveReadModuleMap, ModuleName, Extension,
+ ReturnTimestamp, ItemsPrime, SpecsPrime, ErrorPrime,
+ FileNamePrime, MaybeTimestampPrime)
->
Error = ErrorPrime,
Items = ItemsPrime,
+ Specs = SpecsPrime,
MaybeTimestamp = MaybeTimestampPrime,
FileName = FileNamePrime
;
- read_module(ModuleName, Extension, Descr, Search, ReturnTimestamp,
- Items, Error, FileName, MaybeTimestamp, !IO)
+ read_module(Globals, ModuleName, Extension, Descr, Search,
+ ReturnTimestamp, Items, Specs, Error, FileName, MaybeTimestamp,
+ !IO)
).
-find_read_module(ReadModules, ModuleName, Suffix, ReturnTimestamp, Items,
- MaybeTimestamp, Error, FileName) :-
- map.search(ReadModules, ModuleName - Suffix, ReadModule),
- ReadModule = read_module(ModuleTimestamp, Items, Error, FileName),
+find_read_module(HaveReadModuleMap, ModuleName, Suffix, ReturnTimestamp,
+ Items, Specs, Error, FileName, MaybeTimestamp) :-
+ map.search(HaveReadModuleMap, ModuleName - Suffix, HaveReadModule),
+ HaveReadModule = have_read_module(ModuleTimestamp, Items, Specs, Error,
+ FileName),
(
ReturnTimestamp = do_return_timestamp,
ModuleTimestamp = module_timestamp(_, Timestamp, _),
Index: compiler/recompilation.check.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.check.m,v
retrieving revision 1.46
diff -u -b -r1.46 recompilation.check.m
--- compiler/recompilation.check.m 2 Dec 2008 04:30:25 -0000 1.46
+++ compiler/recompilation.check.m 24 Jul 2009 06:29:05 -0000
@@ -17,6 +17,7 @@
:- interface.
:- import_module libs.file_util.
+:- import_module libs.globals.
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.read_modules.
@@ -37,7 +38,7 @@
:- inst find_timestamp_file_names ==
(pred(in, out, di, uo) is det).
- % should_recompile(ModuleName, FindTargetFiles,
+ % should_recompile(Globals, ModuleName, FindTargetFiles,
% FindTimestampFiles, ModulesToRecompile, ReadModules)
%
% Process the `.used' files for the given module and all its
@@ -51,10 +52,11 @@
% recompilation checking, returned to avoid rereading them
% if recompilation is required.
%
-:- pred should_recompile(module_name::in,
+:- pred should_recompile(globals::in, module_name::in,
find_target_file_names::in(find_target_file_names),
find_timestamp_file_names::in(find_timestamp_file_names),
- modules_to_recompile::out, read_modules::out, io::di, io::uo) is det.
+ modules_to_recompile::out, have_read_module_map::out, io::di, io::uo)
+ is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -65,7 +67,6 @@
:- import_module hlds.hlds_pred. % for field_access_function_name,
% type pred_id.
:- import_module libs.compiler_util.
-:- import_module libs.globals.
:- import_module libs.options.
:- import_module libs.timestamp.
:- import_module parse_tree.error_util.
@@ -97,25 +98,27 @@
%-----------------------------------------------------------------------------%
-should_recompile(ModuleName, FindTargetFiles, FindTimestampFiles,
- Info ^ modules_to_recompile, Info ^ read_modules, !IO) :-
+should_recompile(Globals, ModuleName, FindTargetFiles, FindTimestampFiles,
+ Info ^ rci_modules_to_recompile, Info ^ rci_have_read_module_map,
+ !IO) :-
globals.io_lookup_bool_option(find_all_recompilation_reasons,
FindAll, !IO),
Info0 = recompilation_check_info(ModuleName, no, [], map.init,
init_item_id_set(map.init, map.init, map.init),
set.init, some_modules([]), FindAll, []),
- should_recompile_2(no, FindTargetFiles, FindTimestampFiles, ModuleName,
- Info0, Info, !IO).
+ should_recompile_2(Globals, no, FindTargetFiles, FindTimestampFiles,
+ ModuleName, Info0, Info, !IO).
-:- pred should_recompile_2(bool::in,
+:- pred should_recompile_2(globals::in, bool::in,
find_target_file_names::in(find_target_file_names),
- find_timestamp_file_names::in(find_timestamp_file_names),
- module_name::in, recompilation_check_info::in,
- recompilation_check_info::out, io::di, io::uo) is det.
+ find_timestamp_file_names::in(find_timestamp_file_names), module_name::in,
+ recompilation_check_info::in, recompilation_check_info::out,
+ io::di, io::uo) is det.
-should_recompile_2(IsSubModule, FindTargetFiles, FindTimestampFiles,
+should_recompile_2(Globals, IsSubModule, FindTargetFiles, FindTimestampFiles,
ModuleName, !Info, !IO) :-
- !:Info = (!.Info ^ module_name := ModuleName) ^ sub_modules := [],
+ !Info ^ rci_module_name := ModuleName,
+ !Info ^ rci_sub_modules := [],
module_name_to_file_name(ModuleName, ".used", do_not_create_dirs,
UsageFileName, !IO),
io.open_input(UsageFileName, MaybeVersionStream, !IO),
@@ -124,12 +127,12 @@
io.set_input_stream(VersionStream0, OldInputStream, !IO),
promise_equivalent_solutions [Result, !:IO] (
- should_recompile_3_try(IsSubModule, FindTimestampFiles,
+ should_recompile_3_try(Globals, IsSubModule, FindTimestampFiles,
!.Info, Result, !IO)
),
(
Result = succeeded(!:Info),
- Reasons = !.Info ^ recompilation_reasons
+ Reasons = !.Info ^ rci_recompilation_reasons
;
Result = failed,
unexpected(this_file, "should_recompile_2")
@@ -158,21 +161,22 @@
io.set_input_stream(OldInputStream, VersionStream, !IO),
io.close_input(VersionStream, !IO),
- ModulesToRecompile = !.Info ^ modules_to_recompile,
+ ModulesToRecompile = !.Info ^ rci_modules_to_recompile,
(
ModulesToRecompile = all_modules
;
ModulesToRecompile = some_modules(_),
- !:Info = !.Info ^ is_inline_sub_module := yes,
+ !Info ^ rci_is_inline_sub_module := yes,
list.foldl2(
- should_recompile_2(yes, FindTargetFiles, FindTimestampFiles),
- !.Info ^ sub_modules, !Info, !IO)
+ should_recompile_2(Globals, yes, FindTargetFiles,
+ FindTimestampFiles),
+ !.Info ^ rci_sub_modules, !Info, !IO)
)
;
MaybeVersionStream = error(_),
write_recompilation_message(
write_not_found_reasons_message(UsageFileName, ModuleName), !IO),
- !:Info = !.Info ^ modules_to_recompile := all_modules
+ !Info ^ rci_modules_to_recompile := all_modules
).
:- pred write_not_recompiling_message(module_name::in, io::di, io::uo) is det.
@@ -196,22 +200,23 @@
[words("file"), quote(UsageFileName), words("not found."), nl]),
write_recompile_reason(ModuleName, Reason, !IO).
-:- pred should_recompile_3_try(bool::in,
+:- pred should_recompile_3_try(globals::in, bool::in,
find_timestamp_file_names::in(find_timestamp_file_names),
recompilation_check_info::in,
exception_result(recompilation_check_info)::out,
io::di, io::uo) is cc_multi.
-should_recompile_3_try(IsSubModule, FindTargetFiles, Info, Result, !IO) :-
- try_io(should_recompile_3(IsSubModule, FindTargetFiles, Info),
+should_recompile_3_try(Globals, IsSubModule, FindTargetFiles, Info,
+ Result, !IO) :-
+ try_io(should_recompile_3(Globals, IsSubModule, FindTargetFiles, Info),
Result, !IO).
-:- pred should_recompile_3(bool::in,
+:- pred should_recompile_3(globals::in, bool::in,
find_target_file_names::in(find_target_file_names),
recompilation_check_info::in, recompilation_check_info::out,
io::di, io::uo) is det.
-should_recompile_3(IsSubModule, FindTargetFiles, !Info, !IO) :-
+should_recompile_3(Globals, IsSubModule, FindTargetFiles, !Info, !IO) :-
% WARNING: any exceptions thrown before the sub_modules field is set
% in the recompilation_check_info must set the modules_to_recompile field
% to `all', or else the nested sub-modules will not be checked
@@ -251,17 +256,18 @@
;
IsSubModule = no,
% If the module has changed, recompile.
- ModuleName = !.Info ^ module_name,
- read_module_if_changed(ModuleName, ".m", "Reading module", do_search,
- RecordedTimestamp, Items, Error, FileName, MaybeNewTimestamp, !IO),
+ ModuleName = !.Info ^ rci_module_name,
+ read_module_if_changed(Globals, ModuleName, ".m", "Reading module",
+ do_search, RecordedTimestamp, Items, Specs, Error, FileName,
+ MaybeNewTimestamp, !IO),
(
MaybeNewTimestamp = yes(NewTimestamp),
NewTimestamp \= RecordedTimestamp
->
record_read_file(ModuleName,
ModuleTimestamp ^ timestamp := NewTimestamp,
- Items, Error, FileName, !Info),
- !:Info = !.Info ^ modules_to_recompile := all_modules,
+ Items, Specs, Error, FileName, !Info),
+ !Info ^ rci_modules_to_recompile := all_modules,
record_recompilation_reason(recompile_for_module_changed(FileName),
!Info)
;
@@ -269,11 +275,15 @@
; MaybeNewTimestamp = no
)
->
- Reason = recompile_for_file_error(FileName,
- [words("error reading file"), quote(FileName), suffix("."),
- nl]),
+ % We are throwing away Specs, even though some of its elements
+ % could illuminate the cause of the problem. XXX Is this OK?
+ Pieces = [words("error reading file"), quote(FileName),
+ suffix("."), nl],
+ Reason = recompile_for_file_error(FileName, Pieces),
throw_syntax_error(Reason, !.Info)
;
+ % We are throwing away Specs. Since it should be a repeat of the
+ % errors we saw when the file was first read in, this should be OK.
true
)
),
@@ -290,7 +300,7 @@
),
SubModuleTerms, SubModules)
->
- !:Info = !.Info ^ sub_modules := SubModules
+ !Info ^ rci_sub_modules := SubModules
;
Reason1 = recompile_for_syntax_error(get_term_context(SubModulesTerm),
"error in sub_modules term"),
@@ -298,14 +308,14 @@
),
% Check whether the output files are present and up-to-date.
- FindTargetFiles(!.Info ^ module_name, TargetFiles, !IO),
+ FindTargetFiles(!.Info ^ rci_module_name, TargetFiles, !IO),
list.foldl2(require_recompilation_if_not_up_to_date(RecordedTimestamp),
TargetFiles, !Info, !IO),
% Read in the used items, used for checking for ambiguities with new items.
read_term_check_for_error_or_eof(!.Info, "used items", UsedItemsTerm, !IO),
parse_used_items(!.Info, UsedItemsTerm, UsedItems),
- !:Info = !.Info ^ used_items := UsedItems,
+ !Info ^ rci_used_items := UsedItems,
read_term_check_for_error_or_eof(!.Info, "used classes",
UsedClassesTerm, !IO),
@@ -314,13 +324,13 @@
UsedClassTerms, _),
list.map(parse_name_and_arity_to_used, UsedClassTerms, UsedClasses)
->
- !:Info = !.Info ^ used_typeclasses := set.list_to_set(UsedClasses)
+ !Info ^ rci_used_typeclasses := set.list_to_set(UsedClasses)
;
Reason3 = recompile_for_syntax_error(get_term_context(UsedClassesTerm),
"error in used_typeclasses term"),
throw_syntax_error(Reason3, !.Info)
),
- check_imported_modules(!Info, !IO).
+ check_imported_modules(Globals, !Info, !IO).
:- pred require_recompilation_if_not_up_to_date(timestamp::in, file_name::in,
recompilation_check_info::in, recompilation_check_info::out,
@@ -614,18 +624,19 @@
% compilation has changed, and if so whether the items have changed
% in a way which should cause a recompilation.
%
-:- pred check_imported_modules(recompilation_check_info::in,
- recompilation_check_info::out, io::di, io::uo) is det.
+:- pred check_imported_modules(globals::in,
+ recompilation_check_info::in, recompilation_check_info::out,
+ io::di, io::uo) is det.
-check_imported_modules(!Info, !IO) :-
+check_imported_modules(Globals, !Info, !IO) :-
parser.read_term(TermResult, !IO),
(
TermResult = term(_, Term),
( Term = term.functor(term.atom("done"), [], _) ->
true
;
- check_imported_module(Term, !Info, !IO),
- check_imported_modules(!Info, !IO)
+ check_imported_module(Globals, Term, !Info, !IO),
+ check_imported_modules(Globals, !Info, !IO)
)
;
TermResult = error(Message, Line),
@@ -645,11 +656,11 @@
throw_syntax_error(Reason, !.Info)
).
-:- pred check_imported_module(term::in,
+:- pred check_imported_module(globals::in, term::in,
recompilation_check_info::in, recompilation_check_info::out,
io::di, io::uo) is det.
-check_imported_module(Term, !Info, !IO) :-
+check_imported_module(Globals, Term, !Info, !IO) :-
(
Term = term.functor(term.atom("=>"),
[TimestampTerm0, UsedItemsTerm0], _)
@@ -668,33 +679,36 @@
(
% If we're checking a sub-module, don't re-read interface files
% read for other modules checked during this compilation.
- !.Info ^ is_inline_sub_module = yes,
- find_read_module(!.Info ^ read_modules, ImportedModuleName, Suffix,
- do_return_timestamp, ItemsPrime, MaybeNewTimestampPrime,
- ErrorPrime, FileNamePrime)
+ !.Info ^ rci_is_inline_sub_module = yes,
+ find_read_module(!.Info ^ rci_have_read_module_map, ImportedModuleName,
+ Suffix, do_return_timestamp, ItemsPrime, SpecsPrime, ErrorPrime,
+ FileNamePrime, MaybeNewTimestampPrime)
->
Items = ItemsPrime,
- MaybeNewTimestamp = MaybeNewTimestampPrime,
+ Specs = SpecsPrime,
Error = ErrorPrime,
FileName = FileNamePrime,
+ MaybeNewTimestamp = MaybeNewTimestampPrime,
Recorded = bool.yes
;
Recorded = bool.no,
- read_module_if_changed(ImportedModuleName, Suffix,
+ read_module_if_changed(Globals, ImportedModuleName, Suffix,
"Reading interface file for module", do_search, RecordedTimestamp,
- Items, Error, FileName, MaybeNewTimestamp, !IO)
+ Items, Specs, Error, FileName, MaybeNewTimestamp, !IO)
),
(
+ Error = no_module_errors,
+ (
MaybeNewTimestamp = yes(NewTimestamp),
- NewTimestamp \= RecordedTimestamp,
- Error = no_module_errors
+ NewTimestamp \= RecordedTimestamp
->
- ( Recorded = no ->
+ (
+ Recorded = no,
record_read_file(ImportedModuleName,
ModuleTimestamp ^ timestamp := NewTimestamp,
- Items, Error, FileName, !Info)
+ Items, Specs, Error, FileName, !Info)
;
- true
+ Recorded = yes
),
(
MaybeUsedItemsTerm = yes(UsedItemsTerm),
@@ -702,28 +716,36 @@
InterfaceItem = item_module_defn(InterfaceItemModuleDefn),
InterfaceItemModuleDefn =
item_module_defn_info(md_interface, _, _),
- VersionNumberItem = item_module_defn(VersionNumberItemModuleDefn),
+ VersionNumberItem =
+ item_module_defn(VersionNumberItemModuleDefn),
VersionNumberItemModuleDefn =
- item_module_defn_info(md_version_numbers(_, VersionNumbers),
+ item_module_defn_info(
+ md_version_numbers(_, VersionNumbers),
_, _)
->
check_module_used_items(ImportedModuleName, NeedQualifier,
RecordedTimestamp, UsedItemsTerm, VersionNumbers,
OtherItems, !Info)
;
- record_recompilation_reason(recompile_for_module_changed(FileName),
- !Info)
+ record_recompilation_reason(
+ recompile_for_module_changed(FileName), !Info)
)
;
- Error \= no_module_errors
- ->
+ % We are throwing away Specs. Since it should be a repeat of the
+ % errors we saw when the file was first read in, this should be OK.
+ true
+ )
+ ;
+ ( Error = some_module_errors
+ ; Error = fatal_module_errors
+ ),
+ % We are throwing away Specs, even though some of its elements
+ % could illuminate the cause of the problem. XXX Is this OK?
throw_syntax_error(
recompile_for_file_error(FileName,
[words("error reading file"), quote(FileName), suffix("."),
nl]),
!.Info)
- ;
- true
).
:- pred check_module_used_items(module_name::in, need_qualifier::in,
@@ -775,7 +797,7 @@
UsedInstances = set.sorted_list_to_set(
map.sorted_keys(UsedInstanceVersionNumbers)),
- UsedClasses = !.Info ^ used_typeclasses,
+ UsedClasses = !.Info ^ rci_used_typeclasses,
set.difference(set.intersect(UsedClasses, ModuleInstances),
UsedInstances, AddedInstances),
( [AddedInstance | _] = set.to_sorted_list(AddedInstances) ->
@@ -970,7 +992,7 @@
ItemType, SymName, Arity)
->
NeedsCheck = yes,
- UsedItems = !.Info ^ used_items,
+ UsedItems = !.Info ^ rci_used_items,
UsedItemMap = extract_simple_item_set(UsedItems, ItemType),
Name = unqualify_name(SymName),
(
@@ -1039,7 +1061,7 @@
ItemType, SymName, Arity)
)
->
- UsedItems = !.Info ^ used_items,
+ UsedItems = !.Info ^ rci_used_items,
UsedItemMap = extract_pred_or_func_set(UsedItems, ItemType),
Name = unqualify_name(SymName),
( map.search(UsedItemMap, Name, MatchingArityList) ->
@@ -1202,7 +1224,7 @@
check_functor_ambiguities_by_name(NeedQualifier, Name, MatchArity,
ResolvedCtor, !Info) :-
- UsedItems = !.Info ^ used_items,
+ UsedItems = !.Info ^ rci_used_items,
UnqualName = unqualify_name(Name),
UsedCtors = UsedItems ^ functors,
( map.search(UsedCtors, UnqualName, UsedCtorAL) ->
@@ -1295,15 +1317,15 @@
:- type recompilation_check_info
---> recompilation_check_info(
- module_name :: module_name,
- is_inline_sub_module :: bool,
- sub_modules :: list(module_name),
- read_modules :: read_modules,
- used_items :: resolved_used_items,
- used_typeclasses :: set(item_name),
- modules_to_recompile :: modules_to_recompile,
- collect_all_reasons :: bool,
- recompilation_reasons :: list(recompile_reason)
+ rci_module_name :: module_name,
+ rci_is_inline_sub_module :: bool,
+ rci_sub_modules :: list(module_name),
+ rci_have_read_module_map :: have_read_module_map,
+ rci_used_items :: resolved_used_items,
+ rci_used_typeclasses :: set(item_name),
+ rci_modules_to_recompile :: modules_to_recompile,
+ rci_collect_all_reasons :: bool,
+ rci_recompilation_reasons :: list(recompile_reason)
).
:- type recompile_exception
@@ -1317,49 +1339,39 @@
file_name,
list(format_component)
)
-
; recompile_for_output_file_not_up_to_date(
file_name
)
-
; recompile_for_syntax_error(
term.context,
string
)
-
; recompile_for_unreadable_used_items(
list(error_spec)
)
-
; recompile_for_module_changed(
file_name
)
-
; recompile_for_item_ambiguity(
item_id, % new item.
list(item_id) % ambiguous declarations.
)
-
; recompile_for_functor_ambiguity(
sym_name,
arity,
resolved_functor, % new item.
list(resolved_functor) % ambiguous declarations.
)
-
; recompile_for_changed_item(
item_id
)
-
; recompile_for_removed_item(
item_id
)
-
; recompile_for_changed_or_added_instance(
module_name,
item_name % class name
)
-
; recompile_for_removed_instance(
module_name,
item_name % class name
@@ -1369,24 +1381,25 @@
recompilation_check_info::out) is det.
add_module_to_recompile(Module, !Info) :-
- ModulesToRecompile0 = !.Info ^ modules_to_recompile,
+ ModulesToRecompile0 = !.Info ^ rci_modules_to_recompile,
(
ModulesToRecompile0 = all_modules
;
ModulesToRecompile0 = some_modules(Modules0),
- !:Info = !.Info ^ modules_to_recompile :=
- some_modules([Module | Modules0])
+ !Info ^ rci_modules_to_recompile := some_modules([Module | Modules0])
).
-:- pred record_read_file(module_name::in, module_timestamp::in, list(item)::in,
- module_error::in, file_name::in,
+:- pred record_read_file(module_name::in, module_timestamp::in,
+ list(item)::in, list(error_spec)::in, module_error::in, file_name::in,
recompilation_check_info::in, recompilation_check_info::out) is det.
-record_read_file(ModuleName, ModuleTimestamp, Items, Error, FileName, !Info) :-
- Imports0 = !.Info ^ read_modules,
- map.set(Imports0, ModuleName - ModuleTimestamp ^ suffix,
- read_module(ModuleTimestamp, Items, Error, FileName), Imports),
- !:Info = !.Info ^ read_modules := Imports.
+record_read_file(ModuleName, ModuleTimestamp, Items, Specs, Error, FileName,
+ !Info) :-
+ Imports0 = !.Info ^ rci_have_read_module_map,
+ svmap.set(ModuleName - ModuleTimestamp ^ suffix,
+ have_read_module(ModuleTimestamp, Items, Specs, Error, FileName),
+ Imports0, Imports),
+ !Info ^ rci_have_read_module_map := Imports.
%-----------------------------------------------------------------------------%
@@ -1559,10 +1572,13 @@
recompilation_check_info::in, recompilation_check_info::out) is det.
record_recompilation_reason(Reason, !Info) :-
- ( !.Info ^ collect_all_reasons = yes ->
- !:Info = !.Info ^ recompilation_reasons :=
- [Reason | !.Info ^ recompilation_reasons]
+ CollectAllReasons = !.Info ^ rci_collect_all_reasons,
+ (
+ CollectAllReasons = yes,
+ !Info ^ rci_recompilation_reasons :=
+ [Reason | !.Info ^ rci_recompilation_reasons]
;
+ CollectAllReasons = no,
throw(recompile_exception(Reason, !.Info))
).
@@ -1573,13 +1589,13 @@
% If there were syntax errors in a `.used' file written during
% a compilation, all outputs of that compilation are slightly
% suspect, so it's worth entirely redoing the compilation.
- RecompileInfo = Info ^ modules_to_recompile := all_modules,
+ RecompileInfo = Info ^ rci_modules_to_recompile := all_modules,
throw(recompile_exception(Reason, RecompileInfo)).
%-----------------------------------------------------------------------------%
:- func this_file = string.
-this_file = "recompilation.version.m".
+this_file = "recompilation.check.m".
%-----------------------------------------------------------------------------%
Index: compiler/state_var.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/state_var.m,v
retrieving revision 1.27
diff -u -b -r1.27 state_var.m
--- compiler/state_var.m 28 Jul 2008 08:34:19 -0000 1.27
+++ compiler/state_var.m 22 Jul 2009 03:10:39 -0000
@@ -353,6 +353,7 @@
:- import_module char.
:- import_module int.
+:- import_module io.
:- import_module pair.
:- import_module string.
:- import_module svmap.
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.72
diff -u -b -r1.72 stratify.m
--- compiler/stratify.m 21 Jul 2009 04:10:43 -0000 1.72
+++ compiler/stratify.m 22 Jul 2009 17:13:19 -0000
@@ -215,7 +215,7 @@
->
Context = goal_info_get_context(GoalInfo),
ErrorMsg = "call introduces a non-stratified loop.",
- Spec = generate_message(ModuleInfo, ThisPredProcId, Context,
+ Spec = generate_stratify_error(ModuleInfo, ThisPredProcId, Context,
ErrorMsg, ErrorOrWarning),
!:Specs = [Spec | !.Specs]
;
@@ -370,7 +370,7 @@
->
Context = goal_info_get_context(GoalInfo),
ErrorMsg = "call to solutions/2 introduces a non-stratified loop.",
- Spec = generate_message(ModuleInfo, ThisPredProcId, Context,
+ Spec = generate_stratify_error(ModuleInfo, ThisPredProcId, Context,
ErrorMsg, ErrorOrWarning),
!:Specs = [Spec | !.Specs]
;
@@ -387,7 +387,7 @@
->
Context = goal_info_get_context(GoalInfo),
ErrorMsg = Msg ++ " call may introduce a non-stratified loop.",
- Spec = generate_message(ModuleInfo, ThisPredProcId, Context,
+ Spec = generate_stratify_error(ModuleInfo, ThisPredProcId, Context,
ErrorMsg, ErrorOrWarning),
!:Specs = [Spec | !.Specs]
;
@@ -995,10 +995,11 @@
---> is_error
; is_warning.
-:- func generate_message(module_info, pred_proc_id, prog_context, string,
- error_or_warning) = error_spec.
+:- func generate_stratify_error(module_info, pred_proc_id, prog_context,
+ string, error_or_warning) = error_spec.
-generate_message(ModuleInfo, PPId, Context, Message, ErrorOrWarning) = Spec :-
+generate_stratify_error(ModuleInfo, PPId, Context, Message, ErrorOrWarning)
+ = Spec :-
PPIdDescription = describe_one_proc_name_mode(ModuleInfo,
should_not_module_qualify, PPId),
Preamble = [words("In")] ++ PPIdDescription ++ [suffix(":"), nl],
Index: compiler/trans_opt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.53
diff -u -b -r1.53 trans_opt.m
--- compiler/trans_opt.m 5 Sep 2008 03:57:37 -0000 1.53
+++ compiler/trans_opt.m 24 Jul 2009 07:11:17 -0000
@@ -55,6 +55,7 @@
:- interface.
:- import_module hlds.hlds_module.
+:- import_module libs.globals.
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.module_imports.
@@ -69,13 +70,14 @@
%
:- pred write_trans_opt_file(module_info::in, io::di, io::uo) is det.
- % grab_trans_optfiles(ModuleList, !ModuleImports, Error, !IO):
+ % grab_trans_optfiles(Globals, ModuleList, !ModuleImports, Error, !IO):
%
% Add the items from each of the modules in ModuleList.trans_opt to
% the items in ModuleImports.
%
-:- pred grab_trans_opt_files(list(module_name)::in,
- module_imports::in, module_imports::out, bool::out, io::di, io::uo) is det.
+:- pred grab_trans_opt_files(globals::in, list(module_name)::in,
+ module_and_imports::in, module_and_imports::out, bool::out,
+ io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -84,9 +86,9 @@
:- import_module hlds.hlds_pred.
:- import_module libs.file_util.
-:- import_module libs.globals.
:- import_module libs.options.
:- import_module mdbcomp.prim_data.
+:- import_module parse_tree.error_util.
:- import_module parse_tree.file_names.
:- import_module parse_tree.mercury_to_mercury.
:- import_module parse_tree.modules.
@@ -193,28 +195,31 @@
% Read and process the transitive optimization interfaces.
%
-grab_trans_opt_files(TransOptDeps, !Module, FoundError, !IO) :-
- globals.io_lookup_bool_option(verbose, Verbose, !IO),
+grab_trans_opt_files(Globals, TransOptDeps, !Module, FoundError, !IO) :-
+ globals.lookup_bool_option(Globals, verbose, Verbose),
maybe_write_string(Verbose, "% Reading .trans_opt files..\n", !IO),
maybe_flush_output(Verbose, !IO),
- read_trans_opt_files(TransOptDeps, cord.empty, OptItems, no, FoundError,
- !IO),
+ read_trans_opt_files(Globals, TransOptDeps,
+ cord.empty, OptItems, [], OptSpecs, no, FoundError, !IO),
append_pseudo_decl(md_opt_imported, !Module),
- module_imports_get_items(!.Module, Items0),
- Items = Items0 ++ OptItems,
- module_imports_set_items(Items, !Module),
- module_imports_set_error(no_module_errors, !Module),
+ module_and_imports_add_items(OptItems, !Module),
+ module_and_imports_add_specs(OptSpecs, !Module),
+ module_and_imports_set_error(no_module_errors, !Module),
maybe_write_string(Verbose, "% Done.\n", !IO).
-:- pred read_trans_opt_files(list(module_name)::in, cord(item)::in,
- cord(item)::out, bool::in, bool::out, io::di, io::uo) is det.
-
-read_trans_opt_files([], !Items, !Error, !IO).
-read_trans_opt_files([Import | Imports], !Items, !Error, !IO) :-
- globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+:- pred read_trans_opt_files(globals::in, list(module_name)::in,
+ cord(item)::in, cord(item)::out,
+ list(error_spec)::in, list(error_spec)::out,
+ bool::in, bool::out, io::di, io::uo) is det.
+
+read_trans_opt_files(_, [], !Items, !Specs, !Error, !IO).
+read_trans_opt_files(Globals, [Import | Imports], !Items, !Specs, !Error,
+ !IO) :-
+ globals.lookup_bool_option(Globals, very_verbose, VeryVerbose),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals, !Specs, !IO),
maybe_write_string(VeryVerbose,
"% Reading transitive optimization interface for module", !IO),
maybe_write_string(VeryVerbose, " `", !IO),
@@ -224,15 +229,15 @@
maybe_flush_output(VeryVerbose, !IO),
module_name_to_search_file_name(Import, ".trans_opt", FileName, !IO),
- prog_io.read_opt_file(FileName, Import,
- NewItems, Specs, ModuleError, !IO),
-
+ actually_read_opt_file(FileName, Import, NewItems, NewSpecs, NewError,
+ !IO),
maybe_write_string(VeryVerbose, " done.\n", !IO),
-
- intermod.update_error_status(trans_opt_file, FileName, ModuleError,
- Specs, !Error, !IO),
+ !:Specs = NewSpecs ++ !.Specs,
+ intermod.update_error_status(Globals, trans_opt_file, FileName,
+ NewSpecs, !Specs, NewError, !Error),
+ maybe_write_out_errors_no_module(VeryVerbose, Globals, !Specs, !IO),
!:Items = !.Items ++ cord.from_list(NewItems),
- read_trans_opt_files(Imports, !Items, !Error, !IO).
+ read_trans_opt_files(Globals, Imports, !Items, !Specs, !Error, !IO).
%-----------------------------------------------------------------------------%
:- end_module trans_opt.
Index: compiler/write_deps_file.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/write_deps_file.m,v
retrieving revision 1.4
diff -u -b -r1.4 write_deps_file.m
--- compiler/write_deps_file.m 22 May 2009 02:51:21 -0000 1.4
+++ compiler/write_deps_file.m 22 Jul 2009 12:15:14 -0000
@@ -35,7 +35,7 @@
% `.trans_opt' file may depend on. This is set to `no' if the
% dependency list is not available.
%
-:- pred write_dependency_file(module_imports::in, set(module_name)::in,
+:- pred write_dependency_file(module_and_imports::in, set(module_name)::in,
maybe(list(module_name))::in, io::di, io::uo) is det.
% Write out the `.dv' file, using the information collected in the
@@ -102,11 +102,11 @@
%-----------------------------------------------------------------------------%
write_dependency_file(Module, AllDepsSet, MaybeTransOptDeps, !IO) :-
- Module = module_imports(SourceFileName, SourceFileModuleName,
+ Module = module_and_imports(SourceFileName, SourceFileModuleName,
ModuleName, ParentDeps, IntDeps, ImplDeps, IndirectDeps,
_Children, InclDeps, NestedDeps, FactDeps0,
ContainsForeignCode, ForeignImports0, _ContainsForeignExport,
- Items, _Error, _Timestamps, _HasMain, _Dir),
+ Items, _Specs, _Error, _Timestamps, _HasMain, _Dir),
globals.io_lookup_bool_option(verbose, Verbose, !IO),
module_name_to_make_var_name(ModuleName, MakeVarName),
@@ -1099,7 +1099,7 @@
ModulesWithSubModules = list.filter(
(pred(Module::in) is semidet :-
map.lookup(DepsMap, Module, deps(_, ModuleImports)),
- ModuleImports ^ children = [_ | _]
+ ModuleImports ^ mai_children = [_ | _]
), Modules),
io.write_string(DepStream, MakeVarName, !IO),
io.write_string(DepStream, ".parent_mods =", !IO),
@@ -1578,19 +1578,22 @@
select_ok_modules([], _, []).
select_ok_modules([Module | Modules0], DepsMap, Modules) :-
+ select_ok_modules(Modules0, DepsMap, ModulesTail),
map.lookup(DepsMap, Module, deps(_, ModuleImports)),
- module_imports_get_error(ModuleImports, Error),
- ( Error = fatal_module_errors ->
- Modules = Modules1
+ module_and_imports_get_results(ModuleImports, _Items, _Specs, Error),
+ (
+ Error = fatal_module_errors,
+ Modules = ModulesTail
;
- Modules = [Module | Modules1]
+ ( Error = no_module_errors
+ ; Error = some_module_errors
),
- select_ok_modules(Modules0, DepsMap, Modules1).
+ Modules = [Module | ModulesTail]
+ ).
%-----------------------------------------------------------------------------%
- % Find out which modules will generate as external foreign
- % language files.
+ % Find out which modules will generate as external foreign language files.
% We return the module names and file extensions.
%
:- func foreign_modules(list(module_name), deps_map)
@@ -1615,7 +1618,7 @@
module_has_foreign(DepsMap, Module, LangList) :-
map.lookup(DepsMap, Module, deps(_, ModuleImports)),
- ModuleImports ^ has_foreign_code = contains_foreign_code(Langs),
+ ModuleImports ^ mai_has_foreign_code = contains_foreign_code(Langs),
LangList = set.to_sorted_list(Langs).
%-----------------------------------------------------------------------------%
@@ -1644,7 +1647,7 @@
map.lookup(DepsMap, Module, deps(_, ModuleImports)),
% Handle object files for fact tables.
- FactDeps = ModuleImports ^ fact_table_deps,
+ FactDeps = ModuleImports ^ mai_fact_table_deps,
list.length(FactDeps, NumFactDeps),
list.duplicate(NumFactDeps, Module, ModuleList),
assoc_list.from_corresponding_lists(FactDeps, ModuleList, FactTableObjs),
@@ -1653,7 +1656,7 @@
% XXX Currently we only support `C' foreign code.
(
Target = target_asm,
- ModuleImports ^ has_foreign_code = contains_foreign_code(Langs),
+ ModuleImports ^ mai_has_foreign_code = contains_foreign_code(Langs),
set.member(lang_c, Langs)
->
FileName = sym_name_to_string(Module),
@@ -1972,7 +1975,7 @@
(
Intermod = yes,
map.member(DepsMap, _, deps(_, Imports)),
- Imports ^ children = [_ | _]
+ Imports ^ mai_children = [_ | _]
->
% The `.int0' files only need to be installed with
% `--intermodule-optimization'.
@@ -2284,7 +2287,7 @@
get_source_file(DepsMap, ModuleName, FileName) :-
map.lookup(DepsMap, ModuleName, Deps),
Deps = deps(_, ModuleImports),
- module_imports_get_source_file_name(ModuleImports, SourceFileName),
+ module_and_imports_get_source_file_name(ModuleImports, SourceFileName),
( string.remove_suffix(SourceFileName, ".m", SourceFileBase) ->
FileName = SourceFileBase
;
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/fixed
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/log4m
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/mopenssl
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/net
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/posix/samples
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/standalone_c
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing slice
cvs diff: Diffing ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.374
diff -u -b -r1.374 Mmakefile
--- tests/hard_coded/Mmakefile 2 Jul 2009 05:31:08 -0000 1.374
+++ tests/hard_coded/Mmakefile 24 Jul 2009 06:03:16 -0000
@@ -112,7 +112,6 @@
hash_bug \
hash_init_bug \
hash_table_delete \
- hash_table_test \
higher_order_func_test \
higher_order_syntax \
higher_order_syntax2 \
@@ -396,7 +395,9 @@
ifneq "$(filter debug% deep%,$(GRADE))" ""
BIG_DATA_PROGS = \
- big_array_from_list
+ big_array_from_list \
+ hash_table_test \
+ version_hash_table_test2
else
BIG_DATA_PROGS =
endif
@@ -566,7 +567,6 @@
version_array_test \
version_hash_table_delete \
version_hash_table_test \
- version_hash_table_test2 \
write_binary
else
NON_PROFDEEP_PROGS =
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
Index: tests/invalid/bad_finalise_decl.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/bad_finalise_decl.err_exp,v
retrieving revision 1.3
diff -u -b -r1.3 bad_finalise_decl.err_exp
--- tests/invalid/bad_finalise_decl.err_exp 16 Jul 2008 03:30:58 -0000 1.3
+++ tests/invalid/bad_finalise_decl.err_exp 22 Jul 2009 14:57:44 -0000
@@ -1,7 +1,3 @@
-bad_finalise_decl.m:025: Error: `finalise' declaration requires arity, found
-bad_finalise_decl.m:025: i4.
-bad_finalise_decl.m:026: Error: `finalise' declaration specifies a predicate
-bad_finalise_decl.m:026: whose arity is not zero or two: (i5 / 6).
bad_finalise_decl.m:016: Error: `finalise' declaration in module interface.
bad_finalise_decl.m:016: Error: `i2'/2 used in finalise declaration has invalid
bad_finalise_decl.m:016: signature.
@@ -9,3 +5,7 @@
bad_finalise_decl.m:023: signature.
bad_finalise_decl.m:024: Error: `i3'/2 used in finalise declaration does not
bad_finalise_decl.m:024: have a corresponding pred declaration.
+bad_finalise_decl.m:025: Error: `finalise' declaration requires arity, found
+bad_finalise_decl.m:025: i4.
+bad_finalise_decl.m:026: Error: `finalise' declaration specifies a predicate
+bad_finalise_decl.m:026: whose arity is not zero or two: (i5 / 6).
Index: tests/invalid/bad_initialise_decl.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/bad_initialise_decl.err_exp,v
retrieving revision 1.5
diff -u -b -r1.5 bad_initialise_decl.err_exp
--- tests/invalid/bad_initialise_decl.err_exp 16 Jul 2008 03:30:58 -0000 1.5
+++ tests/invalid/bad_initialise_decl.err_exp 22 Jul 2009 14:57:45 -0000
@@ -1,8 +1,3 @@
-bad_initialise_decl.m:028: Error: `initialise' declaration requires arity,
-bad_initialise_decl.m:028: found i4.
-bad_initialise_decl.m:029: Error: `initialise' declaration specifies a
-bad_initialise_decl.m:029: predicate whose arity is not zero or two: (i5 /
-bad_initialise_decl.m:029: 6).
bad_initialise_decl.m:019: Error: `initialise' declaration in module interface.
bad_initialise_decl.m:019: Error: `i2'/2 used in initialise declaration has
bad_initialise_decl.m:019: invalid signature.
@@ -10,3 +5,8 @@
bad_initialise_decl.m:026: invalid signature.
bad_initialise_decl.m:027: Error: `i3'/2 used in initialise declaration does
bad_initialise_decl.m:027: not have a corresponding pred declaration.
+bad_initialise_decl.m:028: Error: `initialise' declaration requires arity,
+bad_initialise_decl.m:028: found i4.
+bad_initialise_decl.m:029: Error: `initialise' declaration specifies a
+bad_initialise_decl.m:029: predicate whose arity is not zero or two: (i5 /
+bad_initialise_decl.m:029: 6).
Index: tests/invalid/bad_mutable.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/bad_mutable.err_exp,v
retrieving revision 1.9
diff -u -b -r1.9 bad_mutable.err_exp
--- tests/invalid/bad_mutable.err_exp 16 Jul 2008 03:30:58 -0000 1.9
+++ tests/invalid/bad_mutable.err_exp 22 Jul 2009 16:18:40 -0000
@@ -1,19 +1,19 @@
+bad_mutable.m:005: Error: `mutable' declaration in module interface.
+bad_mutable.m:011: In declaration for mutable `not_a_type':
+bad_mutable.m:011: error: undefined type `no_type'/0.
+bad_mutable.m:013: Error: the inst `special_ground' is not a valid inst for a
+bad_mutable.m:013: mutable declaration.
+bad_mutable.m:013: In declaration for mutable `not_an_inst':
+bad_mutable.m:013: error: undefined inst `special_ground'/0.
bad_mutable.m:015: Error: malformed attribute list in mutable declaration:
bad_mutable.m:015: [untrailed, bad_attrib].
bad_mutable.m:017: Error: the type in a mutable declaration cannot contain
bad_mutable.m:017: variables: list(T).
bad_mutable.m:019: Error: conflicting attributes in attribute list:
bad_mutable.m:019: [untrailed, trailed].
+bad_mutable.m:021: Error: multiple foreign_name attributes specified for the C
+bad_mutable.m:021: backend.
bad_mutable.m:024: Error: conflicting attributes in attribute list:
bad_mutable.m:024: [thread_local, trailed].
bad_mutable.m:026: Error: conflicting attributes in attribute list:
bad_mutable.m:026: [thread_local, constant].
-bad_mutable.m:011: In declaration for mutable `not_a_type':
-bad_mutable.m:011: error: undefined type `no_type'/0.
-bad_mutable.m:013: In declaration for mutable `not_an_inst':
-bad_mutable.m:013: error: undefined inst `special_ground'/0.
-bad_mutable.m:005: Error: `mutable' declaration in module interface.
-bad_mutable.m:013: Error: the inst `special_ground' is not a valid inst for a
-bad_mutable.m:013: mutable declaration.
-bad_mutable.m:021: Error: multiple foreign_name attributes specified for the C
-bad_mutable.m:021: backend.
Index: tests/invalid/bad_sv_unify_msg.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/bad_sv_unify_msg.err_exp,v
retrieving revision 1.1
diff -u -b -r1.1 bad_sv_unify_msg.err_exp
--- tests/invalid/bad_sv_unify_msg.err_exp 19 Oct 2007 05:10:36 -0000 1.1
+++ tests/invalid/bad_sv_unify_msg.err_exp 22 Jul 2009 16:18:41 -0000
@@ -1,9 +1,3 @@
-bad_sv_unify_msg.m:017: Error: !D cannot appear as a unification argument.
-bad_sv_unify_msg.m:017: You probably meant !.D or !:D.
-bad_sv_unify_msg.m:017: In clause for predicate `bad_sv_unify_msg.x'/2:
-bad_sv_unify_msg.m:017: warning: variable `STATE_VARIABLE_D_1' occurs only
-bad_sv_unify_msg.m:017: once in this scope.
-bad_sv_unify_msg.m:018: Warning: reference to uninitialized state variable !.D.
bad_sv_unify_msg.m:011: In predicate `x'/2:
bad_sv_unify_msg.m:011: warning: unresolved polymorphism.
bad_sv_unify_msg.m:011: The variable with an unbound type was:
@@ -15,4 +9,10 @@
bad_sv_unify_msg.m:017: mode error: variable `STATE_VARIABLE_D_1' has
bad_sv_unify_msg.m:017: instantiatedness `free',
bad_sv_unify_msg.m:017: expected instantiatedness was `ground'.
+bad_sv_unify_msg.m:017: Error: !D cannot appear as a unification argument.
+bad_sv_unify_msg.m:017: You probably meant !.D or !:D.
+bad_sv_unify_msg.m:017: In clause for predicate `bad_sv_unify_msg.x'/2:
+bad_sv_unify_msg.m:017: warning: variable `STATE_VARIABLE_D_1' occurs only
+bad_sv_unify_msg.m:017: once in this scope.
+bad_sv_unify_msg.m:018: Warning: reference to uninitialized state variable !.D.
For more information, recompile with `-E'.
Index: tests/invalid/bigtest.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/bigtest.err_exp,v
retrieving revision 1.16
diff -u -b -r1.16 bigtest.err_exp
--- tests/invalid/bigtest.err_exp 21 Jul 2009 02:08:56 -0000 1.16
+++ tests/invalid/bigtest.err_exp 25 Jul 2009 15:10:47 -0000
@@ -1,14 +1,5 @@
bigtest.m:001: Error: unrecognized declaration:
bigtest.m:001: export_sym(((list / 1) , ((append / 3) , member))).
-bigtest.m:001: Warning: module should start with a `:- module' declaration.
-bigtest.m:002: Error: unrecognized declaration:
-bigtest.m:002: export_pred(((append / 3) , member)).
-bigtest.m:003: Error: unrecognized declaration:
-bigtest.m:003: export_type(((list / 1) , bag)).
-bigtest.m:006: Syntax error at token ':-': operator precedence error.
-bigtest.m:008: Error: unrecognized declaration:
-bigtest.m:008: incorrect_declaration.
-bigtest.m:016: Error: type parameters must be variables: (t3 = (t1 + t2)).
bigtest.m:001: Warning: interface for module `bigtest' does not export
bigtest.m:001: anything.
bigtest.m:001: To be useful, a module should export something. A file should
@@ -16,10 +7,19 @@
bigtest.m:001: in its interface section(s). This would normally be a
bigtest.m:001: `:- pred', `:- func', `:- type', `:- inst' or `:- mode'
bigtest.m:001: declaration.
+bigtest.m:001: Warning: module should start with a `:- module' declaration.
+bigtest.m:002: Error: unrecognized declaration:
+bigtest.m:002: export_pred(((append / 3) , member)).
+bigtest.m:003: Error: unrecognized declaration:
+bigtest.m:003: export_type(((list / 1) , bag)).
bigtest.m:005: Error: clause for predicate `bigtest.fact'/0
bigtest.m:005: without preceding `pred' declaration.
-bigtest.m:005: Inferred :- pred fact.
bigtest.m:005: Error: no mode declaration for predicate `fact'/0.
bigtest.m:005: (Use `--infer-modes' to enable mode inference.)
+bigtest.m:005: Inferred :- pred fact.
+bigtest.m:006: Syntax error at token ':-': operator precedence error.
+bigtest.m:008: Error: unrecognized declaration:
+bigtest.m:008: incorrect_declaration.
bigtest.m:010: Error: no mode declaration for predicate `p'/1.
bigtest.m:010: (Use `--infer-modes' to enable mode inference.)
+bigtest.m:016: Error: type parameters must be variables: (t3 = (t1 + t2)).
Index: tests/invalid/constrained_poly_insts.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/constrained_poly_insts.err_exp,v
retrieving revision 1.12
diff -u -b -r1.12 constrained_poly_insts.err_exp
--- tests/invalid/constrained_poly_insts.err_exp 21 Jul 2009 02:08:56 -0000 1.12
+++ tests/invalid/constrained_poly_insts.err_exp 22 Jul 2009 16:18:52 -0000
@@ -1,3 +1,5 @@
+constrained_poly_insts.m:006: Error: no mode declaration for exported predicate
+constrained_poly_insts.m:006: `constrained_poly_insts.p'/2.
constrained_poly_insts.m:007: Error: inconsistent constraints on inst variables
constrained_poly_insts.m:007: in predicate mode declaration:
constrained_poly_insts.m:007: p(in(I), out((I =< any))).
@@ -15,14 +17,12 @@
constrained_poly_insts.m:023: Error: clause for predicate
constrained_poly_insts.m:023: `constrained_poly_insts.q'/2
constrained_poly_insts.m:023: without preceding `pred' declaration.
+constrained_poly_insts.m:023: Error: no mode declaration for predicate `q'/2.
+constrained_poly_insts.m:023: Inferred :- pred q(T1, T1).
constrained_poly_insts.m:025: Error: clause for function
constrained_poly_insts.m:025: `constrained_poly_insts.s'/1
constrained_poly_insts.m:025: without preceding `func' declaration.
-constrained_poly_insts.m:023: Inferred :- pred q(T1, T1).
constrained_poly_insts.m:025: Inferred :- func s(T1) = T1.
-constrained_poly_insts.m:006: Error: no mode declaration for exported predicate
-constrained_poly_insts.m:006: `constrained_poly_insts.p'/2.
-constrained_poly_insts.m:023: Error: no mode declaration for predicate `q'/2.
constrained_poly_insts.m:027: In clause for `t(in((I =< ground)), out((I =<
constrained_poly_insts.m:027: ground)))':
constrained_poly_insts.m:027: mode error: argument 2 became too instantiated.
Index: tests/invalid/ee_invalid.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/ee_invalid.err_exp,v
retrieving revision 1.1
diff -u -b -r1.1 ee_invalid.err_exp
--- tests/invalid/ee_invalid.err_exp 25 Jul 2007 06:12:31 -0000 1.1
+++ tests/invalid/ee_invalid.err_exp 22 Jul 2009 16:19:00 -0000
@@ -1,7 +1,7 @@
-ee_invalid.m:037: In pragma:
-ee_invalid.m:037: error: undefined type `undefined_type'/0.
ee_invalid.m:033: In `pragma foreign_export_enum' declaration for `int'/0:
ee_invalid.m:033: error: `int'/0 is an atomic type.
+ee_invalid.m:037: In pragma:
+ee_invalid.m:037: error: undefined type `undefined_type'/0.
ee_invalid.m:041: In `pragma foreign_export_enum' declaration for
ee_invalid.m:041: `ee_invalid.foo'/1:
ee_invalid.m:041: error: `ee_invalid.foo'/1 is not an enumeration type. It
Index: tests/invalid/errors.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/errors.err_exp,v
retrieving revision 1.18
diff -u -b -r1.18 errors.err_exp
--- tests/invalid/errors.err_exp 16 Jul 2008 03:30:58 -0000 1.18
+++ tests/invalid/errors.err_exp 22 Jul 2009 16:19:01 -0000
@@ -1,22 +1,7 @@
-errors.m:010: Warning: module should start with a `:- module' declaration.
-errors.m:060: Error: free type parameter T in RHS of type definition.
-errors.m:061: Error: free type parameter in RHS of type definition: f(T).
errors.m:001: Warning: interface for module `errors' does not export anything.
errors.m:001: Warning: module `int' is imported using both `:- import_module'
errors.m:001: `:- use_module' declarations.
-errors.m:051: In definition of type
-errors.m:051: `errors.du_type_which_references_undefined_type'/0:
-errors.m:051: error: undefined type `undefined_type'/0.
-errors.m:053: In definition of type
-errors.m:053: `errors.eqv_type_which_references_undefined_type'/0:
-errors.m:053: error: undefined type `undefined_type'/0.
-errors.m:100: In definition of type `errors.needs_qualification'/0:
-errors.m:100: error: undefined type `state'/0.
-errors.m:055: Error: circular equivalence type `errors.circular_eqv_type'/0.
-errors.m:057: Error: circular equivalence type
-errors.m:057: `errors.indirectly_circular_eqv_type_1'/0.
-errors.m:058: Error: circular equivalence type
-errors.m:058: `errors.indirectly_circular_eqv_type_2'/0.
+errors.m:010: Warning: module should start with a `:- module' declaration.
errors.m:028: Error: mode declaration for predicate
errors.m:028: `errors.mode_declaration_without_pred_declaration'/0
errors.m:028: without preceding `pred' declaration.
@@ -30,9 +15,24 @@
errors.m:049: `errors.type_with_multiply_defined_ctors/0' multiply defined.
errors.m:049: Error: constructor `errors.f/1' for type
errors.m:049: `errors.type_with_multiply_defined_ctors/0' multiply defined.
+errors.m:051: In definition of type
+errors.m:051: `errors.du_type_which_references_undefined_type'/0:
+errors.m:051: error: undefined type `undefined_type'/0.
+errors.m:053: In definition of type
+errors.m:053: `errors.eqv_type_which_references_undefined_type'/0:
+errors.m:053: error: undefined type `undefined_type'/0.
+errors.m:055: Error: circular equivalence type `errors.circular_eqv_type'/0.
+errors.m:057: Error: circular equivalence type
+errors.m:057: `errors.indirectly_circular_eqv_type_1'/0.
+errors.m:058: Error: circular equivalence type
+errors.m:058: `errors.indirectly_circular_eqv_type_2'/0.
+errors.m:060: Error: free type parameter T in RHS of type definition.
+errors.m:061: Error: free type parameter in RHS of type definition: f(T).
errors.m:075: In clause for predicate
errors.m:075: `errors.pred_with_unresolved_polymorphism'/0:
errors.m:075: warning: variable `Arg' occurs only once in this scope.
errors.m:091: In clause for predicate `errors.pred_with_singleton_vars'/1:
errors.m:091: warning: variable `X' occurs only once in this scope.
+errors.m:100: In definition of type `errors.needs_qualification'/0:
+errors.m:100: error: undefined type `state'/0.
For more information, recompile with `-E'.
Index: tests/invalid/errors1.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/errors1.err_exp,v
retrieving revision 1.14
diff -u -b -r1.14 errors1.err_exp
--- tests/invalid/errors1.err_exp 10 Sep 2006 23:39:16 -0000 1.14
+++ tests/invalid/errors1.err_exp 22 Jul 2009 16:19:02 -0000
@@ -1,16 +1,5 @@
errors1.m:001: Warning: interface for module `errors1' does not export
errors1.m:001: anything.
-errors1.m:051: In definition of type
-errors1.m:051: `errors1.du_type_which_references_undefined_type'/0:
-errors1.m:051: error: undefined type `undefined_type'/0.
-errors1.m:053: In definition of type
-errors1.m:053: `errors1.eqv_type_which_references_undefined_type'/0:
-errors1.m:053: error: undefined type `undefined_type'/0.
-errors1.m:055: Error: circular equivalence type `errors1.circular_eqv_type'/0.
-errors1.m:057: Error: circular equivalence type
-errors1.m:057: `errors1.indirectly_circular_eqv_type_1'/0.
-errors1.m:058: Error: circular equivalence type
-errors1.m:058: `errors1.indirectly_circular_eqv_type_2'/0.
errors1.m:028: Error: mode declaration for predicate
errors1.m:028: `errors1.mode_declaration_without_pred_declaration'/0
errors1.m:028: without preceding `pred' declaration.
@@ -24,6 +13,17 @@
errors1.m:049: `errors1.type_with_multiply_defined_ctors/0' multiply defined.
errors1.m:049: Error: constructor `errors1.f/1' for type
errors1.m:049: `errors1.type_with_multiply_defined_ctors/0' multiply defined.
+errors1.m:051: In definition of type
+errors1.m:051: `errors1.du_type_which_references_undefined_type'/0:
+errors1.m:051: error: undefined type `undefined_type'/0.
+errors1.m:053: In definition of type
+errors1.m:053: `errors1.eqv_type_which_references_undefined_type'/0:
+errors1.m:053: error: undefined type `undefined_type'/0.
+errors1.m:055: Error: circular equivalence type `errors1.circular_eqv_type'/0.
+errors1.m:057: Error: circular equivalence type
+errors1.m:057: `errors1.indirectly_circular_eqv_type_1'/0.
+errors1.m:058: Error: circular equivalence type
+errors1.m:058: `errors1.indirectly_circular_eqv_type_2'/0.
errors1.m:072: In clause for predicate
errors1.m:072: `errors1.pred_with_unresolved_polymorphism'/0:
errors1.m:072: warning: variable `Arg' occurs only once in this scope.
Index: tests/invalid/errors2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/errors2.err_exp,v
retrieving revision 1.21
diff -u -b -r1.21 errors2.err_exp
--- tests/invalid/errors2.err_exp 16 Apr 2009 02:09:08 -0000 1.21
+++ tests/invalid/errors2.err_exp 22 Jul 2009 16:19:02 -0000
@@ -5,19 +5,9 @@
errors2.m:001: in its interface section(s). This would normally be a
errors2.m:001: `:- pred', `:- func', `:- type', `:- inst' or `:- mode'
errors2.m:001: declaration.
+errors2.m:007: Error: no clauses for predicate `bind_type_param'/2.
errors2.m:009: Error: clause for predicate `errors2.bind_type_param'/1
errors2.m:009: without preceding `pred' declaration.
-errors2.m:052: In clause for predicate `errors2.type_error_4'/0:
-errors2.m:052: warning: variable `X' occurs only once in this scope.
-errors2.m:059: In clause for predicate `errors2.type_error_5'/0:
-errors2.m:059: warning: variable `X' occurs only once in this scope.
-errors2.m:065: In clause for predicate `errors2.type_error_6'/0:
-errors2.m:065: warning: variable `X' occurs only once in this scope.
-errors2.m:070: In clause for predicate `errors2.type_error_7'/0:
-errors2.m:070: warning: variable `Y' occurs only once in this scope.
-errors2.m:071: In clause for predicate `errors2.type_error_7'/0:
-errors2.m:071: warning: variables `A, B, Z' occur only once in this scope.
-errors2.m:007: Error: no clauses for predicate `bind_type_param'/2.
errors2.m:009: Inferred :- pred bind_type_param(int).
errors2.m:023: Error: no clauses for predicate `produce_string'/1.
errors2.m:025: Error: no clauses for predicate `expect_int'/1.
@@ -53,6 +43,8 @@
errors2.m:052: X_2: errors2.foo_type
errors2.m:052: V_3: character
errors2.m:052: V_4: string
+errors2.m:052: In clause for predicate `errors2.type_error_4'/0:
+errors2.m:052: warning: variable `X' occurs only once in this scope.
errors2.m:059: In clause for predicate `type_error_5'/0:
errors2.m:059: in argument 3 of functor `foo_functor/3':
errors2.m:059: type error in unification of argument
@@ -64,6 +56,8 @@
errors2.m:059: X_2: errors2.foo_type
errors2.m:059: V_3: int
errors2.m:059: V_4: string
+errors2.m:059: In clause for predicate `errors2.type_error_5'/0:
+errors2.m:059: warning: variable `X' occurs only once in this scope.
errors2.m:065: In clause for predicate `type_error_6'/0:
errors2.m:065: in argument 3 of functor `bar_functor/3':
errors2.m:065: type error in unification of argument
@@ -75,6 +69,12 @@
errors2.m:065: X_2: errors2.bar_1_type
errors2.m:065: V_3: int
errors2.m:065: V_4: string
+errors2.m:065: In clause for predicate `errors2.type_error_6'/0:
+errors2.m:065: warning: variable `X' occurs only once in this scope.
+errors2.m:070: In clause for predicate `errors2.type_error_7'/0:
+errors2.m:070: warning: variable `Y' occurs only once in this scope.
+errors2.m:071: In clause for predicate `errors2.type_error_7'/0:
+errors2.m:071: warning: variables `A, B, Z' occur only once in this scope.
errors2.m:072: In clause for predicate `type_error_7'/0:
errors2.m:072: in argument 1 of call to predicate `expect_int'/1:
errors2.m:072: type error: variable `C' has type `string',
Index: tests/invalid/exported_unify3.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/exported_unify3.err_exp,v
retrieving revision 1.4
diff -u -b -r1.4 exported_unify3.err_exp
--- tests/invalid/exported_unify3.err_exp 7 Sep 2006 05:51:27 -0000 1.4
+++ tests/invalid/exported_unify3.err_exp 22 Jul 2009 16:19:06 -0000
@@ -1,3 +1,6 @@
+exported_unify3.int0:003: In clause for unification predicate for type `foo':
+exported_unify3.int0:003: error: undefined predicate
+exported_unify3.int0:003: `exported_unify3.defined_in_wrong_module'/2.
exported_unify3.m:005: In clause for unification predicate for type `foo':
exported_unify3.m:005: error: undefined predicate
exported_unify3.m:005: `exported_unify3.defined_in_wrong_module'/2.
@@ -5,6 +8,3 @@
exported_unify3.sub.int:003: `bar':
exported_unify3.sub.int:003: error: undefined predicate
exported_unify3.sub.int:003: `exported_unify3.sub.not_exported'/2.
-exported_unify3.int0:003: In clause for unification predicate for type `foo':
-exported_unify3.int0:003: error: undefined predicate
-exported_unify3.int0:003: `exported_unify3.defined_in_wrong_module'/2.
Index: tests/invalid/external.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/external.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 external.err_exp
--- tests/invalid/external.err_exp 7 Sep 2006 05:51:27 -0000 1.6
+++ tests/invalid/external.err_exp 22 Jul 2009 16:19:09 -0000
@@ -1,2 +1,2 @@
-external.m:012: Warning: `external' declaration requires arity.
external.m:007: Error: no clauses for predicate `p'/2.
+external.m:012: Warning: `external' declaration requires arity.
Index: tests/invalid/field_syntax_error.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/field_syntax_error.err_exp,v
retrieving revision 1.5
diff -u -b -r1.5 field_syntax_error.err_exp
--- tests/invalid/field_syntax_error.err_exp 7 Sep 2006 05:51:27 -0000 1.5
+++ tests/invalid/field_syntax_error.err_exp 22 Jul 2009 16:19:10 -0000
@@ -1,13 +1,10 @@
-field_syntax_error.m:013: In clause for function `field_syntax_error.baz'/1:
-field_syntax_error.m:013: warning: variable `Bar' occurs only once in this
-field_syntax_error.m:013: scope.
-field_syntax_error.m:015: In clause for function `field_syntax_error.baz3'/1:
-field_syntax_error.m:015: warning: variable `Bar' occurs only once in this
-field_syntax_error.m:015: scope.
field_syntax_error.m:013: In clause for function `baz'/1:
field_syntax_error.m:013: in function result term of clause head:
field_syntax_error.m:013: error: invalid use of field selection operator
field_syntax_error.m:013: (`^').
+field_syntax_error.m:013: In clause for function `field_syntax_error.baz'/1:
+field_syntax_error.m:013: warning: variable `Bar' occurs only once in this
+field_syntax_error.m:013: scope.
field_syntax_error.m:014: In clause for function `baz2'/1:
field_syntax_error.m:014: in function result term of clause head:
field_syntax_error.m:014: error: invalid use of field selection operator
@@ -20,6 +17,9 @@
field_syntax_error.m:015: in argument 1 of functor `:=/2':
field_syntax_error.m:015: error: invalid use of field selection operator
field_syntax_error.m:015: (`^').
+field_syntax_error.m:015: In clause for function `field_syntax_error.baz3'/1:
+field_syntax_error.m:015: warning: variable `Bar' occurs only once in this
+field_syntax_error.m:015: scope.
field_syntax_error.m:016: In clause for function `baz4'/1:
field_syntax_error.m:016: in function result term of clause head:
field_syntax_error.m:016: error: invalid use of field update operator (`:=').
Index: tests/invalid/foreign_purity_mismatch.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/foreign_purity_mismatch.err_exp,v
retrieving revision 1.3
diff -u -b -r1.3 foreign_purity_mismatch.err_exp
--- tests/invalid/foreign_purity_mismatch.err_exp 12 Sep 2006 04:41:49 -0000 1.3
+++ tests/invalid/foreign_purity_mismatch.err_exp 22 Jul 2009 16:19:14 -0000
@@ -1,3 +1,14 @@
+foreign_purity_mismatch.m:006: In predicate `pure_with_impure'/1:
+foreign_purity_mismatch.m:006: purity error: predicate is impure.
+foreign_purity_mismatch.m:006: It must be declared `impure' or promised pure.
+foreign_purity_mismatch.m:007: In predicate `pure_with_semipure'/1:
+foreign_purity_mismatch.m:007: purity error: predicate is semipure.
+foreign_purity_mismatch.m:007: It must be declared `semipure' or promised
+foreign_purity_mismatch.m:007: pure.
+foreign_purity_mismatch.m:009: In predicate `semipure_with_impure'/1:
+foreign_purity_mismatch.m:009: purity error: predicate is impure.
+foreign_purity_mismatch.m:009: It must be declared `impure' or promised
+foreign_purity_mismatch.m:009: semipure.
foreign_purity_mismatch.m:020: Error: foreign clause for predicate
foreign_purity_mismatch.m:020: `foreign_purity_mismatch.pure_with_impure'/1
foreign_purity_mismatch.m:020: has purity impure but that predicate has been
@@ -22,14 +33,3 @@
foreign_purity_mismatch.m:055: `foreign_purity_mismatch.impure_with_semipure'/1
foreign_purity_mismatch.m:055: has purity semipure but that predicate has
foreign_purity_mismatch.m:055: been declared impure.
-foreign_purity_mismatch.m:006: In predicate `pure_with_impure'/1:
-foreign_purity_mismatch.m:006: purity error: predicate is impure.
-foreign_purity_mismatch.m:006: It must be declared `impure' or promised pure.
-foreign_purity_mismatch.m:007: In predicate `pure_with_semipure'/1:
-foreign_purity_mismatch.m:007: purity error: predicate is semipure.
-foreign_purity_mismatch.m:007: It must be declared `semipure' or promised
-foreign_purity_mismatch.m:007: pure.
-foreign_purity_mismatch.m:009: In predicate `semipure_with_impure'/1:
-foreign_purity_mismatch.m:009: purity error: predicate is impure.
-foreign_purity_mismatch.m:009: It must be declared `impure' or promised
-foreign_purity_mismatch.m:009: semipure.
Index: tests/invalid/funcs_as_preds.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/funcs_as_preds.err_exp,v
retrieving revision 1.15
diff -u -b -r1.15 funcs_as_preds.err_exp
--- tests/invalid/funcs_as_preds.err_exp 16 Apr 2009 02:09:08 -0000 1.15
+++ tests/invalid/funcs_as_preds.err_exp 22 Jul 2009 16:19:21 -0000
@@ -2,22 +2,22 @@
funcs_as_preds.m:001: export anything.
funcs_as_preds.m:017: Error: clause for function `funcs_as_preds.null'/1
funcs_as_preds.m:017: without preceding `func' declaration.
-funcs_as_preds.m:021: Error: clause for function `funcs_as_preds.car'/1
-funcs_as_preds.m:021: without preceding `func' declaration.
-funcs_as_preds.m:024: Error: clause for function `funcs_as_preds.cdr'/1
-funcs_as_preds.m:024: without preceding `func' declaration.
-funcs_as_preds.m:027: Error: clause for function `funcs_as_preds.cons'/2
-funcs_as_preds.m:027: without preceding `func' declaration.
-funcs_as_preds.m:030: Error: clause for function `funcs_as_preds.ap'/2
-funcs_as_preds.m:030: without preceding `func' declaration.
funcs_as_preds.m:017: In clause for function `null'/1:
funcs_as_preds.m:017: in function result term of clause head:
funcs_as_preds.m:017: error: the language construct `='/2 should be used as a
funcs_as_preds.m:017: goal, not as an expression.
+funcs_as_preds.m:021: Error: clause for function `funcs_as_preds.car'/1
+funcs_as_preds.m:021: without preceding `func' declaration.
funcs_as_preds.m:021: Inferred :- func car(list.list(list.list(T))) =
funcs_as_preds.m:021: list.list(T).
+funcs_as_preds.m:024: Error: clause for function `funcs_as_preds.cdr'/1
+funcs_as_preds.m:024: without preceding `func' declaration.
funcs_as_preds.m:024: Inferred :- func cdr(list.list(T)) = list.list(T).
+funcs_as_preds.m:027: Error: clause for function `funcs_as_preds.cons'/2
+funcs_as_preds.m:027: without preceding `func' declaration.
funcs_as_preds.m:027: Inferred :- func cons(T, list.list(T)) = list.list(T).
+funcs_as_preds.m:030: Error: clause for function `funcs_as_preds.ap'/2
+funcs_as_preds.m:030: without preceding `func' declaration.
funcs_as_preds.m:030: In clause for function `ap'/2:
funcs_as_preds.m:030: error: undefined predicate `null'/1.
funcs_as_preds.m:030: (There is a *function* with that name, however.
Index: tests/invalid/fundeps_unbound_in_ctor.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/fundeps_unbound_in_ctor.err_exp,v
retrieving revision 1.4
diff -u -b -r1.4 fundeps_unbound_in_ctor.err_exp
--- tests/invalid/fundeps_unbound_in_ctor.err_exp 16 Jul 2008 03:30:58 -0000 1.4
+++ tests/invalid/fundeps_unbound_in_ctor.err_exp 22 Jul 2009 16:19:22 -0000
@@ -1,7 +1,3 @@
-fundeps_unbound_in_ctor.m:012: Error: type variable C in class constraints,
-fundeps_unbound_in_ctor.m:012: which was introduced with `=>' must be
-fundeps_unbound_in_ctor.m:012: explicitly existentially quantified using
-fundeps_unbound_in_ctor.m:012: `some'.
fundeps_unbound_in_ctor.m:008: In declaration for type
fundeps_unbound_in_ctor.m:008: `fundeps_unbound_in_ctor.bar'/0:
fundeps_unbound_in_ctor.m:008: error in type class constraints: type variable
@@ -27,3 +23,7 @@
fundeps_unbound_in_ctor.m:008: fully determined.
fundeps_unbound_in_ctor.m:008: See the "Functional dependencies" section of
fundeps_unbound_in_ctor.m:008: the reference manual for details.
+fundeps_unbound_in_ctor.m:012: Error: type variable C in class constraints,
+fundeps_unbound_in_ctor.m:012: which was introduced with `=>' must be
+fundeps_unbound_in_ctor.m:012: explicitly existentially quantified using
+fundeps_unbound_in_ctor.m:012: `some'.
Index: tests/invalid/fundeps_vars.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/fundeps_vars.err_exp,v
retrieving revision 1.3
diff -u -b -r1.3 fundeps_vars.err_exp
--- tests/invalid/fundeps_vars.err_exp 16 Jul 2008 03:30:58 -0000 1.3
+++ tests/invalid/fundeps_vars.err_exp 22 Jul 2009 16:19:23 -0000
@@ -2,9 +2,9 @@
fundeps_vars.m:020: be comma-separated lists of variables.
fundeps_vars.m:027: Error: type variable F in the functional dependency is not
fundeps_vars.m:027: a parameter of this type class.
+fundeps_vars.m:035: Error: instance declaration for `coll'/2 without preceding
+fundeps_vars.m:035: typeclass declaration.
fundeps_vars.m:035: In declaration of instance of typeclass `coll'/2:
fundeps_vars.m:035: error: undefined typeclass `coll'/2.
fundeps_vars.m:042: In definition of predicate `fundeps_vars.test'/2:
fundeps_vars.m:042: error: undefined typeclass `coll'/2.
-fundeps_vars.m:035: Error: instance declaration for `coll'/2 without preceding
-fundeps_vars.m:035: typeclass declaration.
Index: tests/invalid/hawkins_mm_fail_reset.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/hawkins_mm_fail_reset.err_exp,v
retrieving revision 1.4
diff -u -b -r1.4 hawkins_mm_fail_reset.err_exp
--- tests/invalid/hawkins_mm_fail_reset.err_exp 13 Oct 2006 04:52:37 -0000 1.4
+++ tests/invalid/hawkins_mm_fail_reset.err_exp 22 Jul 2009 16:19:24 -0000
@@ -5,11 +5,11 @@
hawkins_mm_fail_reset.m:027: Error: `pragma minimal_model' declaration not
hawkins_mm_fail_reset.m:027: allowed for procedure with determinism
hawkins_mm_fail_reset.m:027: `failure'.
-hawkins_mm_fail_reset.m:036: Error: `pragma minimal_model' declaration not
-hawkins_mm_fail_reset.m:036: allowed for procedure with determinism
-hawkins_mm_fail_reset.m:036: `failure'.
hawkins_mm_fail_reset.m:030: Warning: this disjunct will never have any
hawkins_mm_fail_reset.m:030: solutions.
hawkins_mm_fail_reset.m:033: Warning: this disjunct will never have any
hawkins_mm_fail_reset.m:033: solutions.
+hawkins_mm_fail_reset.m:036: Error: `pragma minimal_model' declaration not
+hawkins_mm_fail_reset.m:036: allowed for procedure with determinism
+hawkins_mm_fail_reset.m:036: `failure'.
For more information, recompile with `-E'.
Index: tests/invalid/impl_def_literal_syntax.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/impl_def_literal_syntax.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 impl_def_literal_syntax.err_exp
--- tests/invalid/impl_def_literal_syntax.err_exp 16 Jul 2008 03:30:58 -0000 1.2
+++ tests/invalid/impl_def_literal_syntax.err_exp 22 Jul 2009 18:44:02 -0000
@@ -1,3 +1,5 @@
+impl_def_literal_syntax.m:007: Error: no clauses for predicate `g'/2.
+impl_def_literal_syntax.m:008: Error: no clauses for predicate `h'/2.
impl_def_literal_syntax.m:010: Error: syntax error in `:- pred' declaration at
impl_def_literal_syntax.m:010: w($file).
impl_def_literal_syntax.m:011: In `:- pred' declaration: error: atom expected
@@ -23,5 +25,3 @@
impl_def_literal_syntax.m:042: `,', `)', or operator.
impl_def_literal_syntax.m:043: Syntax error at integer `123': expected `,',
impl_def_literal_syntax.m:043: `)', or operator.
-impl_def_literal_syntax.m:007: Error: no clauses for predicate `g'/2.
-impl_def_literal_syntax.m:008: Error: no clauses for predicate `h'/2.
Index: tests/invalid/inst_list_dup.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/inst_list_dup.err_exp,v
retrieving revision 1.8
diff -u -b -r1.8 inst_list_dup.err_exp
--- tests/invalid/inst_list_dup.err_exp 16 Jul 2008 03:30:58 -0000 1.8
+++ tests/invalid/inst_list_dup.err_exp 22 Jul 2009 16:19:45 -0000
@@ -1,5 +1,5 @@
-inst_list_dup.m:003: Error: syntax error in inst body at bound(((ground -
-inst_list_dup.m:003: unique) ; (ground - ground))).
inst_list_dup.m:001: Warning: interface for module `inst_list_dup' does not
inst_list_dup.m:001: export anything.
+inst_list_dup.m:003: Error: syntax error in inst body at bound(((ground -
+inst_list_dup.m:003: unique) ; (ground - ground))).
For more information, recompile with `-E'.
Index: tests/invalid/invalid_main.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/invalid_main.err_exp,v
retrieving revision 1.5
diff -u -b -r1.5 invalid_main.err_exp
--- tests/invalid/invalid_main.err_exp 13 Oct 2006 04:52:37 -0000 1.5
+++ tests/invalid/invalid_main.err_exp 22 Jul 2009 16:19:53 -0000
@@ -1,6 +1,6 @@
invalid_main.m:004: Error: arguments of main/2 must have type `io.state'.
+invalid_main.m:004: Error: main/2 must have mode `(di, uo)'.
invalid_main.m:004: Error: main/2 must be `det' or `cc_multi'.
invalid_main.m:004: In `main'(di, out):
invalid_main.m:004: warning: determinism declaration could be tighter.
invalid_main.m:004: Declared `multi', inferred `det'.
-invalid_main.m:004: Error: main/2 must have mode `(di, uo)'.
Index: tests/invalid/invalid_typeclass.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/invalid_typeclass.err_exp,v
retrieving revision 1.7
diff -u -b -r1.7 invalid_typeclass.err_exp
--- tests/invalid/invalid_typeclass.err_exp 16 Jul 2008 03:30:58 -0000 1.7
+++ tests/invalid/invalid_typeclass.err_exp 22 Jul 2009 16:19:55 -0000
@@ -1,3 +1,7 @@
+invalid_typeclass.m:007: Error: no definition for typeclass
+invalid_typeclass.m:007: `invalid_typeclass.class'/1
+invalid_typeclass.m:009: Error: no definition for typeclass
+invalid_typeclass.m:009: `invalid_typeclass.class2'/1
invalid_typeclass.m:011: Error: expected distinct variables as class
invalid_typeclass.m:011: parameters.
invalid_typeclass.m:017: Error: typeclass `invalid_typeclass.class2'/1 multiply
@@ -5,7 +9,3 @@
invalid_typeclass.m:009: Here is the previous definition of typeclass
invalid_typeclass.m:009: `invalid_typeclass.class2'/1.
invalid_typeclass.m:017: The superclass constraints do not match.
-invalid_typeclass.m:007: Error: no definition for typeclass
-invalid_typeclass.m:007: `invalid_typeclass.class'/1
-invalid_typeclass.m:009: Error: no definition for typeclass
-invalid_typeclass.m:009: `invalid_typeclass.class2'/1
Index: tests/invalid/missing_det_decls.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/missing_det_decls.err_exp,v
retrieving revision 1.14
diff -u -b -r1.14 missing_det_decls.err_exp
--- tests/invalid/missing_det_decls.err_exp 10 Sep 2006 23:39:16 -0000 1.14
+++ tests/invalid/missing_det_decls.err_exp 22 Jul 2009 16:20:04 -0000
@@ -1,20 +1,20 @@
+missing_det_decls.m:004: Error: no clauses for predicate `exp1'/0.
missing_det_decls.m:005: Error: no determinism declaration for exported
missing_det_decls.m:005: predicate `missing_det_decls.exp1'/0.
+missing_det_decls.m:007: Error: no clauses for predicate `exp2'/1.
missing_det_decls.m:008: Error: no determinism declaration for exported
missing_det_decls.m:008: predicate `missing_det_decls.exp2'/1.
+missing_det_decls.m:012: Error: no clauses for predicate `loc1'/0.
missing_det_decls.m:013: Error: no determinism declaration for local predicate
missing_det_decls.m:013: `missing_det_decls.loc1'/0.
missing_det_decls.m:013: (This is an error because you specified the
missing_det_decls.m:013: `--no-infer-det' options. Use the `--infer-det'
missing_det_decls.m:013: option if you want the compiler to automatically
missing_det_decls.m:013: infer the determinism of local predicates.)
+missing_det_decls.m:015: Error: no clauses for predicate `loc2'/1.
missing_det_decls.m:016: Error: no determinism declaration for local predicate
missing_det_decls.m:016: `missing_det_decls.loc2'/1.
missing_det_decls.m:016: (This is an error because you specified the
missing_det_decls.m:016: `--no-infer-det' options. Use the `--infer-det'
missing_det_decls.m:016: option if you want the compiler to automatically
missing_det_decls.m:016: infer the determinism of local predicates.)
-missing_det_decls.m:004: Error: no clauses for predicate `exp1'/0.
-missing_det_decls.m:007: Error: no clauses for predicate `exp2'/1.
-missing_det_decls.m:012: Error: no clauses for predicate `loc1'/0.
-missing_det_decls.m:015: Error: no clauses for predicate `loc2'/1.
Index: tests/invalid/multimode_dcg.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/multimode_dcg.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 multimode_dcg.err_exp
--- tests/invalid/multimode_dcg.err_exp 7 Sep 2006 05:51:30 -0000 1.6
+++ tests/invalid/multimode_dcg.err_exp 22 Jul 2009 16:20:20 -0000
@@ -4,6 +4,9 @@
multimode_dcg.m:029: In clause for predicate `multimode_dcg.test1'/3:
multimode_dcg.m:029: syntax error: some but not all arguments have mode
multimode_dcg.m:029: annotations.
+multimode_dcg.m:029: In clause for `test1(out, di, uo)':
+multimode_dcg.m:029: mode mismatch in disjunction.
+multimode_dcg.m:029: `HeadVar__1' :: free, unique(0).
multimode_dcg.m:037: In clause for predicate `multimode_dcg.test2'/4:
multimode_dcg.m:037: syntax error: some but not all arguments have mode
multimode_dcg.m:037: annotations.
@@ -16,9 +19,6 @@
multimode_dcg.m:043: In clause for predicate `multimode_dcg.test2'/4:
multimode_dcg.m:043: syntax error: some but not all arguments have mode
multimode_dcg.m:043: annotations.
-multimode_dcg.m:029: In clause for `test1(out, di, uo)':
-multimode_dcg.m:029: mode mismatch in disjunction.
-multimode_dcg.m:029: `HeadVar__1' :: free, unique(0).
multimode_dcg.m:043: In clause for `test2(in, out, di, uo)':
multimode_dcg.m:043: mode mismatch in disjunction.
multimode_dcg.m:043: `HeadVar__2' :: free, unique(0), free, unique(0).
Index: tests/invalid/multimode_syntax.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/multimode_syntax.err_exp,v
retrieving revision 1.9
diff -u -b -r1.9 multimode_syntax.err_exp
--- tests/invalid/multimode_syntax.err_exp 10 Sep 2006 23:39:16 -0000 1.9
+++ tests/invalid/multimode_syntax.err_exp 22 Jul 2009 16:20:22 -0000
@@ -1,5 +1,16 @@
+multimode_syntax.m:011: Error: no clauses for function `func0'/0.
multimode_syntax.m:013: Error: clause for predicate `multimode_syntax.::'/2
multimode_syntax.m:013: without preceding `pred' declaration.
+multimode_syntax.m:013: In clause for predicate `::'/2:
+multimode_syntax.m:013: in argument 1 of clause head:
+multimode_syntax.m:013: error: the language construct `='/2 should be used as
+multimode_syntax.m:013: a goal, not as an expression.
+multimode_syntax.m:013: If you are trying to use a goal as a boolean
+multimode_syntax.m:013: function, you should write `if <goal> then yes else
+multimode_syntax.m:013: no' instead.
+multimode_syntax.m:013: In clause for predicate `::'/2:
+multimode_syntax.m:013: in argument 2 of clause head:
+multimode_syntax.m:013: error: undefined symbol `out/0'.
multimode_syntax.m:018: In clause for function `multimode_syntax.func1'/1:
multimode_syntax.m:018: syntax error: some but not all arguments have mode
multimode_syntax.m:018: annotations.
@@ -36,14 +47,3 @@
multimode_syntax.m:047: In clause for predicate `multimode_syntax.test2'/2:
multimode_syntax.m:047: syntax error: some but not all arguments have mode
multimode_syntax.m:047: annotations.
-multimode_syntax.m:011: Error: no clauses for function `func0'/0.
-multimode_syntax.m:013: In clause for predicate `::'/2:
-multimode_syntax.m:013: in argument 1 of clause head:
-multimode_syntax.m:013: error: the language construct `='/2 should be used as
-multimode_syntax.m:013: a goal, not as an expression.
-multimode_syntax.m:013: If you are trying to use a goal as a boolean
-multimode_syntax.m:013: function, you should write `if <goal> then yes else
-multimode_syntax.m:013: no' instead.
-multimode_syntax.m:013: In clause for predicate `::'/2:
-multimode_syntax.m:013: in argument 2 of clause head:
-multimode_syntax.m:013: error: undefined symbol `out/0'.
Index: tests/invalid/multisoln_func.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/multisoln_func.err_exp,v
retrieving revision 1.8
diff -u -b -r1.8 multisoln_func.err_exp
--- tests/invalid/multisoln_func.err_exp 7 Sep 2006 05:51:30 -0000 1.8
+++ tests/invalid/multisoln_func.err_exp 22 Jul 2009 16:20:23 -0000
@@ -1,6 +1,3 @@
-multisoln_func.m:026: Inferred :- func test2 = int.
-multisoln_func.m:030: Inferred :- func test3(int) = int.
-multisoln_func.m:034: Inferred :- func test3b(int) = int.
multisoln_func.m:013: Error: invalid determinism for `f'(in) = out:
multisoln_func.m:013: the primary mode of a function cannot be `cc_multi'.
multisoln_func.m:013: In Mercury, a function is supposed to be a true
@@ -31,6 +28,7 @@
multisoln_func.m:026: arguments would break referential transparency.) Most
multisoln_func.m:026: likely, this procedure should be a predicate, not a
multisoln_func.m:026: function.
+multisoln_func.m:026: Inferred :- func test2 = int.
multisoln_func.m:030: Error: invalid determinism for `test3'(in) = out:
multisoln_func.m:030: the primary mode of a function cannot be `nondet'.
multisoln_func.m:030: In Mercury, a function is supposed to be a true
@@ -41,6 +39,7 @@
multisoln_func.m:030: arguments would break referential transparency.) Most
multisoln_func.m:030: likely, this procedure should be a predicate, not a
multisoln_func.m:030: function.
+multisoln_func.m:030: Inferred :- func test3(int) = int.
multisoln_func.m:034: Error: invalid determinism for `test3b'(in) = out:
multisoln_func.m:034: the primary mode of a function cannot be `cc_nondet'.
multisoln_func.m:034: In Mercury, a function is supposed to be a true
@@ -51,3 +50,4 @@
multisoln_func.m:034: arguments would break referential transparency.) Most
multisoln_func.m:034: likely, this procedure should be a predicate, not a
multisoln_func.m:034: function.
+multisoln_func.m:034: Inferred :- func test3b(int) = int.
Index: tests/invalid/null_char.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/null_char.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 null_char.err_exp
--- tests/invalid/null_char.err_exp 16 Jul 2008 03:30:59 -0000 1.2
+++ tests/invalid/null_char.err_exp 22 Jul 2009 16:20:28 -0000
@@ -1,12 +1,18 @@
null_char.m:012: Syntax error: null character is illegal in strings and names.
+null_char.m:012: Error: clause for predicate `null_char.int'/0
+null_char.m:012: without preceding `pred' declaration.
+null_char.m:012: Inferred :- pred int.
null_char.m:014: In clause head: error: atom expected at 1.
null_char.m:014: Syntax error: null character is illegal in strings and names.
+null_char.m:016: Error: no clauses for predicate `wrong2'/1.
null_char.m:018: Syntax error at token `)': unexpected token at start of
null_char.m:018: (sub)term.
null_char.m:018: Syntax error: null character is illegal in strings and names.
+null_char.m:020: Error: no clauses for predicate `wrong3'/1.
null_char.m:022: Syntax error at token `. ': unexpected token at start of
null_char.m:022: (sub)term.
null_char.m:022: Syntax error: null character is illegal in strings and names.
+null_char.m:024: Error: no clauses for predicate `wrong4'/1.
null_char.m:026: Syntax error at token `)': unexpected token at start of
null_char.m:026: (sub)term.
null_char.m:026: Syntax error: null character is illegal in strings and names.
@@ -18,9 +24,3 @@
null_char.m:030: Syntax error: null character is illegal in strings and names.
null_char.m:032: Syntax error: invalid character in quoted name.
null_char.m:034: Syntax error: Illegal character 0x0 (0) in input.
-null_char.m:012: Error: clause for predicate `null_char.int'/0
-null_char.m:012: without preceding `pred' declaration.
-null_char.m:012: Inferred :- pred int.
-null_char.m:016: Error: no clauses for predicate `wrong2'/1.
-null_char.m:020: Error: no clauses for predicate `wrong3'/1.
-null_char.m:024: Error: no clauses for predicate `wrong4'/1.
Index: tests/invalid/occurs.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/occurs.err_exp,v
retrieving revision 1.12
diff -u -b -r1.12 occurs.err_exp
--- tests/invalid/occurs.err_exp 7 Sep 2006 05:51:30 -0000 1.12
+++ tests/invalid/occurs.err_exp 22 Jul 2009 16:20:30 -0000
@@ -1,12 +1,15 @@
occurs.m:001: Warning: interface for module `occurs' does not export anything.
-occurs.m:008: In clause for predicate `occurs.p'/0:
-occurs.m:008: warning: variable `X' occurs only once in this scope.
occurs.m:008: In clause for `p':
occurs.m:008: mode error in unification of `X' and `occurs.f(X)'.
occurs.m:008: Variable `X' has instantiatedness `free',
occurs.m:008: term `occurs.f(X)' has instantiatedness `occurs.f(
occurs.m:008: free
occurs.m:008: )'.
+occurs.m:008: In clause for predicate `occurs.p'/0:
+occurs.m:008: warning: variable `X' occurs only once in this scope.
+occurs.m:010: In `p2':
+occurs.m:010: warning: determinism declaration could be tighter.
+occurs.m:010: Declared `semidet', inferred `failure'.
occurs.m:013: In clause for `p2':
occurs.m:013: warning: unification of `X' and occurs.f cannot succeed
occurs.m:013: `X' has instantiatedness `unique((occurs.[]))'.
@@ -16,7 +19,4 @@
occurs.m:018: term `occurs.f(X)' has instantiatedness `occurs.f(
occurs.m:018: unique(occurs.f(free))
occurs.m:018: )'.
-occurs.m:010: In `p2':
-occurs.m:010: warning: determinism declaration could be tighter.
-occurs.m:010: Declared `semidet', inferred `failure'.
For more information, recompile with `-E'.
Index: tests/invalid/pragma_c_code_dup_var.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/pragma_c_code_dup_var.err_exp,v
retrieving revision 1.10
diff -u -b -r1.10 pragma_c_code_dup_var.err_exp
--- tests/invalid/pragma_c_code_dup_var.err_exp 7 Sep 2006 05:51:31 -0000 1.10
+++ tests/invalid/pragma_c_code_dup_var.err_exp 22 Jul 2009 16:20:36 -0000
@@ -1,5 +1,5 @@
+pragma_c_code_dup_var.m:014: Error: no clauses for function `bread_impl'/7.
pragma_c_code_dup_var.m:019: In `:- pragma foreign_proc' declaration for
pragma_c_code_dup_var.m:019: function `pragma_c_code_dup_var.bread_impl'/6:
pragma_c_code_dup_var.m:019: error: variable `Buf' occurs multiple times in
pragma_c_code_dup_var.m:019: the argument list.
-pragma_c_code_dup_var.m:014: Error: no clauses for function `bread_impl'/7.
Index: tests/invalid/predmode.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/predmode.err_exp,v
retrieving revision 1.11
diff -u -b -r1.11 predmode.err_exp
--- tests/invalid/predmode.err_exp 16 Jul 2008 03:30:59 -0000 1.11
+++ tests/invalid/predmode.err_exp 22 Jul 2009 16:20:38 -0000
@@ -1,4 +1,3 @@
-predmode.m:005: Error: some but not all arguments have modes.
predmode.m:001: Warning: interface for module `predmode' does not export
predmode.m:001: anything.
predmode.m:001: To be useful, a module should export something. A file should
@@ -6,3 +5,4 @@
predmode.m:001: `:- import_module' in its interface section(s). This would
predmode.m:001: normally be a `:- pred', `:- func', `:- type', `:- inst'
predmode.m:001: or `:- mode' declaration.
+predmode.m:005: Error: some but not all arguments have modes.
Index: tests/invalid/qualified_cons_id2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/qualified_cons_id2.err_exp,v
retrieving revision 1.11
diff -u -b -r1.11 qualified_cons_id2.err_exp
--- tests/invalid/qualified_cons_id2.err_exp 28 May 2007 01:06:25 -0000 1.11
+++ tests/invalid/qualified_cons_id2.err_exp 22 Jul 2009 16:20:44 -0000
@@ -1,3 +1,7 @@
+qualified_cons_id2.m:015: In `test'(in(bound(qualified_cons_id2.yes(ground))),
+qualified_cons_id2.m:015: out):
+qualified_cons_id2.m:015: error: determinism declaration not satisfied.
+qualified_cons_id2.m:015: Declared `det', inferred `failure'.
qualified_cons_id2.m:015: In mode declarations for predicate
qualified_cons_id2.m:015: `qualified_cons_id2.test'/2:
qualified_cons_id2.m:015: error: duplicate mode declaration.
@@ -10,8 +14,4 @@
qualified_cons_id2.m:020: cannot succeed
qualified_cons_id2.m:020: `HeadVar__1' has instantiatedness
qualified_cons_id2.m:020: `bound(qualified_cons_id2.yes(ground))'.
-qualified_cons_id2.m:015: In `test'(in(bound(qualified_cons_id2.yes(ground))),
-qualified_cons_id2.m:015: out):
-qualified_cons_id2.m:015: error: determinism declaration not satisfied.
-qualified_cons_id2.m:015: Declared `det', inferred `failure'.
For more information, recompile with `-E'.
Index: tests/invalid/record_syntax_errors.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/record_syntax_errors.err_exp,v
retrieving revision 1.20
diff -u -b -r1.20 record_syntax_errors.err_exp
--- tests/invalid/record_syntax_errors.err_exp 16 Apr 2009 02:09:08 -0000 1.20
+++ tests/invalid/record_syntax_errors.err_exp 22 Jul 2009 16:20:48 -0000
@@ -1,30 +1,15 @@
+record_syntax_errors.m:014: Error: no clauses for predicate `dcg_syntax'/2.
+record_syntax_errors.m:016: Error: no clauses for predicate `dcg_syntax_2'/2.
record_syntax_errors.m:023: Error: mode declaration for function
record_syntax_errors.m:023: `record_syntax_errors.field8'/1
record_syntax_errors.m:023: without preceding `func' declaration.
+record_syntax_errors.m:023: Inferred :- func field8(record_syntax_errors.cons2)
+record_syntax_errors.m:023: = int.
record_syntax_errors.m:028: In DCG field update goal:
record_syntax_errors.m:028: error: expected field name at term `Field'.
record_syntax_errors.m:031: Error: expected `Field =^ field1 ^ ... ^ fieldN' or
record_syntax_errors.m:031: `^ field1 ^ ... ^ fieldN := Field' in DCG field
record_syntax_errors.m:031: access goal.
-record_syntax_errors.m:048: Error: clause for predicate
-record_syntax_errors.m:048: `record_syntax_errors.term_type_error'/1
-record_syntax_errors.m:048: without preceding `pred' declaration.
-record_syntax_errors.m:054: In declaration of function
-record_syntax_errors.m:054: `record_syntax_errors.field4'/1:
-record_syntax_errors.m:054: error: a field access function for an exported
-record_syntax_errors.m:054: field must also be exported.
-record_syntax_errors.m:057: Error: clause for automatically generated field
-record_syntax_errors.m:057: access function `record_syntax_errors.field4'/1.
-record_syntax_errors.m:057: Clauses for field access functions are
-record_syntax_errors.m:057: automatically generated by the compiler. To
-record_syntax_errors.m:057: supply your own definition for a field access
-record_syntax_errors.m:057: function, for example to check the input to a
-record_syntax_errors.m:057: field update, give the field of the constructor a
-record_syntax_errors.m:057: different name.
-record_syntax_errors.m:014: Error: no clauses for predicate `dcg_syntax'/2.
-record_syntax_errors.m:016: Error: no clauses for predicate `dcg_syntax_2'/2.
-record_syntax_errors.m:023: Inferred :- func field8(record_syntax_errors.cons2)
-record_syntax_errors.m:023: = int.
record_syntax_errors.m:042: In clause for predicate `construct_exist_cons'/1:
record_syntax_errors.m:042: error: undefined symbol `field2 :=/2'.
record_syntax_errors.m:006: Field `field2' cannot be updated because the
@@ -40,6 +25,9 @@
record_syntax_errors.m:046: `field7 :=/2'.
record_syntax_errors.m:046: Argument 2 has type `string',
record_syntax_errors.m:046: expected type was `int'.
+record_syntax_errors.m:048: Error: clause for predicate
+record_syntax_errors.m:048: `record_syntax_errors.term_type_error'/1
+record_syntax_errors.m:048: without preceding `pred' declaration.
record_syntax_errors.m:050: In clause for predicate `term_type_error'/1:
record_syntax_errors.m:050: in argument 2 of functor `field6 :=/2':
record_syntax_errors.m:050: in unification of argument
@@ -48,3 +36,15 @@
record_syntax_errors.m:050: `field4 :=/2'.
record_syntax_errors.m:050: Argument 1 has type `record_syntax_errors.cons2',
record_syntax_errors.m:050: expected type was `record_syntax_errors.cons'.
+record_syntax_errors.m:054: In declaration of function
+record_syntax_errors.m:054: `record_syntax_errors.field4'/1:
+record_syntax_errors.m:054: error: a field access function for an exported
+record_syntax_errors.m:054: field must also be exported.
+record_syntax_errors.m:057: Error: clause for automatically generated field
+record_syntax_errors.m:057: access function `record_syntax_errors.field4'/1.
+record_syntax_errors.m:057: Clauses for field access functions are
+record_syntax_errors.m:057: automatically generated by the compiler. To
+record_syntax_errors.m:057: supply your own definition for a field access
+record_syntax_errors.m:057: function, for example to check the input to a
+record_syntax_errors.m:057: field update, give the field of the constructor a
+record_syntax_errors.m:057: different name.
Index: tests/invalid/reserve_tag.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/reserve_tag.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 reserve_tag.err_exp
--- tests/invalid/reserve_tag.err_exp 16 Jul 2008 03:30:59 -0000 1.6
+++ tests/invalid/reserve_tag.err_exp 22 Jul 2009 16:20:48 -0000
@@ -1,8 +1,8 @@
-reserve_tag.m:023: Error: expected type name/arity for `:- pragma reserve_tag'
-reserve_tag.m:023: declaration, not `(list__list / 1)'.
reserve_tag.m:021: In `pragma reserve_tag' declaration for
reserve_tag.m:021: `reserve_tag.undefined_type'/1:
reserve_tag.m:021: error: undefined type `reserve_tag.undefined_type'/1.
+reserve_tag.m:023: Error: expected type name/arity for `:- pragma reserve_tag'
+reserve_tag.m:023: declaration, not `(list__list / 1)'.
reserve_tag.m:024: In `pragma reserve_tag' declaration for
reserve_tag.m:024: `reserve_tag.list'/1:
reserve_tag.m:024: error: undefined type `reserve_tag.list'/1.
Index: tests/invalid/some.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/some.err_exp,v
retrieving revision 1.9
diff -u -b -r1.9 some.err_exp
--- tests/invalid/some.err_exp 16 Jul 2008 03:30:59 -0000 1.9
+++ tests/invalid/some.err_exp 22 Jul 2009 16:20:49 -0000
@@ -1,8 +1,8 @@
+some.m:005: Error: no clauses for predicate `p1'/1.
some.m:006: Error: unrecognized declaration:
some.m:006: (some junk (pred (p2((int :: in)) is semidet))).
+some.m:007: Error: no clauses for predicate `p3'/1.
some.m:012: In first argument of `some': expected list of variables and/or
some.m:012: state variables, not junk.
some.m:013: In first argument of `some': expected list of variables and/or
some.m:013: state variables, not junk.
-some.m:005: Error: no clauses for predicate `p1'/1.
-some.m:007: Error: no clauses for predicate `p3'/1.
Index: tests/invalid/specified.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/specified.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 specified.err_exp
--- tests/invalid/specified.err_exp 16 Jul 2008 03:30:59 -0000 1.6
+++ tests/invalid/specified.err_exp 22 Jul 2009 16:20:50 -0000
@@ -1,10 +1,8 @@
-specified.m:155: Error: expected argument tabling method, not `implied'.
-specified.m:274: Error: expected one or two arguments for `specified'.
-specified.m:282: Error: expected hidden argument tabling method, not `voodoo'.
specified.m:138: Error in `pragma memo' declaration for predicate
specified.m:138: `specified.ap_lp_fib'/3:
specified.m:138: argument 3: argument tabling method `addr' is not compatible
specified.m:138: with output modes.
+specified.m:155: Error: expected argument tabling method, not `implied'.
specified.m:170: Error in `pragma memo' declaration for predicate
specified.m:170: `specified.ap_li_fib'/3:
specified.m:170: not enough argument tabling methods specified.
@@ -15,3 +13,5 @@
specified.m:230: Error in `pragma memo' declaration for predicate
specified.m:230: `specified.vv_ll_fib'/3:
specified.m:230: too many argument tabling methods specified.
+specified.m:274: Error: expected one or two arguments for `specified'.
+specified.m:282: Error: expected hidden argument tabling method, not `voodoo'.
Index: tests/invalid/state_vars_test1.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/state_vars_test1.err_exp,v
retrieving revision 1.7
diff -u -b -r1.7 state_vars_test1.err_exp
--- tests/invalid/state_vars_test1.err_exp 7 Sep 2006 05:51:32 -0000 1.7
+++ tests/invalid/state_vars_test1.err_exp 22 Jul 2009 16:20:52 -0000
@@ -1,6 +1,6 @@
+state_vars_test1.m:022: Warning: the condition of this if-then-else cannot
+state_vars_test1.m:022: fail.
state_vars_test1.m:023: Error: cannot use !:X in this context;
state_vars_test1.m:023: however !.X may be used here.
state_vars_test1.m:023: In clause for predicate `state_vars_test1.p'/2:
state_vars_test1.m:023: warning: variable `X' occurs only once in this scope.
-state_vars_test1.m:022: Warning: the condition of this if-then-else cannot
-state_vars_test1.m:022: fail.
Index: tests/invalid/state_vars_test2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/state_vars_test2.err_exp,v
retrieving revision 1.8
diff -u -b -r1.8 state_vars_test2.err_exp
--- tests/invalid/state_vars_test2.err_exp 7 Sep 2006 05:51:32 -0000 1.8
+++ tests/invalid/state_vars_test2.err_exp 22 Jul 2009 16:20:52 -0000
@@ -1,6 +1,6 @@
+state_vars_test2.m:022: Warning: the condition of this if-then-else cannot
+state_vars_test2.m:022: fail.
state_vars_test2.m:023: Error: state variable !:Y is not visible in this
state_vars_test2.m:023: context.
state_vars_test2.m:023: In clause for predicate `state_vars_test2.p'/2:
state_vars_test2.m:023: warning: variable `Y' occurs only once in this scope.
-state_vars_test2.m:022: Warning: the condition of this if-then-else cannot
-state_vars_test2.m:022: fail.
Index: tests/invalid/state_vars_test3.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/state_vars_test3.err_exp,v
retrieving revision 1.11
diff -u -b -r1.11 state_vars_test3.err_exp
--- tests/invalid/state_vars_test3.err_exp 10 Sep 2006 23:39:16 -0000 1.11
+++ tests/invalid/state_vars_test3.err_exp 22 Jul 2009 16:20:53 -0000
@@ -1,6 +1,6 @@
+state_vars_test3.m:015: Error: no clauses for function `f'/1.
state_vars_test3.m:021: Error: !Y cannot be a function result.
state_vars_test3.m:021: You probably meant !.Y or !:Y.
state_vars_test3.m:021: Error: clause for function `state_vars_test3.f'/2
state_vars_test3.m:021: without preceding `func' declaration.
-state_vars_test3.m:015: Error: no clauses for function `f'/1.
state_vars_test3.m:021: Error: no clauses for function `f'/2.
Index: tests/invalid/state_vars_test5.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/state_vars_test5.err_exp,v
retrieving revision 1.10
diff -u -b -r1.10 state_vars_test5.err_exp
--- tests/invalid/state_vars_test5.err_exp 7 Sep 2006 05:51:33 -0000 1.10
+++ tests/invalid/state_vars_test5.err_exp 22 Jul 2009 16:20:55 -0000
@@ -1,9 +1,9 @@
-state_vars_test5.m:021: In clause for predicate `state_vars_test5.p'/1:
-state_vars_test5.m:021: warning: variable `STATE_VARIABLE_X' occurs only once
-state_vars_test5.m:021: in this scope.
state_vars_test5.m:021: In clause for `p(out)':
state_vars_test5.m:021: mode error: argument 1 did not get sufficiently
state_vars_test5.m:021: instantiated.
state_vars_test5.m:021: Final instantiatedness of `STATE_VARIABLE_X' was
state_vars_test5.m:021: `free',
state_vars_test5.m:021: expected final instantiatedness was `ground'.
+state_vars_test5.m:021: In clause for predicate `state_vars_test5.p'/1:
+state_vars_test5.m:021: warning: variable `STATE_VARIABLE_X' occurs only once
+state_vars_test5.m:021: in this scope.
Index: tests/invalid/test_feature_set.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/test_feature_set.err_exp,v
retrieving revision 1.1
diff -u -b -r1.1 test_feature_set.err_exp
--- tests/invalid/test_feature_set.err_exp 5 Dec 2007 05:07:45 -0000 1.1
+++ tests/invalid/test_feature_set.err_exp 24 Jul 2009 02:34:24 -0000
@@ -5,7 +5,7 @@
test_feature_set.m:008: Error: this module must be compiled in a grade that
test_feature_set.m:008: supports trailing.
test_feature_set.m:008: Grades that support trailing contain the grade
-test_feature_set.m:008: modifier `tr'.
+test_feature_set.m:008: modifiers `tr' or `trseg'.
test_feature_set.m:008: Error: this module must be compiled in a grade that
test_feature_set.m:008: uses single precision floats.
test_feature_set.m:008: Grades that use single precision floats contain the
Index: tests/invalid/test_feature_set.err_exp2
===================================================================
RCS file: tests/invalid/test_feature_set.err_exp2
diff -N tests/invalid/test_feature_set.err_exp2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/invalid/test_feature_set.err_exp2 23 Jul 2009 19:01:48 -0000
@@ -0,0 +1,8 @@
+test_feature_set.m:008: Error: this module must be compiled in a grade that
+test_feature_set.m:008: supports concurrent execution.
+test_feature_set.m:008: Error: this module must be compiled in a grade that
+test_feature_set.m:008: supports memoisation.
+test_feature_set.m:008: Error: this module must be compiled in a grade that
+test_feature_set.m:008: uses single precision floats.
+test_feature_set.m:008: Grades that use single precision floats contain the
+test_feature_set.m:008: grade modifier `spf'.
Index: tests/invalid/trace_goal_env.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/trace_goal_env.err_exp,v
retrieving revision 1.4
diff -u -b -r1.4 trace_goal_env.err_exp
--- tests/invalid/trace_goal_env.err_exp 10 Mar 2009 05:00:34 -0000 1.4
+++ tests/invalid/trace_goal_env.err_exp 22 Jul 2009 16:21:08 -0000
@@ -1,5 +1,5 @@
+trace_goal_env.m:020: Error: no clauses for predicate `p'/2.
trace_goal_env.m:023: Error: runtime takes exactly one argument, which should
trace_goal_env.m:023: be a boolean expression of run-time tests.
trace_goal_env.m:030: Error: invalid trace goal parameter
trace_goal_env.m:030: `(not runtime(env("TRACE_ABC")))'.
-trace_goal_env.m:020: Error: no clauses for predicate `p'/2.
Index: tests/invalid/try_bad_params.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/try_bad_params.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 try_bad_params.err_exp
--- tests/invalid/try_bad_params.err_exp 16 Apr 2009 02:09:09 -0000 1.2
+++ tests/invalid/try_bad_params.err_exp 22 Jul 2009 16:21:14 -0000
@@ -1,10 +1,7 @@
-try_bad_params.m:020: Duplicate io try parameter.
-try_bad_params.m:029: Error: invalid try goal parameter `bloop'.
-try_bad_params.m:047: Error: the argument of io should be a state variable.
-try_bad_params.m:056: Error: io takes exactly one argument, which should be a
-try_bad_params.m:056: state variable name.
try_bad_params.m:008: Error: no clauses for predicate `main'/2.
+try_bad_params.m:020: Duplicate io try parameter.
try_bad_params.m:026: Error: no clauses for predicate `main_2'/2.
+try_bad_params.m:029: Error: invalid try goal parameter `bloop'.
try_bad_params.m:040: In clause for predicate `main_3'/2:
try_bad_params.m:040: in argument 2 of call to predicate
try_bad_params.m:040: `exception.rethrow'/1:
@@ -18,5 +15,8 @@
try_bad_params.m:040: `int',
try_bad_params.m:040: expected type was `io.state'.
try_bad_params.m:044: Error: no clauses for predicate `main_4'/1.
+try_bad_params.m:047: Error: the argument of io should be a state variable.
try_bad_params.m:053: Error: no clauses for predicate `main_5'/2.
+try_bad_params.m:056: Error: io takes exactly one argument, which should be a
+try_bad_params.m:056: state variable name.
For more information, recompile with `-E'.
Index: tests/invalid/type_inf_loop.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/type_inf_loop.err_exp,v
retrieving revision 1.8
diff -u -b -r1.8 type_inf_loop.err_exp
--- tests/invalid/type_inf_loop.err_exp 14 Sep 2006 06:01:16 -0000 1.8
+++ tests/invalid/type_inf_loop.err_exp 25 Jul 2009 12:08:34 -0000
@@ -1,11 +1,11 @@
-type_inf_loop.m:001: Warning: interface for module `type_inf_loop' does not
-type_inf_loop.m:001: export anything.
-type_inf_loop.m:004: Error: clause for predicate `type_inf_loop.loop'/1
-type_inf_loop.m:004: without preceding `pred' declaration.
Type inference iteration limit exceeded. This probably indicates that your
program has a type error. You should declare the types explicitly. (The
current limit is 60 iterations. You can use the
`--type-inference-iteration-limit' option to increase the limit).
+type_inf_loop.m:001: Warning: interface for module `type_inf_loop' does not
+type_inf_loop.m:001: export anything.
+type_inf_loop.m:004: Error: clause for predicate `type_inf_loop.loop'/1
+type_inf_loop.m:004: without preceding `pred' declaration.
type_inf_loop.m:004: Inferred :- pred loop((pred (pred (pred (pred (pred (pred
type_inf_loop.m:004: (pred (pred (pred (pred (pred (pred (pred (pred (pred
type_inf_loop.m:004: (pred (pred (pred (pred (pred (pred (pred (pred (pred
Index: tests/invalid/type_vars.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/type_vars.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 type_vars.err_exp
--- tests/invalid/type_vars.err_exp 16 Jul 2008 03:30:59 -0000 1.6
+++ tests/invalid/type_vars.err_exp 22 Jul 2009 16:21:21 -0000
@@ -1,10 +1,3 @@
-type_vars.m:007: Error: type variable T2 in existential quantifier does not
-type_vars.m:007: occur in arguments or constraints of constructor.
-type_vars.m:008: Error: type variable T1 has overlapping scopes (explicit type
-type_vars.m:008: quantifier shadows argument type).
-type_vars.m:009: Error: type variable T2 in class constraints, which was
-type_vars.m:009: introduced with `=>' must be explicitly existentially
-type_vars.m:009: quantified using `some'.
type_vars.m:006: In declaration for type `type_vars.t1'/0:
type_vars.m:006: error in type class constraints: type variable T2 occurs in
type_vars.m:006: the constraints, but is not determined by the constructor's
@@ -24,3 +17,10 @@
type_vars.m:006: determined.
type_vars.m:006: See the "Functional dependencies" section of the reference
type_vars.m:006: manual for details.
+type_vars.m:007: Error: type variable T2 in existential quantifier does not
+type_vars.m:007: occur in arguments or constraints of constructor.
+type_vars.m:008: Error: type variable T1 has overlapping scopes (explicit type
+type_vars.m:008: quantifier shadows argument type).
+type_vars.m:009: Error: type variable T2 in class constraints, which was
+type_vars.m:009: introduced with `=>' must be explicitly existentially
+type_vars.m:009: quantified using `some'.
Index: tests/invalid/typeclass_mode_2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/typeclass_mode_2.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 typeclass_mode_2.err_exp
--- tests/invalid/typeclass_mode_2.err_exp 7 Sep 2006 05:51:33 -0000 1.2
+++ tests/invalid/typeclass_mode_2.err_exp 21 Jul 2009 13:58:28 -0000
@@ -3,6 +3,6 @@
typeclass_mode_2.m:005: predicate method declaration.
typeclass_mode_2.m:010: Error: clause for predicate `typeclass_mode_2.p'/1
typeclass_mode_2.m:010: without preceding `pred' declaration.
-typeclass_mode_2.m:010: Inferred :- pred p(T1).
typeclass_mode_2.m:010: Error: no mode declaration for predicate `p'/1.
+typeclass_mode_2.m:010: Inferred :- pred p(T1).
For more information, recompile with `-E'.
Index: tests/invalid/typeclass_mode_3.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/typeclass_mode_3.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 typeclass_mode_3.err_exp
--- tests/invalid/typeclass_mode_3.err_exp 7 Sep 2006 05:51:34 -0000 1.2
+++ tests/invalid/typeclass_mode_3.err_exp 22 Jul 2009 16:21:30 -0000
@@ -1,5 +1,5 @@
+typeclass_mode_3.m:004: Error: no mode declaration for exported predicate
+typeclass_mode_3.m:004: `typeclass_mode_3.p'/1.
typeclass_mode_3.m:007: Error: mode declaration for type class method
typeclass_mode_3.m:007: `typeclass_mode_3.p'/1 without corresponding
typeclass_mode_3.m:007: predicate method declaration.
-typeclass_mode_3.m:004: Error: no mode declaration for exported predicate
-typeclass_mode_3.m:004: `typeclass_mode_3.p'/1.
Index: tests/invalid/typeclass_mode_4.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/typeclass_mode_4.err_exp,v
retrieving revision 1.2
diff -u -b -r1.2 typeclass_mode_4.err_exp
--- tests/invalid/typeclass_mode_4.err_exp 7 Sep 2006 05:51:34 -0000 1.2
+++ tests/invalid/typeclass_mode_4.err_exp 22 Jul 2009 16:21:31 -0000
@@ -1,5 +1,5 @@
+typeclass_mode_4.m:004: Error: no mode declaration for exported predicate
+typeclass_mode_4.m:004: `typeclass_mode_4.p'/1.
typeclass_mode_4.m:007: Error: mode declaration for type class method
typeclass_mode_4.m:007: `typeclass_mode_4.p'/1 without corresponding
typeclass_mode_4.m:007: predicate method declaration.
-typeclass_mode_4.m:004: Error: no mode declaration for exported predicate
-typeclass_mode_4.m:004: `typeclass_mode_4.p'/1.
Index: tests/invalid/typeclass_test_1.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/typeclass_test_1.err_exp,v
retrieving revision 1.9
diff -u -b -r1.9 typeclass_test_1.err_exp
--- tests/invalid/typeclass_test_1.err_exp 16 Jul 2008 03:30:59 -0000 1.9
+++ tests/invalid/typeclass_test_1.err_exp 22 Jul 2009 16:21:32 -0000
@@ -1,10 +1,10 @@
typeclass_test_1.m:001: Warning: module should start with a `:- module'
typeclass_test_1.m:001: declaration.
+typeclass_test_1.m:007: In clause for predicate `main'/2:
+typeclass_test_1.m:007: unsatisfiable typeclass constraint:
+typeclass_test_1.m:007: `typeclass_test_1.numbered_type(int)'.
typeclass_test_1.m:014: Error: expected
typeclass_test_1.m:014: `pred(<Name> / <Arity>) is <InstanceName>' or
typeclass_test_1.m:014: `func(<Name> / <Arity>) is <InstanceName>', not
typeclass_test_1.m:014: (type_num is foo_type_num).
typeclass_test_1.m:017: Syntax error at variable `_': operator or `.' expected.
-typeclass_test_1.m:007: In clause for predicate `main'/2:
-typeclass_test_1.m:007: unsatisfiable typeclass constraint:
-typeclass_test_1.m:007: `typeclass_test_1.numbered_type(int)'.
Index: tests/invalid/typeclass_test_11.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/typeclass_test_11.err_exp,v
retrieving revision 1.5
diff -u -b -r1.5 typeclass_test_11.err_exp
--- tests/invalid/typeclass_test_11.err_exp 16 Jul 2008 03:30:59 -0000 1.5
+++ tests/invalid/typeclass_test_11.err_exp 22 Jul 2009 16:21:33 -0000
@@ -1,5 +1,3 @@
-typeclass_test_11.m:004: Error: constraints on class declarations may only
-typeclass_test_11.m:004: constrain type variables and ground types.
typeclass_test_11.m:001: Warning: interface for module `typeclass_test_11' does
typeclass_test_11.m:001: not export anything.
typeclass_test_11.m:001: To be useful, a module should export something. A
@@ -7,3 +5,5 @@
typeclass_test_11.m:001: than `:- import_module' in its interface section(s).
typeclass_test_11.m:001: This would normally be a `:- pred', `:- func',
typeclass_test_11.m:001: `:- type', `:- inst' or `:- mode' declaration.
+typeclass_test_11.m:004: Error: constraints on class declarations may only
+typeclass_test_11.m:004: constrain type variables and ground types.
Index: tests/invalid/typeclass_test_2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/typeclass_test_2.err_exp,v
retrieving revision 1.15
diff -u -b -r1.15 typeclass_test_2.err_exp
--- tests/invalid/typeclass_test_2.err_exp 16 Jul 2008 03:30:59 -0000 1.15
+++ tests/invalid/typeclass_test_2.err_exp 22 Jul 2009 16:21:36 -0000
@@ -1,3 +1,6 @@
+typeclass_test_2.m:010: In clause for predicate `main'/2:
+typeclass_test_2.m:010: unsatisfiable typeclass constraint:
+typeclass_test_2.m:010: `typeclass_test_2.numbered_type(int)'.
typeclass_test_2.m:020: Error: expected
typeclass_test_2.m:020: `pred(<Name> / <Arity>) is <InstanceName>' or
typeclass_test_2.m:020: `func(<Name> / <Arity>) is <InstanceName>', not
@@ -5,7 +8,4 @@
typeclass_test_2.m:023: Error: clause for function
typeclass_test_2.m:023: `typeclass_test_2.foo_type_num'/1
typeclass_test_2.m:023: without preceding `func' declaration.
-typeclass_test_2.m:010: In clause for predicate `main'/2:
-typeclass_test_2.m:010: unsatisfiable typeclass constraint:
-typeclass_test_2.m:010: `typeclass_test_2.numbered_type(int)'.
typeclass_test_2.m:023: Inferred :- func foo_type_num(T1) = int.
Index: tests/invalid/types2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/types2.err_exp,v
retrieving revision 1.1
diff -u -b -r1.1 types2.err_exp
--- tests/invalid/types2.err_exp 17 May 2007 06:15:34 -0000 1.1
+++ tests/invalid/types2.err_exp 22 Jul 2009 16:21:43 -0000
@@ -1,7 +1,3 @@
-types2.m:017: Error: clause for predicate `types2.r'/0
-types2.m:017: without preceding `pred' declaration.
-types2.m:020: Error: clause for predicate `types2.a'/1
-types2.m:020: without preceding `pred' declaration.
types2.m:005: Error: no clauses for predicate `p'/1.
types2.m:012: In clause for predicate `q'/0:
types2.m:012: error: undefined predicate `zzzzzzzz'/0.
@@ -15,8 +11,12 @@
types2.m:014: In clause for predicate `q'/0:
types2.m:014: error: wrong number of arguments (0; should be 1)
types2.m:014: in call to predicate `p'.
+types2.m:017: Error: clause for predicate `types2.r'/0
+types2.m:017: without preceding `pred' declaration.
types2.m:018: In clause for predicate `r'/0:
types2.m:018: error: undefined predicate `s'/0.
+types2.m:020: Error: clause for predicate `types2.a'/1
+types2.m:020: without preceding `pred' declaration.
types2.m:020: In clause for predicate `a'/1:
types2.m:020: error: undefined predicate `b'/1.
types2.m:039: In clause for predicate `bar'/1:
@@ -27,6 +27,6 @@
types2.m:039: The partial type assignment was:
types2.m:039: some [BarTypeParam_1]
types2.m:039: X_2: BarTypeParam
-types2.m:050: Error: no clauses for predicate `bar2'/1.
types2.m:048: Error: abstract declaration for type `types2.t'/2 has no
types2.m:048: corresponding definition.
+types2.m:050: Error: no clauses for predicate `bar2'/1.
Index: tests/invalid/undef_mode_and_no_clauses.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/undef_mode_and_no_clauses.err_exp,v
retrieving revision 1.7
diff -u -b -r1.7 undef_mode_and_no_clauses.err_exp
--- tests/invalid/undef_mode_and_no_clauses.err_exp 7 Sep 2006 05:51:35 -0000 1.7
+++ tests/invalid/undef_mode_and_no_clauses.err_exp 22 Jul 2009 16:21:52 -0000
@@ -1,4 +1,4 @@
+undef_mode_and_no_clauses.m:011: Error: no clauses for predicate `p'/2.
undef_mode_and_no_clauses.m:012: In mode declaration for predicate
undef_mode_and_no_clauses.m:012: `undef_mode_and_no_clauses.p'/2:
undef_mode_and_no_clauses.m:012: error: undefined mode `result'/1.
-undef_mode_and_no_clauses.m:011: Error: no clauses for predicate `p'/2.
Index: tests/invalid/unicode1.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/unicode1.err_exp,v
retrieving revision 1.3
diff -u -b -r1.3 unicode1.err_exp
--- tests/invalid/unicode1.err_exp 16 Jul 2008 03:30:59 -0000 1.3
+++ tests/invalid/unicode1.err_exp 22 Jul 2009 16:21:56 -0000
@@ -1,5 +1,5 @@
-unicode1.m:005: Syntax error at token 'int': operator or `.' expected.
-unicode1.m:005: Syntax error: invalid hex character in Unicode escape.
unicode1.m:001: Warning: interface for module `unicode1' does not export
unicode1.m:001: anything.
+unicode1.m:005: Syntax error at token 'int': operator or `.' expected.
+unicode1.m:005: Syntax error: invalid hex character in Unicode escape.
For more information, recompile with `-E'.
Index: tests/invalid/unicode2.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/unicode2.err_exp,v
retrieving revision 1.3
diff -u -b -r1.3 unicode2.err_exp
--- tests/invalid/unicode2.err_exp 16 Jul 2008 03:30:59 -0000 1.3
+++ tests/invalid/unicode2.err_exp 22 Jul 2009 16:21:56 -0000
@@ -1,5 +1,5 @@
-unicode2.m:005: Syntax error at token 'int': operator or `.' expected.
-unicode2.m:005: Syntax error: invalid Unicode character code.
unicode2.m:001: Warning: interface for module `unicode2' does not export
unicode2.m:001: anything.
+unicode2.m:005: Syntax error at token 'int': operator or `.' expected.
+unicode2.m:005: Syntax error: invalid Unicode character code.
For more information, recompile with `-E'.
Index: tests/invalid/uu_type.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/uu_type.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 uu_type.err_exp
--- tests/invalid/uu_type.err_exp 16 Jul 2008 03:30:59 -0000 1.6
+++ tests/invalid/uu_type.err_exp 22 Jul 2009 16:22:07 -0000
@@ -1,4 +1,4 @@
-uu_type.m:022: Error: type parameters must be variables: (hiddenrenamedtype =
-uu_type.m:022: hiddentype).
uu_type.m:012: Error: abstract declaration for type
uu_type.m:012: `uu_type.hiddenrenamedtype'/0 has no corresponding definition.
+uu_type.m:022: Error: type parameters must be variables: (hiddenrenamedtype =
+uu_type.m:022: hiddentype).
Index: tests/invalid/vars_in_wrong_places.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/vars_in_wrong_places.err_exp,v
retrieving revision 1.10
diff -u -b -r1.10 vars_in_wrong_places.err_exp
--- tests/invalid/vars_in_wrong_places.err_exp 16 Jul 2008 03:30:59 -0000 1.10
+++ tests/invalid/vars_in_wrong_places.err_exp 22 Jul 2009 16:22:08 -0000
@@ -1,3 +1,11 @@
+vars_in_wrong_places.m:001: Warning: interface for module
+vars_in_wrong_places.m:001: `vars_in_wrong_places' does not export anything.
+vars_in_wrong_places.m:001: To be useful, a module should export something. A
+vars_in_wrong_places.m:001: file should contain at least one declaration
+vars_in_wrong_places.m:001: other than `:- import_module' in its interface
+vars_in_wrong_places.m:001: section(s). This would normally be a `:- pred',
+vars_in_wrong_places.m:001: `:- func', `:- type', `:- inst' or `:- mode'
+vars_in_wrong_places.m:001: declaration.
vars_in_wrong_places.m:002: In clause head: error: atom expected at Oops1.
vars_in_wrong_places.m:003: In equation head: error: atom expected at Oops2.
vars_in_wrong_places.m:004: In equation head: error: atom expected at Oops3.
@@ -9,11 +17,3 @@
vars_in_wrong_places.m:007: Oops6.
vars_in_wrong_places.m:008: In function `:- mode' declaration error: atom
vars_in_wrong_places.m:008: expected at Oops7.
-vars_in_wrong_places.m:001: Warning: interface for module
-vars_in_wrong_places.m:001: `vars_in_wrong_places' does not export anything.
-vars_in_wrong_places.m:001: To be useful, a module should export something. A
-vars_in_wrong_places.m:001: file should contain at least one declaration
-vars_in_wrong_places.m:001: other than `:- import_module' in its interface
-vars_in_wrong_places.m:001: section(s). This would normally be a `:- pred',
-vars_in_wrong_places.m:001: `:- func', `:- type', `:- inst' or `:- mode'
-vars_in_wrong_places.m:001: declaration.
Index: tests/invalid/with_type.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/with_type.err_exp,v
retrieving revision 1.6
diff -u -b -r1.6 with_type.err_exp
--- tests/invalid/with_type.err_exp 16 Jul 2008 03:30:59 -0000 1.6
+++ tests/invalid/with_type.err_exp 22 Jul 2009 16:22:09 -0000
@@ -1,7 +1,3 @@
-with_type.m:024: Error: `with_inst' and determinism both specified.
-with_type.m:027: Error: `with_inst' specified without `with_type'.
-with_type.m:030: Error: invalid inst in `with_inst'.
-with_type.m:032: Error: `with_inst' specified without argument modes.
with_type.m:012: In type declaration for predicate `with_type.with_type_1':
with_type.m:012: error: expected higher order predicate type after
with_type.m:012: `with_type`.
@@ -10,8 +6,12 @@
with_type.m:018: In type declaration for function `with_type.with_type_2':
with_type.m:018: error: expected higher order function type after
with_type.m:018: `with_type`.
+with_type.m:019: Error: mode declaration for function `with_type.with_type_2'/3
+with_type.m:019: without preceding `func' declaration.
with_type.m:021: In type declaration for predicate `with_type.with_type_3':
with_type.m:021: error: the `with_type` and `with_inst` annotations are
with_type.m:021: incompatible.
-with_type.m:019: Error: mode declaration for function `with_type.with_type_2'/3
-with_type.m:019: without preceding `func' declaration.
+with_type.m:024: Error: `with_inst' and determinism both specified.
+with_type.m:027: Error: `with_inst' specified without `with_type'.
+with_type.m:030: Error: invalid inst in `with_inst'.
+with_type.m:032: Error: `with_inst' specified without argument modes.
cvs diff: Diffing tests/invalid/purity
Index: tests/invalid/purity/purity.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/purity/purity.err_exp,v
retrieving revision 1.14
diff -u -b -r1.14 purity.err_exp
--- tests/invalid/purity/purity.err_exp 12 Sep 2006 04:41:51 -0000 1.14
+++ tests/invalid/purity/purity.err_exp 22 Jul 2009 16:22:35 -0000
@@ -23,6 +23,18 @@
purity.m:096: purity error: call must be preceded by `impure' indicator.
purity.m:100: In call to semipure predicate `purity.semi'/0:
purity.m:100: purity error: call must be preceded by `semipure' indicator.
+purity.m:105: In clause for `e6':
+purity.m:105: in argument 1 of call to predicate `purity.in'/1:
+purity.m:105: mode error: variable `X' has instantiatedness `free',
+purity.m:105: expected instantiatedness was `ground'.
+purity.m:105: The goal could not be reordered, because it was followed by an
+purity.m:105: impure goal.
+purity.m:106: This is the location of the impure goal.
+purity.m:112: In clause for `e7':
+purity.m:112: in argument 1 of call to predicate `purity.imp1'/1:
+purity.m:112: mode error: variable `X' has instantiatedness `free',
+purity.m:112: expected instantiatedness was `ground'.
+purity.m:112: The goal could not be reordered, because it was impure.
purity.m:115: In unification predicate for type `e8':
purity.m:115: purity error: predicate is impure.
purity.m:115: It must be pure.
@@ -37,16 +49,4 @@
purity.m:148: purity error: call must be preceded by `semipure' indicator.
purity.m:148: Purity error in closure: closure body is semipure, but closure
purity.m:148: was not declared semipure.
-purity.m:105: In clause for `e6':
-purity.m:105: in argument 1 of call to predicate `purity.in'/1:
-purity.m:105: mode error: variable `X' has instantiatedness `free',
-purity.m:105: expected instantiatedness was `ground'.
-purity.m:105: The goal could not be reordered, because it was followed by an
-purity.m:105: impure goal.
-purity.m:106: This is the location of the impure goal.
-purity.m:112: In clause for `e7':
-purity.m:112: in argument 1 of call to predicate `purity.imp1'/1:
-purity.m:112: mode error: variable `X' has instantiatedness `free',
-purity.m:112: expected instantiatedness was `ground'.
-purity.m:112: The goal could not be reordered, because it was impure.
For more information, recompile with `-E'.
Index: tests/invalid/purity/purity_nonsense.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/purity/purity_nonsense.err_exp,v
retrieving revision 1.10
diff -u -b -r1.10 purity_nonsense.err_exp
--- tests/invalid/purity/purity_nonsense.err_exp 12 Sep 2006 04:41:51 -0000 1.10
+++ tests/invalid/purity/purity_nonsense.err_exp 22 Jul 2009 16:22:36 -0000
@@ -1,7 +1,5 @@
purity_nonsense.m:012: Error: clause for predicate `purity_nonsense.e12'/0
purity_nonsense.m:012: without preceding `pred' declaration.
-purity_nonsense.m:013: Error: clause for predicate `purity_nonsense.e13'/0
-purity_nonsense.m:013: without preceding `pred' declaration.
purity_nonsense.m:012: In clause for predicate `e12'/0:
purity_nonsense.m:012: error: `impure' marker in an inappropriate place.
purity_nonsense.m:012: In clause for predicate `e12'/0:
@@ -18,6 +16,8 @@
purity_nonsense.m:012: in argument 1 of functor `\\+/1':
purity_nonsense.m:012: in argument 1 of functor `impure/1':
purity_nonsense.m:012: error: undefined symbol `imp/0'.
+purity_nonsense.m:013: Error: clause for predicate `purity_nonsense.e13'/0
+purity_nonsense.m:013: without preceding `pred' declaration.
purity_nonsense.m:013: In clause for predicate `e13'/0:
purity_nonsense.m:013: error: `semipure' marker in an inappropriate place.
purity_nonsense.m:013: In clause for predicate `e13'/0:
Index: tests/invalid/purity/purity_type_error.err_exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/invalid/purity/purity_type_error.err_exp,v
retrieving revision 1.9
diff -u -b -r1.9 purity_type_error.err_exp
--- tests/invalid/purity/purity_type_error.err_exp 15 Feb 2007 00:41:58 -0000 1.9
+++ tests/invalid/purity/purity_type_error.err_exp 22 Jul 2009 16:22:41 -0000
@@ -1,3 +1,5 @@
+purity_type_error.m:009: In predicate `warn'/1:
+purity_type_error.m:009: warning: declared impure but actually pure.
purity_type_error.m:020: In clause for predicate `type_error'/1:
purity_type_error.m:020: in argument 1 of clause head:
purity_type_error.m:020: type error in unification of variable `HeadVar__1'
@@ -6,5 +8,3 @@
purity_type_error.m:020: constant `1.0' has type `float'.
purity_type_error.m:020: The partial type assignment was:
purity_type_error.m:020: HeadVar__1_1: int
-purity_type_error.m:009: In predicate `warn'/1:
-purity_type_error.m:009: warning: declared impure but actually pure.
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
Index: tests/warnings/inference_test.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/inference_test.exp,v
retrieving revision 1.4
diff -u -b -r1.4 inference_test.exp
--- tests/warnings/inference_test.exp 16 Apr 2009 02:09:09 -0000 1.4
+++ tests/warnings/inference_test.exp 22 Jul 2009 16:45:26 -0000
@@ -1,6 +1,6 @@
inference_test.m:016: Inferred :- func len_func(list.list(T)) = int.
inference_test.m:019: Inferred :- pred len(list.list(T), int).
+inference_test.m:019: Inferred :- mode len(in, out) is det.
inference_test.m:030: Inferred :- func int_zero = int.
inference_test.m:032: Inferred :- pred unused_pred(list.list(T), list.list(T))
inference_test.m:032: <= (inference_test.null(T)).
-inference_test.m:019: Inferred :- mode len(in, out) is det.
Index: tests/warnings/simple_code.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/simple_code.exp,v
retrieving revision 1.16
diff -u -b -r1.16 simple_code.exp
--- tests/warnings/simple_code.exp 28 May 2007 01:06:25 -0000 1.16
+++ tests/warnings/simple_code.exp 22 Jul 2009 16:45:49 -0000
@@ -1,12 +1,8 @@
+simple_code.m:010: Warning: this disjunct will never have any solutions.
+simple_code.m:015: Warning: the condition of this if-then-else cannot fail.
simple_code.m:018: In clause for `p(in, out)':
simple_code.m:018: warning: unification of `X' and 2 cannot succeed
simple_code.m:018: `X' has instantiatedness `unique(3)'.
-simple_code.m:064: In clause for `r(in(bound(1)), out(bound(42)))':
-simple_code.m:064: in argument 1 of clause head:
-simple_code.m:064: warning: unification of `HeadVar__1' and 2 cannot succeed
-simple_code.m:064: `HeadVar__1' has instantiatedness `bound(1)'.
-simple_code.m:010: Warning: this disjunct will never have any solutions.
-simple_code.m:015: Warning: the condition of this if-then-else cannot fail.
simple_code.m:020: Warning: the condition of this if-then-else cannot succeed.
simple_code.m:025: Warning: the condition of this if-then-else cannot succeed.
simple_code.m:028: Warning: the negated goal cannot fail.
@@ -17,4 +13,8 @@
simple_code.m:039: Warning: call to obsolete predicate
simple_code.m:039: `simple_code.obsolete'/0.
simple_code.m:042: Warning: the condition of this if-then-else cannot fail.
+simple_code.m:064: In clause for `r(in(bound(1)), out(bound(42)))':
+simple_code.m:064: in argument 1 of clause head:
+simple_code.m:064: warning: unification of `HeadVar__1' and 2 cannot succeed
+simple_code.m:064: `HeadVar__1' has instantiatedness `bound(1)'.
simple_code.m:097: Warning: recursive call will lead to infinite recursion.
Index: tests/warnings/singleton_test.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/singleton_test.exp,v
retrieving revision 1.14
diff -u -b -r1.14 singleton_test.exp
--- tests/warnings/singleton_test.exp 23 Aug 2007 04:08:39 -0000 1.14
+++ tests/warnings/singleton_test.exp 22 Jul 2009 16:45:51 -0000
@@ -1,3 +1,10 @@
+singleton_test.m:008: In function `my_append_func'/2:
+singleton_test.m:008: warning: unresolved polymorphism.
+singleton_test.m:008: The variables with unbound types were:
+singleton_test.m:008: L2: V_1
+singleton_test.m:008: L1: V_1
+singleton_test.m:008: The unbound type variables will be implicitly bound to
+singleton_test.m:008: the builtin type `void'.
singleton_test.m:022: In clause for predicate `singleton_test.my_append'/3:
singleton_test.m:022: warning: variable `L2' occurs only once in this scope.
singleton_test.m:026: In clause for function `singleton_test.my_append_func'/2:
@@ -12,10 +19,3 @@
singleton_test.m:063: In the C code for predicate
singleton_test.m:063: `singleton_test.c_hello_world'/3:
singleton_test.m:063: warning: variable `Msg' does not occur in the C code.
-singleton_test.m:008: In function `my_append_func'/2:
-singleton_test.m:008: warning: unresolved polymorphism.
-singleton_test.m:008: The variables with unbound types were:
-singleton_test.m:008: L2: V_1
-singleton_test.m:008: L1: V_1
-singleton_test.m:008: The unbound type variables will be implicitly bound to
-singleton_test.m:008: the builtin type `void'.
Index: tests/warnings/warn_dead_procs.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/warnings/warn_dead_procs.exp,v
retrieving revision 1.3
diff -u -b -r1.3 warn_dead_procs.exp
--- tests/warnings/warn_dead_procs.exp 7 Sep 2006 05:51:48 -0000 1.3
+++ tests/warnings/warn_dead_procs.exp 22 Jul 2009 16:46:25 -0000
@@ -1,4 +1,4 @@
-warn_dead_procs.m:016: Inferred :- pred baz.
warn_dead_procs.m:008: Warning: predicate `foo'/0 mode 0 is never called.
warn_dead_procs.m:012: Warning: predicate `bar'/1 mode 0 is never called.
warn_dead_procs.m:013: Warning: predicate `bar'/1 mode 1 is never called.
+warn_dead_procs.m:016: Inferred :- pred baz.
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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