compiler/error_spec.m:
This new module contains the part of the old error_util.m that defines
the error_spec type, and some functions that can help construct pieces
of error_specs. Most modules of the compiler that deal with errors
will need to import only this part of the old error_util.m.
This change also renames the format_component type to format_piece,
which matches our long-standing naming convention for variables containing
(lists of) values of this type.
compiler/write_error_spec.m:
This new module contains the part of the old error_util.m that
writes out error specs, and converts them to strings.
This diff marks as obsolete the versions of predicates that
write out error specs to the current output stream, without
*explicitly* specifying the intended stream.
compiler/error_sort.m:
This new module contains the part of the old error_util.m that
sorts lists of error specs and error msgs.
compiler/error_type_util.m:
This new module contains the part of the old error_util.m that
convert types to format_pieces that generate readable output.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Include and document the new modules.
compiler/error_util.m:
The code remaining in the original error_util.m consists of
general utility predicates and functions that don't fit into
any of the modules above.
Delete an unneeded pair of I/O states from the argument list
of a predicate.
compiler/file_util.m:
Move the unable_to_open_file predicate here from error_util.m,
since it belongs here. Mark another predicate that writes
to the current output stream as obsolete.
compiler/hlds_error_util.m:
Mark two predicates that wrote out error_spec to the current output
stream as obsolete, and add versions that take an explicit output stream.
compiler/Mercury.options:
Compile the modules that call the newly obsoleted predicates
with --no-warn-obsolete, for the time being.
compiler/*.m:
Conform to the changes above, mostly by updating import_module
declarations, and renaming format_component to format_piece.
compiler/error_util.m:
Do not automatically add an nl to the end of the output
of component_list_to_line_pieces; instead, let the callers specify
how the last line should end. Most will pass nl, but some will pass
an nl_indent_delta to undo an earlier nl_indent_delta.
compiler/add_clause.m:
compiler/add_foreign_enum.m:
compiler/add_mode.m:
compiler/add_pragma.m:
compiler/error_msg_inst.m:
compiler/post_typecheck.m:
compiler/prog_foreign_enum.m:
compiler/typecheck_errors.m:
Conform to the change in error_util.m.
... to check_type_inst_mode_defns.m.
compiler/parse_tree.m:
Change the name in the include_module declaration.
compiler/comp_unit_interface.m:
compiler/convert_parse_tree.m:
compiler/decide_type_repn.m:
compiler/prog_foreign_enum.m:
compiler/prog_item.m:
Change the name in import_module declarations.
compiler/notes/compiler_design.html:
Change the name in the documentation.
compiler/unused_imports.m:
The bug was that if a procedure is exported, then the code considered
that any module mentioned in the type of *any* its variables was used
in the interface, when in fact only the modules mentioned in the types
of its *arguments* are used in the interface; the rest are used *only*
in the implementation.
Improve the debugging infrastructure.
NEWS:
Announce the change in the behavior of --warn-unused-imports.
compiler/type_util.m:
If a type_ctor has an unqualified sym_name, return "builtin" as its
module name, since
- after typechecking, all type_ctors will be module qualified, with
the only exceptions being the type_ctors of builtin types; and
- before typechecking, no type_ctors will be module qualified beyond
whatever qualification may have been written down explicitly
by the programmer, which makes calling the affected functions futile.
compiler/add_foreign_enum.m:
compiler/check_raw_comp_unit.m:
compiler/common.m:
compiler/hlds_out_inst_table.m:
compiler/hlds_out_module.m:
compiler/hlds_out_type_table.m:
compiler/lambda.m:
compiler/polymorphism_info.m:
compiler/polymorphism_post_copy.m:
compiler/polymorphism_type_class_info.m:
compiler/prog_foreign_enum.m:
compiler/simplify_tasks.m:
compiler/structure_reuse.analysis.m:
Move imports from the interface to the implementation if, with the
bug fix, we would get a warning from them remaining in the interface.
compiler/prog_foreign_enum.m:
This new module contains
- code that used to be duplicated in add_foreign_enum.m and
check_parse_tree_type_defns.m, and
- utility predicates called by that common code.
Moving all this code into a new module in the parse_tree package
allows check_parse_tree_type_defns.m which is also in the parse_tree
package, to avoid importing add_foreign_enum.m, which is in the hlds
package.
compiler/parse_tree.m:
Include the new module in the parse_tree package.
compiler/notes/compiler_design.html:
Document the new module.
compiler/add_foreign_enum.m:
compiler/check_parse_tree_type_defns.m:
Delete the code moved to prog_foreign_enum.m.