2024-11-24 15:16 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000102mercuryBugpublic2009-12-17 00:52
Reporteruser185 
Assigned Tojuliensf 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
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

-Relationships
+Relationships

-Notes

~0000186

juliensf (administrator)

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 (administrator)

Recent changes to the compiler mean that it no longer emits a warning in this case.
+Notes

-Issue History
Date Modified Username Field Change
2009-07-28 13:23 user185 New Issue
2009-07-28 13:23 user185 File Added: mproject.m
2009-09-22 02:19 juliensf Note Added: 0000186
2009-09-22 02:19 juliensf Status new => feedback
2009-12-17 00:52 juliensf Note Added: 0000236
2009-12-17 00:52 juliensf Status feedback => resolved
2009-12-17 00:52 juliensf Resolution open => fixed
2009-12-17 00:52 juliensf Assigned To => juliensf
+Issue History