[m-rev.] for post-commit review: fix mantis bug 579

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Dec 15 11:39:20 AEDT 2025



On Sun, 14 Dec 2025 23:07:03 +1100, Julien Fischer <jfischer at opturion.com> wrote:

> On Sun, 14 Dec 2025 at 19:02, Zoltan Somogyi <zoltan.somogyi at runbox.com>
> wrote:
> 
> >
> > Tomorrow I will look into adding a test case for this bug.
> > (Adding a malformed MCFLAGS option to Mercury.options
> > would affect *all* test cases in a test directory, not just one.)
> >
> 
> It did occur to me that we could include a separate options file with the
> malformed MCFLAGS option and put the following in Mercury.options:
> 
>     MCFLAGS-bug579 = --options-file bug579.options
> 
> but that doesn't work and is seemingly ignored.  Which leads to the
> question,
> is the --options-file option supposed to be usable from within .options
> files?

It occurred to me too, and I believe the answer to your question is "no",
though I also don't think it was ever a *considered* no. The reason why
I think that it is that if you can *could* put "--options-file OF_B" into
e.g. OF_A, then, after seeing --options-file OF_A on the command line
and processing OF_A, the compiler would not just have to also process
OF_B, it would also have to process OF_C (if OF_B included "--options-file OF_C"),
and then OF_D and so on to a fixpoint. It does not do that.

And then there is also the issue that the appearance of "--options-file OF_A"
may occur in a module-specific variable, such as MCFLAGS-module_a.
This means that any option values read in from OF_A would be in effect
only when processing module_a in some fashion. The data structures in
options_file.m are not designed to represent such conditionality.

Overall, the compiler pays attention to the value of the options_files option
only when it decides in options_file.m what files to read. As you discovered,
any changes after that have no effect. For the reasons above, I think that's fine.
What is not fine is the absence of any mention of this limitation in the help text.
I therefore propose that we add the following to that help text:

Note that this option is intended to be used only on command lines.
When specified in options files (i.e. in files named by --options-file options),
it has no effect.

> The diff itself is fine.

Thanks for the review.

Zoltan.





More information about the reviews mailing list