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

Paul Bone paul at bone.id.au
Wed Oct 21 15:08:54 AEDT 2015


On Wed, Oct 21, 2015 at 04:09:19AM +1100, Zoltan Somogyi wrote:
> 
> 
> 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.

Thanks Zoltan.  I've made the first and third suggestions here and committed
the fixed diff.

The second suggestion, which I attempted to fix by making mmc print out the
chain of dependencies, appeared to be easy.  However I think it will be more
difficult to make useful.  I will post that soon to reviews.

> > --- 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.

Fixed.  Thanks.


-- 
Paul Bone



More information about the reviews mailing list