Files
mercury/tools
Zoltan Somogyi 984683b267 Fix the invalid/func_class test case.
The failure was caused by an error message generated by prog_io.m about a
problem (a file containing the wrong module) being ignored by deps_map.m.

A different problem was that we detected and generated error messages for this
problem in several places, which had different expectations and had access
to different information, and (partially but not wholly as a result of that)
generated different text. This diff makes all the pieces of code that detect
this problem use the same code to generate an error message. (Having only
one place to *detect* the problem would be more trouble that it is worth;
it would replace a few simple pieces of code with one larger, more complex
piece of code that would still have to cover all the relevant use cases,
but now removed from the rest of the code handling those use cases as well.)

It would probably be a good idea to unify those use cases as much as possible,
but that would be a much more complex change.

compiler/prog_io.m.m:
    Generalize the predicate that generates error messages for wrong module
    names, check_module_has_expected_name, to make it usable from both
    prog_io.m and read_modules.m.

    Replace a piece of code that had the same job with a call to this
    predicate.

compiler/read_modules.m.m:
    When reading in source files, ignore the errors that arise from
    trying to read nonexistent files if our caller asks us to do so
    (since some callers are not sure about what file a module is stored in),
    but if the file *is* found and opened, then do *not* ignore the
    errors we generate in parsing its contents.

    Call the generalized version of check_module_has_expected_name,
    and pass it the info it needs (the context of the module declaration).

compiler/deps_map.m:
    If the read-in module contains a different module name than expected,
    we already generated an error message for it, which read_modules.m
    now doesn't throw away, so we now just keep that message,
    and don't generate a redundant one.

compiler/error_util.m:
    When sorting error messages, we have, for a long time now, deleted
    duplicates. However, two error messages can differ in one having
    conditional inclusion of format components and the other always
    including the same components. We don't want to get two copies
    of the error message if the condition is true, so we now evaluate
    the conditions before sorting the messages. This is needed because
    the code in prog_io.m that generates error messages for wrong module names
    has to work in different conditions that have different ideas of how
    bad an error a wrong module name is.

    Provide a mechanism (a new phase in error messages) to separate
    error messages about wrong module names from other errors.
    This was part of an earlier attempt at solving the same problem
    using a different approach (generating a new error message about
    the problem only if we haven't already generated a message about it),
    but that approach had the problem that the text of the generated message
    could differ if it was generated in more than place, making it hard
    to write a good test case. (Hence the generalization of
    check_module_has_expected_name: although in some situations it generates
    unconditional and in other condition error messages, the text in those
    messages is always the same.) However, the new phase doesn't hurt
    anything, and may be useful later, e.g. to handle modules like
    tests/invalid_purity/purity_nonsense2.m differently, so keep it.

tests/invalid/Mmakefile:
    Execute the purity_nonsense2 test case without first generating its
    dependencies. If we did generate its dependencies, then due to the
    fact that we no longer ignore errors during that step, we would
    get *only* those errors, and not also the ones discovered by parts
    of the compiler invoked later, and which are also expected by
    purity_nonsense2.err_exp.

tests/invalid/bad_module_name.err_exp:
    Expect the updated text of the "wrong module name" error message.

tests/invalid/missing_interface_import2.{m,err_exp}:
    Due to a missing :- interface declaration, this test case wasn't testing
    what it was testing. Add the missing section marker, and expect the updated
    line numbers.

tools/bootcheck:
    Print an explicit message at the end of a successful bootchecks.
2015-09-11 01:21:23 +10:00
..
2011-07-28 06:55:16 +00:00
2011-06-27 17:38:01 +00:00
2015-09-06 21:01:11 +10:00
2013-04-29 13:40:43 +10:00

This directory, mercury/tools, contains scripts that are not intended
for use by users.  The scripts here are used by the Mercury developers
for maintaining the Mercury compiler.