[m-rev.] for review: make mmc -f warn about multiply defined modules

Peter Wang wangp at students.csse.unimelb.edu.au
Tue Apr 3 12:15:29 AEST 2007


On 2007-04-02, Peter Wang <wangp at students.csse.unimelb.edu.au> wrote:
> On 2007-04-02, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> > 
> > On Mon, 2 Apr 2007, Peter Wang wrote:
> > 
> > >Branches: main
> > >
> > >compiler/source_file_map.m:
> > >	When generating a source file mapping, warn if a module is defined in
> > >	multiple files.
> ...
> > That's fine although it would also be useful to know what files
> > define the same module.
> 
> Ok, committed this revised version:
> 

Committed a followup.


Branches: main

compiler/source_file_map.m:
        When generating a source file mapping, don't warn about modules being
        defined in multiple files if it's simply due to the same file being
        listed on the command line multiple times.

Index: compiler/source_file_map.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/source_file_map.m,v
retrieving revision 1.21
diff -u -r1.21 source_file_map.m
--- compiler/source_file_map.m  2 Apr 2007 06:23:00 -0000       1.21
+++ compiler/source_file_map.m  3 Apr 2007 02:08:29 -0000
@@ -197,7 +197,10 @@
     find_module_name(FileName, MaybeModuleName, !IO),
     (
         MaybeModuleName = yes(ModuleName),
-        ( map.search(SeenModules0, ModuleName, PrevFileName) ->
+        (
+            map.search(SeenModules0, ModuleName, PrevFileName),
+            PrevFileName \= FileName
+        ->
             io.write_string("mercury_compile: module `", !IO),
             io.write_string(sym_name_to_string(ModuleName), !IO),
             io.write_string("' defined in multiple files: ", !IO),
@@ -208,7 +211,7 @@
             io.set_exit_status(1, !IO),
             SeenModules = SeenModules0
         ;
-            map.det_insert(SeenModules0, ModuleName, FileName, SeenModules)
+            map.set(SeenModules0, ModuleName, FileName, SeenModules)
         ),
         ( string.remove_suffix(FileName, ".m", PartialFileName0) ->
             PartialFileName = PartialFileName0

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list