[m-rev.] for post-commit review: avoid int/imp duplicate imports in .intN

Julien Fischer jfischer at opturion.com
Fri Aug 20 21:18:13 AEST 2021


On Fri, 20 Aug 2021, Zoltan Somogyi wrote:

> Don't put duplicate imports/uses in .int{,0,2}.
> 
> The problem addressed by this diff is that copying any duplicate
> import_module and/or use_module declarations in .m files to
> automatically generated .intN files will cause those errors to be
> reported 1+M times, once when compiling the source module, and
> once for each of the M modules that import it. Those extra M reports
> are not useful; they are only clutter.
> 
> compiler/comp_unit_interface.m:
>     Do not copy the raw set of import_module and use_module declarations
>     from the source file to the .int0 file. Instead, compute them anew
>     from the import_and_or_use map, which was built by discarding any
>     duplicate declarations, either within a single section, or across
>     both sections.
>
>     When deciding which modules to generate a use_module declaration for
>     in the implementation section of a .int or .int2 file, do not include
>     one for any module which has a use_module declaration in the interface.
> 
> compiler/item_util.m:
>     Add a predicate that comp_unit_interface.m uses in the first task above.

That's fine.

Julien.


More information about the reviews mailing list