<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, 27 Nov 2025 at 16:59, Julien Fischer <<a href="mailto:jfischer@opturion.com">jfischer@opturion.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 27 Nov 2025 at 00:13, Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com" target="_blank">zoltan.somogyi@runbox.com</a>> wrote:<br></div><div><br></div><div> > Make --warn-unused-imports more effective.</div>> <br>> Specifically, make it warn about interface imports that are not used<br>> in the initial HLDS, even if they *are* used after the expansion of<br>> type-, inst- and mode-equivalences.<br>> <br>> compiler/hlds_module.m:<br>>     Add a slot to the HLDS to store the set of modules that are<br>>     imported in the interface but are unused there when the HLDS<br>>     is first constructed.<br>> <br>> compiler/module_qual.qualify_items.m:<br>>     Compute this set, and return it to mercury_compile_make_hlds.m.<br>> <br>>     Make the code module qualifying aug_compilation_units warn about<br>>     unused interface imports only if unused_imports.m won't do the same later.<br>> <br>> compiler/mercury_compile_make_hlds.m:<br>>     Pass the set to make_hlds_passes.m.<br>> <br>> compiler/make_hlds_passes.m:<br>>     Store the set in the initial HLDS.<br>> <br>> compiler/prog_data_used_modules.m:<br>>     Replace set_ordlists with set_tree234s.<br>> <br>> compiler/unused_imports.m:<br>>     Consider an interface-imported module unused in the interface<br>>     if module_qual.qualify_items.m considered it unused, even if<br>>     changes made by equiv_type.m has added uses of it later.<br>> <br>> compiler/handle_options.m:<br>>     Stop making --warn-unused-imports imply --no-warn-unused-interface-imports,<br>>     since new logic in module_qual.qualify_items.m makes this unnecessary.<br>> <br>> compiler/make_module_file_names.m:<br>> compiler/type_inst_mode_map.m:<br>> compiler/write_deps_file.m:<br>>     Move imports from the interface section to the implementation section,<br>>     in response to the new, more thorough warnings.<br><br>That's fine.<br></div></div></blockquote><div><br></div><div>Actually, there is one problem here.  The compiler is now ignoring the --no-warn-interface-imports</div><div>option and always printing a warning.  Consider:<br></div><div><br></div><div>   :- module a.</div><div>   :- interface.</div><div>   :-  import_module b.</div><div><br></div><div>   :- module b.</div><div>   :- interface.</div><div>   :- type foo ---> foo.</div><div><br></div><div>   $ mmc --no-warn-interface-imports --make liba</div><div><br></div><div>should not produce a warning, but now does.<br></div><div><br></div><div>Julien.<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br></div></div>