Mercury Bugs - mercury
View Issue Details
0000102mercuryBugpublic2009-07-28 13:232009-12-17 00:52
Reporteruser185 
Assigned Tojuliensf 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000102: Inconsistent behaviour (error vs. warning) when compiling with --make
DescriptionThe attached source file contains a simple "hello world" application.
It specifies a module "mprojects" which is different from the name of the source file "mproject".

The following behaviour results when compiling directly:
13:17 dharabor@armitage build>mmc mproject.m
mproject.m:001: Warning: source file `mproject.m' contains module named
mproject.m:001: `mprojects'.

However, compiling with "mmc --make":
13:20 dharabor@armitage build>mmc --make mproject
Making Mercury/cs/mproject.c
Error: file `mproject.m' contains the wrong module.
  Expected module `mproject', found module `mprojects'.
mproject.m:001: Warning: source file `mproject.m' contains module named
mproject.m:001: `mprojects'.
** Error making `Mercury/cs/mproject.c'.

Which is correct? Is this an error or a warning?

TagsNo tags attached.
Attached Files? mproject.m (181) 2009-07-28 13:23
https://bugs.mercurylang.org/file_download.php?file_id=78&type=bug

Notes
(0000186)
juliensf   
2009-09-22 02:19   
It as an error when the compiler is invoked with --make and a warning when it
is invoked as just mmc.

Invoking mmc by itself can only be used to build single-module programs. In that
case it is possible to produce an executable even though the module name is "wrong".
(Typically, the compiler is only used this way with small things and aborting with an
error message would just be annoying - hence it is only warning.)

mmc --make is intended for building multi-module programs. WIth them it is simply
not possible for the compiler to build the program if the module and file names cannot
be resolved - hence it is an error in this case. (It probably shouldn't also be printing out
the warning in though.)

You can tell the compiler to allow non-matching module / filename combinations by
building a source file mapping, e.g. by using mmc's -f option.
(0000236)
juliensf   
2009-12-17 00:52   
Recent changes to the compiler mean that it no longer emits a warning in this case.

Issue History
2009-07-28 13:23user185New Issue
2009-07-28 13:23user185File Added: mproject.m
2009-09-22 02:19juliensfNote Added: 0000186
2009-09-22 02:19juliensfStatusnew => feedback
2009-12-17 00:52juliensfNote Added: 0000236
2009-12-17 00:52juliensfStatusfeedback => resolved
2009-12-17 00:52juliensfResolutionopen => fixed
2009-12-17 00:52juliensfAssigned To => juliensf