compiler/write_module_interface_files.m:
If the code that computes the contents of an interface file also
generates messages to the user, don't take the mere existence of
these messages as grounds for not writing out the interface file;
instead, require them to report errors, or (if --halt-at-warn is enabled)
warnings.
compiler/error_util.m:
Provide a predicate for checking the above condition.
compiler/check_raw_comp_unit.m:
Fix, in two different ways, the warning that indicated the need for
the change to write_module_interface_files. First, if the module
exports nothing, then generate a warning only if warn_nothing_exported
is set, instead of always generating a warning that is conditional
on warn_nothing_exported being set. The latter doesn't just tickle
the problem mentioned above, it also uses more complex code. Second,
fix the wording of the warning.
tests/invalid/bigtest.err_exp:
tests/invalid/duplicate_modes.err_exp:
tests/invalid/empty_interface.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/no_exports.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/prog_io_erroneous.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_missing_det_3.err_exp:
tests/invalid/typeclass_no_param.err_exp:
tests/invalid/typeclass_test_11.err_exp:
tests/invalid/types.err_exp:
tests/invalid/undef_inst.err_exp:
tests/invalid/undef_mode.err_exp:
tests/invalid/undef_type.err_exp:
tests/invalid/unicode1.err_exp:
tests/invalid/unicode2.err_exp:
tests/invalid/vars_in_wrong_places.err_exp:
Expect the improved wording of the warning.
When deciding the contents of interface files, we used to generate
messages for these three kinds of errors:
- clauses in the module interface
- not-allowed-in-the-interface pragmas in the module interface
- empty module interface
None of these affected the interface file we were building, and their
reporting can easily be delayed until we are compiling the affected module
to target language code. At that time, the error messages get put into
.err files, whereas any messages printed when creating interface files
tends to get lost in the overall sea of compiler invocation messages
when running mmake.
compiler/comp_unit_interface.m:
Do not generate error messages when building the contents of interface
files.
compiler/write_module_interface_files.m:
Do not print the error messages that are no longer being generated.
We *do* still print any of the other kinds of error messages we have
been printing, such as for those when a needed .int3 file cannot be read,
or when ambiguity prevents full module qualification. (The contents of
.int and .int2 files must be fully module qualified to do their jobs.)
compiler/add_pragma.m:
Report an error when processing a pass 3 pragma that occurs in the
interface but is not allowed in the interface.
add_pragma.m has already been doing this for all other kinds of pragmas,
and in general, compiler invocations that generate target language code
do generate the messages for all the conditions whose messages we are
no longer printing when generating interface files.
tests/invalid/bad_item_in_interface.{m,err_exp}:
tests/invalid/ft_examples:
A new test case to test the above assertion with respect to
inappropriate items in the interface of a module.
tests/invalid/empty_interface.{m,err_exp}:
A new test case to test the above assertion with respect to
the interface of a module being empty.
tests/invalid/Mercury.options:
Specify the right options for the empty_interface test case.
tests/invalid/Mmakefile:
Enable the new test cases.