[m-rev.] for review: Fix error messages related to bad .module_dep files.

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Oct 21 04:09:19 AEDT 2015



On Tue, 20 Oct 2015 17:44:06 +1100, Paul Bone <paul at bone.id.au> wrote:
> Now the error message is:
> 
>     $ mmc --make hello --rebuild
>     Making Mercury/int3s/hello.int3
>     Error reading file `/tmp/test2/lib/mercury/ints/Mercury/module_deps/pretty_printer.module_dep': failed to parse term
>     ...rebuilding
>     ** Error: error reading file `pretty_printer.m' to generate dependencies.
>     ** Module `pretty_printer' is imported or included by module `array'.
>     mercury_compile: cannot find source for module `pretty_printer' in directories
>       .

That message could be improved upon further in several ways.
One way would be to eliminate the duplication in "Error: error reading".
Another would be to say *why* we want to know *anything* about either
pretty_printer.m or array.m. A third would be to quote the directory names
in the search, path, since the "." can be easily overlooked.

However, your diff is a good first step.

> --- a/compiler/make.module_dep_file.m
> +++ b/compiler/make.module_dep_file.m
> @@ -243,6 +243,10 @@ do_get_module_dependencies(Globals, RebuildModuleDeps, ModuleName,
>          )
>      ;
>          MaybeDepFileTimestamp = error(_),
> +        debug_make_msg(Globals, io.format("Module dependencies file '%s' "
> +                    ++ "not found in directories %s.\n",
> +                [s(DepFileName), s(join_list(", ", SearchDirs))]),
> +            !IO),

I would change the indentation to show the nesting structure better.
Other than that, the diff seems fine.

Zoltan.




More information about the reviews mailing list